Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.env default file hidden under server/workers/flavorconfigs/example.env #659

Open
frafra opened this issue Jun 20, 2022 · 2 comments
Open

Comments

@frafra
Copy link

frafra commented Jun 20, 2022

Hi,
there is a docker-compose.yml which use some env variables, but there is no example of list of these variables. It would be useful to have an .env file (or an example) listing these variables with some defaults, as the current setup cannot be executed otherwise.

This is what I have done with version 7:

$ grep -Po '(?<=\${)[^}]*(?=})' docker-compose.yml | sort -u | xargs -I% echo %=
API_PORT=
COMPOSE_PROJECT_NAME=
POSTGRES_HOST=
POSTGRES_HOSTNAME=
POSTGRES_PASSWORD=
POSTGRES_PORT=
POSTGRES_USER=
REDIS_DB=
REDIS_HOST=
REDIS_PASSWORD=
REDIS_PORT=
SERVICE_VERSION=

Here is a possible example:

API_PORT=8000
COMPOSE_PROJECT_NAME=headstart
POSTGRES_HOST=postgres
POSTGRES_HOSTNAME=db
POSTGRES_PASSWORD=changeme
POSTGRES_PORT=5432
POSTGRES_USER=postgres
REDIS_DB=redis
REDIS_HOST=redis
REDIS_PASSWORD=changeme
REDIS_PORT=6379
SERVICE_VERSION=7

Some of these variables could be hardcoded:

  • SERVICE_VERSION should be set to the current version, as the compose file is stored together with the code
  • hostnames and hosts can be set to their default value (the container name), but I see no reason to change or specify them
  • ports could be set to the service default (again, no reason to change them when not using the host network directly)
@frafra frafra changed the title Missing .env example for docker-compose.yml Missing .env for docker-compose.yml Jun 20, 2022
@frafra
Copy link
Author

frafra commented Jun 20, 2022

It would be also nice to have a comment within such file explaining what a variable does. In master there are variables that are not trivial to figure how what they do or how they should be set.

@frafra
Copy link
Author

frafra commented Jun 20, 2022

Ok, I guess that the example is stored here: https://github.com/OpenKnowledgeMaps/Headstart/blob/8dd82a9854a6d915e80a87a3ecbd2c13775dccf3/server/workers/flavorconfigs/example.env.

As docker compose expects .env to be in the same directory of docker-compose.yml by default, I would suggest moving example.env file closer to where it is expected to be found.

@frafra frafra changed the title Missing .env for docker-compose.yml .env default file hidden under server/workers/flavorconfigs/example.env Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant