How can I change the mongodb url for my production instance of ForestAdmin?

Hey guys,

How can I change the mongodb url for the production instance of ForestAdmin that I made? I’ve already tried to change the environment variable for the db string in /env/environment, restarted ForestAdmin in production but no luck.

I created a new database for the Production instance of ForestAdmin to connect to.

Would appreciate the help.

Thanks

Hi @Lean_Junio,

Thanks for reaching out.

Did you changed the value in the Forest Admin interface by accessing Project Settings > Environments > Production and replace the Admin backend URL value?

Let me know! :pray:

Hey @anon34731316,

I didn’t change that value. I figured not to since the EC2 instance where the MongoDB instance lives in didn’t change.

Only the username, password, and the database name has changed.

Lean

@Lean_Junio Sorry my bad :man_facepalming:
I read your message too quickly!

You need to update the DATABASE_URL in your admin backend .env file.
Have you done it already?

I definitely haven’t done that yet (I think?).

Are you by any chance talking about the ForestAdmin backend? Or the backend of my app? If you mean the backend of my app, I’ve actually already replaced the DATABASE_URL for the backend of my app.

If you mean backend as in the folder containing the forest admin instance though, I actually wasn’t able to find the documentations about a .env file for that.

I was under the assumption that ForestAdmin on prod looks at the /etc/environment file for environment variables?

@Lean_Junio,

Did you generate a brand new node backend during the installation process thanks to Lumber?
If you did, this is the backend I’m talking about where you should change the .env file.
Or you installed Forest Admin directly on your Rails application?

If you just give me your project name I’d be able to find this information on my own :wink:

Nope, my Forest Admin instance is separate from my Node application actually.

My project name is “autohound”

PastedGraphic-2.png

Thanks!

Ok great!

So you should be able to find, in your Forest Admin instance, a .env file (in the root) that have been generated automatically.
Once you’ve found it, you’ll be able to update your DATABASE_URL.

Let me know if it does the trick :raised_hands:
Thanks!

Oh I see,

So just to confirm, should this .env file be used locally or only production, or both?

Lean

@Lean_Junio,

You should have one Forest Admin instance per environment (dev, staging, prod…), so each .env file is only related to this specific environment.
Is it clearer to you?