# Docker/MongoDb, stuck on "Waiting for your environment variables"

**URL:** <https://community.forestadmin.com/t/docker-mongodb-stuck-on-waiting-for-your-environment-variables/3401>\
**Category:** Help me!\
**Created:** [October 1, 2021, 1:22pm UTC](https://community.forestadmin.com/t/docker-mongodb-stuck-on-waiting-for-your-environment-variables/3401 "2021-10-01T13:22:21Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![TravisD](https://avatars.discourse-cdn.com/v4/letter/t/b3f665/32.png) [@TravisD](https://community.forestadmin.com/u/TravisD)\
**Post date:** [October 1, 2021, 1:22pm UTC](https://community.forestadmin.com/t/docker-mongodb-stuck-on-waiting-for-your-environment-variables/3401/1 "2021-10-01T13:22:21Z")

</div>

I’m on this page:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/c/c6638593981892c35f4ff173b4cfdf5368742af6.png)

I copy the environment variables over to `.env` as instructed, running with docker on amazon linux, using ngrok for my application URL.

I start the application:

```javascript
$ docker-compose up
Starting my_admin ... done
Attaching to my_admin
my_admin |
my_admin | > my-admin@0.0.1 start /usr/src/app
my_admin | > node ./server.js
my_admin |
my_admin | Your application is listening on port 3310.
my_admin | [forest] 🌳🌳🌳 The .forestadmin-schema.json file does not exist.
my_admin | {}
my_admin | [forest] 🌳🌳🌳 The schema cannot be synchronized with Forest Admin servers.
my_admin | {}
my_admin | Your admin panel is available here: https://app.forestadmin.com/projects
my_admin | GET /forest 204 - - 23.890 ms
my_admin | GET /forest 204 - - 1.742 ms
my_admin | GET /forest 204 - - 1.828 ms

```

and nothing changes. Does changing `.env` and running `docker-compose up` not work, did I miss a step?

When I go to [https://app.forestadmin.com/projects](https://app.forestadmin.com/projects), and click on my project, I get the error:

```javascript
Access forbidden
You don’t have access to any environment.
You can create a development environment in the Environments settings.
If you’re not a developer, please contact the admin of this project.

```

`docker ps` shows that the container is running and was restarted 13 mins ago.

To install, I ran:

```javascript
docker pull forestadmin/toolbelt

docker run --rm --init -it -v ~/.forest.d:/usr/src/cli/.forest.d -e TOKEN_PATH="/usr/src/cli" forestadmin/toolbelt login

docker run --rm --init -it -v `pwd`:/usr/src/app -v ~/.forest.d:/usr/src/cli/.forest.d -e TOKEN_PATH="/usr/src/cli" forestadmin/toolbelt projects:create "My Admin" --databaseConnectionURL "mongodb:// *****" --applicationHost "localhost" --applicationPort "3310"

cd "My Admin"

 docker-compose up

```

I thought perhaps the space in “My Admin” could be a problem, deleted

`/home/ec2-user/My Admin`

re-ran the `docker run --rm --init` command with

`projects:create "MyAdmin" `

but am experiencing the same issue. `cd MyAdmin && docker-compose up` has the same result. The “Set your environment variables page” just says "  
Waiting for your environment variables to be correctly set. " and it seems to continuously ping my installation on the `/forest` endpoint:

```javascript
my_admin | GET /forest 204 - - 1.171 ms
my_admin | GET /forest 204 - - 0.874 ms
my_admin | GET /forest 204 - - 0.838 ms
my_admin | GET /forest 204 - - 0.902 ms
my_admin | GET /forest 204 - - 2.512 ms
my_admin | GET /forest 204 - - 0.882 ms
my_admin | GET /forest 204 - - 0.902 ms

```

I tried appending the environment variables to the `.env` and then replaced the entire contents of `.env` with the 5 environment variables listed. I first received an error :

```javascript
WARNING: The APPLICATION_PORT variable is not set. Defaulting to a blank string.
WARNING: The DATABASE_SSL variable is not set. Defaulting to a blank string.
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.app.ports contains an invalid type, it should be a number, or an object

```

So I added `APPLICATION_PORT=3310` back in, and restarted, but to no avail.

---

<div class="post-metadata">

**Author:** ![TravisD](https://avatars.discourse-cdn.com/v4/letter/t/b3f665/32.png) [@TravisD](https://community.forestadmin.com/u/TravisD)\
**Post date:** [October 1, 2021, 1:33pm UTC](https://community.forestadmin.com/t/docker-mongodb-stuck-on-waiting-for-your-environment-variables/3401/2 "2021-10-01T13:33:10Z")

</div>

Also tried deploying a “staging” environment instead of production. Same problem.

---

<div class="post-metadata">

**Author:** ![TravisD](https://avatars.discourse-cdn.com/v4/letter/t/b3f665/32.png) [@TravisD](https://community.forestadmin.com/u/TravisD)\
**Post date:** [October 1, 2021, 1:43pm UTC](https://community.forestadmin.com/t/docker-mongodb-stuck-on-waiting-for-your-environment-variables/3401/3 "2021-10-01T13:43:47Z")

</div>

Something is definitely not working. I tried creating a new project and on the “Plug your Datasource” step, it gets stuck on “Waiting for your backend to run” even though the console show’s the app is listening on port 3310 and I can load the URL in my browser without any issues.

 ![Screen Shot 2021-10-01 at 9.38.24 AM](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/9/92a303ad098ebb34e597748f69860f652c10531b.jpeg)

---

<div class="post-metadata">

**Author:** ![TravisD](https://avatars.discourse-cdn.com/v4/letter/t/b3f665/32.png) [@TravisD](https://community.forestadmin.com/u/TravisD)\
**Post date:** [October 1, 2021, 1:46pm UTC](https://community.forestadmin.com/t/docker-mongodb-stuck-on-waiting-for-your-environment-variables/3401/4 "2021-10-01T13:46:42Z")

</div>

Why are there files installed in my ec2-user directory with root permissions?

```javascript

$ ls -latrh /home/ec2-user/.forest.d/.forestrc
-rw-r--r-- 1 root root 781 Oct 1 13:34 /home/ec2-user/.forest.d/.forestrc

```

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [October 1, 2021, 1:49pm UTC](https://community.forestadmin.com/t/docker-mongodb-stuck-on-waiting-for-your-environment-variables/3401/5 "2021-10-01T13:49:20Z")

</div>

Hey @TravisD, and welcome to our community 👋

Could you log the value of `process.env.FOREST_ENV_SECRET` inside your production running code to check it’s value ? It’s a common issue here.

Also, our `docker-compose.yml` is not dedicated to production usage. You should build the docker image directly, then run it. Theoretically, you shouldn’t then have the file you mentioned.

Let me know if that helps

---

<div class="post-metadata">

**Author:** ![TravisD](https://avatars.discourse-cdn.com/v4/letter/t/b3f665/32.png) [@TravisD](https://community.forestadmin.com/u/TravisD)\
**Post date:** [October 1, 2021, 1:54pm UTC](https://community.forestadmin.com/t/docker-mongodb-stuck-on-waiting-for-your-environment-variables/3401/6 "2021-10-01T13:54:12Z")

</div>

I’m not sure what you’re asking for. I just followed the instructions provided, step-by-step. How do I log the value? If it’s a common issue, why not fix it?

“you should build the docker image directly, then run it” - I don’t know what this means. I followed these step-by-step instructions:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/c/c857c66828214e0b266424ff024b8a5228da72d5.png)

NPM also does not work. In the projects page, I get “Unable to authenticate you”, I click “Log in again”, but it just refreshes the page and nothing changes.

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/1/15e9acf0f0adefb420b9b8b81363e57db8fca0ad.jpeg)

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [October 1, 2021, 2:08pm UTC](https://community.forestadmin.com/t/docker-mongodb-stuck-on-waiting-for-your-environment-variables/3401/7 "2021-10-01T14:08:42Z")

</div>

This is the onboarding you are following. Deploying to a staging or production server is not the same flow, and it’s available in the location you took a screenshot before.

> If it’s a common issue, why not fix it?

It’s a misconfiguration on your end, nothing we can fix here. But if you are able to indeed provide a fix, feel free to open a PR, `forest-express-sequelize` is open-source.

> “you should build the docker image directly, then run it” - I don’t know what this means. I followed these step-by-step instructions:

Step by step instructions are meant to be used locally, not on a remote or production.

The `root:root` permission file you mentioned is a shared volume inside the docker-compose.yml file, used to ease the onboarding. If you don’t wan’t this file, just don’t add the shared volume.  
We provide both `docker-compose.yml` and `Dockerfile` upon project generation.

These files are under your own control and after the generation, we do not have access to them and you are in charge of maintaining them - just like the rest of your generated project.

> I’m not sure what you’re asking for. I just followed the instructions provided, step-by-step. How do I log the value?

Add a `console.log(process.env.FOREST_ENV_SECRET);` after `require('dotenv').config()` in your project files.

There are load of thread here mentioning the issue you are experiencing.

Let me know if that helps.

---

<div class="post-metadata">

**Author:** ![TravisD](https://avatars.discourse-cdn.com/v4/letter/t/b3f665/32.png) [@TravisD](https://community.forestadmin.com/u/TravisD)\
**Post date:** [October 1, 2021, 2:14pm UTC](https://community.forestadmin.com/t/docker-mongodb-stuck-on-waiting-for-your-environment-variables/3401/8 "2021-10-01T14:14:39Z")

</div>

I’m following the exact instructions provided. They don’t work. If there are different step-by-step instructions for remote, where are they? It shouldn’t matter whether my “local” machine is actually an Amazon EC2 instance or not, it’s the same thing.

“just like you generated the rest of your project” - again, I’m just following these instructions. They don’t work. The admin back end is running, not giving an errors, and the “Plug your datasource” is perpetually waiting for “your backend to run”. Something is not connecting. If the backend can’t establish a connection to forest, it should generate an error.

Pasting a secret key in a public forum? Sure, ok: `Edited`

I’ve read and went through all of the threads mentioning what I’m experiencing, they don’t help.

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [October 1, 2021, 2:36pm UTC](https://community.forestadmin.com/t/docker-mongodb-stuck-on-waiting-for-your-environment-variables/3401/9 "2021-10-01T14:36:05Z")

</div>

> It shouldn’t matter whether my “local” machine is actually an Amazon EC2 instance or not, it’s the same thing.

In fact, it does. Development environment have access to all the features we provide. Staging & Production environment don’t for community plan. We also have a restriction on seats available on remote environments.

> again, I’m just following these instructions. They don’t work. The admin back end is running, not giving an errors, and the “Plug your datasource” is perpetually waiting for “your backend to run”. Something is not connecting. If the backend can’t establish a connection to forest, it should generate an error.

We are not able to detect an incorrect environment secret if it does match with an existing environment. Indeed, errors could be more explicit on that side I agree.  
All the threads mentionning the exact same issue you are experiencing usually reference issues or conflicts between environment variable, and that’s why I asked you to log this information.  
Copy pasting the one available on the frontend will not help, since I actually just want to make sure there is no such conflict in your configuration.

> Pasting a secret key in a public forum? Sure, ok

I did not explicitly asked you to copy paste it here. DM are available …

> Great attitude, BTW.

I’m here to assist you in the debug process. I don’t have access to your EC2 instance, nor your variables. My initial message was asking simple questions, like logging a value inside your code or building a docker image which are the usual suspect when dealing with the “Deploy to production” workflow, and the second message wasn’t in any manner with aggressive or meaning attitude. Sorry you feel it that way.

The environment secret (That I edited) you shared does not match with any of your project having a production environment. That’s most likely why you are not able to setup your production environment.

---

<div class="post-metadata">

**Author:** ![TravisD](https://avatars.discourse-cdn.com/v4/letter/t/b3f665/32.png) [@TravisD](https://community.forestadmin.com/u/TravisD)\
**Post date:** [October 1, 2021, 3:40pm UTC](https://community.forestadmin.com/t/docker-mongodb-stuck-on-waiting-for-your-environment-variables/3401/10 "2021-10-01T15:40:39Z")

</div>

Why does the NPM version seem to work, but has the “Unable to authenticate you” error?

---

<div class="post-metadata">

**Author:** ![TravisD](https://avatars.discourse-cdn.com/v4/letter/t/b3f665/32.png) [@TravisD](https://community.forestadmin.com/u/TravisD)\
**Post date:** [October 1, 2021, 3:47pm UTC](https://community.forestadmin.com/t/docker-mongodb-stuck-on-waiting-for-your-environment-variables/3401/11 "2021-10-01T15:47:23Z")

</div>

The “create your admin backend” steps also do not work on Mac OS X

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/2/295db74d4839a7e823c24c039f2b4a731168b03f.jpeg)

---

<div class="post-metadata">

**Author:** ![TravisD](https://avatars.discourse-cdn.com/v4/letter/t/b3f665/32.png) [@TravisD](https://community.forestadmin.com/u/TravisD)\
**Post date:** [October 1, 2021, 5:46pm UTC](https://community.forestadmin.com/t/docker-mongodb-stuck-on-waiting-for-your-environment-variables/3401/12 "2021-10-01T17:46:38Z")

</div>

Here’s a loom video of the steps I took for both Docker and NPM.

---

<div class="post-metadata">

**Author:** ![anon36130554](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@anon36130554](https://community.forestadmin.com/u/anon36130554)\
**Post date:** [October 4, 2021, 2:39pm UTC](https://community.forestadmin.com/t/docker-mongodb-stuck-on-waiting-for-your-environment-variables/3401/13 "2021-10-04T14:39:14Z")

</div>

Hello @TravisD 👋

You are almost done 🙌

As stated before, the installation process while you onboard has been made for local purpose only. If I’m not mistaken you are currently trying to install on an EC2 instance, which is fine, we can workaround that and make things work, but this requires a little bit of extra configuration.

I’ve seen you are using NGRock to re-route the trafic from your EC2 instance, we will make use of it. Also, we will need to change the commands to generate your backend a little bit. Let me explain quickly to get things clear.

When you generate your project, the “generate a new backend application” step provides you with a command to first, create an environment of your project on our side, and then generate a skeleton of a NodeJS you will make use of.

If you check the command carefully, you will see that some extra parameters are passed to the command which are `--applicationHost "localhost" --applicationPort "3310"`. As you can see, this means that for us, your project will run on your local machine on port 3310. Which is not the case actually. This is why the green sensor in the onboarding page still remains green, because we are not able to reach your generated application on `http://localhost:3310`. Instead, we should target your NGRock. So indeed, your generated code displays that the server is running, but the webapp is not able to reach it (to detect that your backend is reachable we ping it with `http://localhost:3310/forest` just to check that it is running, in your server logs we clearly see that no such call is perform).

That being explained, to workaround your remote installation process, you need to change the two parameters I have detailed above to the domain name used by NGRock (`neverland-forest.ngrock.io` if I’m not mistaken) and the associated port (which should be 80).

Can you try once again with the updated parameters ?

I’m pretty sure we will be able to onboard you soon, you are close to the end 💪

Awaiting your answer,

Steve.
