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

I’m on this page:

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:

$ 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, and click on my project, I get the error:

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:

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:

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 :

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.

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

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.

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


$ 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

Hey @TravisD, and welcome to our community :wave:

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

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:

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.

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.

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.

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.

1 Like

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

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

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

Hello @TravisD :wave:

You are almost done :raised_hands:

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 :muscle:

Awaiting your answer,

Steve.