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

Docker-compose env variables for email won't be set #325

Open
onlynow2 opened this issue Dec 7, 2022 · 7 comments
Open

Docker-compose env variables for email won't be set #325

onlynow2 opened this issue Dec 7, 2022 · 7 comments
Labels
documentation Improvements or additions to documentation

Comments

@onlynow2
Copy link

onlynow2 commented Dec 7, 2022

I'm not sure if this is the right project for this issue (or if it should be in the gramps.js project).

When setting the email environment variables in the docker-compose.yaml file, as mentioned in the documentation ) they would not get used within the neccessary fields during first startup of the created container.
The fields are empty, just if the environment variables were never set.

@ondrno
Copy link

ondrno commented Dec 8, 2022

@onlynow2 : Would you please provide the docker-compose file what you have used? Thanks.

@onlynow2
Copy link
Author

onlynow2 commented Dec 8, 2022

sure, I was using following docker-compose file:

`version: "3.7"

services:
grampsweb:
image: ghcr.io/gramps-project/grampsweb:latest
container_name: grampsweb
ports:
- "5000:5000" # host:docker
environment:
TREE: "Gramps Web" # will create a new tree if not exists
EMAIL_HOST: "mail.example.com"
EMAIL_PORT: 587
EMAIL_HOST_USER: "[email protected]"
EMAIL_HOST_PASSWORD: "secretpassword"
EMAIL_USE_TLS: True
DEFAULT_FROM_EMAIL: "[email protected]"
volumes:
- /grampsWeb/users:/app/users # persist user database
- /grampsWeb/index:/app/indexdir # persist search index
- /grampsWeb/thumb_cache:/app/thumbnail_cache # persist thumbnails
- /grampsWeb/secret:/app/secret # persist flask secret
- /grampsWeb/db:/root/.gramps/grampsdb # persist Gramps database
- /grampsWeb/media:/app/media # persist media files
restart: always`

@ondrno
Copy link

ondrno commented Dec 9, 2022

@DavidMStraub : Maybe it's more an issue of Gramps.js? The environment variables are correctly set inside of the container. I have verified it.

@onlynow2 : You can check it

docker exec -it <container_name> sh
# echo $EMAIL_HOST $DEFAULT_FROM_EMAIL
mail.example.com [email protected]

@DavidMStraub
Copy link
Member

@onlynow2 can you please elaborate what you mean by "the fields are empty"? What is the actual error you are seeing?

@DavidMStraub
Copy link
Member

Is this issue this present?

@onlynow2
Copy link
Author

@DavidMStraub sorry for the late reply, but @ondrno is right.
The details are correctly set inside the container. I verified it, too.
So I'd expect the fields for "E-mail settings" within the first startup of the container being already filled out. So anyone can see the variables from the docker-compose file were correctly set and are being used.
grafik

@DavidMStraub
Copy link
Member

Oh, now I finally understood the problem, thank you.

Yes, that's right, the "onboarding" dialog in Gramps.js doesn't know anything about the environment variables.

The reason is a bit complicated - originally, Web API only allowed configuring email settings via the flask config, either via a config file or via environment variables. To implement the new web-based onboarding workflow, an additional database-based configuration layer was added that is used if present. These database-stored config options are available via the REST API.

If you configure email via the environment but do not creat an admin user, the onboarding dialog will be shown but it will not know about the email settings. If you fill in the form and submit it, it will store the new settings in the database and they will override the environment settings.

I don't see a reasonable way to solve this the way things are currently set up, so I suggest to simply document it.

@DavidMStraub DavidMStraub added the documentation Improvements or additions to documentation label Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants