TheSpaghettiDetective / obico-server

Obico is a community-built, open-source smart 3D printing platform used by makers, enthusiasts, and tinkerers around the world.
https://obico.io
GNU Affero General Public License v3.0
1.47k stars 297 forks source link

Documentation mismatch on .env file and other issues #643

Closed MallocArray closed 2 years ago

MallocArray commented 2 years ago

Describe the bug On this page: https://www.obico.io/docs/server-guides/configure/#email-smtp the example says to find these variables and set them to the correct values, but the leading # is still present, which typically indicates the line is commented out and will not take effect.

On another page https://www.obico.io/docs/server-guides/email_guide/ The leading # is not present, which I believe is the correct method, but wanted to double check. This code block is also indented with 2 spaces, which I don't think is necessary/supported

It also mentions modifying docker-compose.yaml which isn't necessary anymore since the .env file is being used. I'm unsure if docker-compose up --build -d is still needed to accept the new values from the .env file or not.

Edit: This is actually a much larger issue. To properly work for me, for the e-mail related entries in the .env file I had to remove all quotes as well as all other comments, as even the helpful comment at the end of the line was making it into the ENV inside of the container.

Does not work:

EMAIL_HOST="smtp.office365.com"  # Such as "smtp.gmail.com"

Does work

EMAIL_HOST=smtp.office365.com

So the instructions need to be updated to clarify that the comments at the end of the line need to be removed, and all of the empty quotes should be removed, or made clear that no quote should be used when entering the desired information.

Also, this page: https://www.obico.io/docs/server-guides/configure/#email-smtp mentions using docker-compose restart but this does not appear to actually update the environment variables inside of the web container as verified with sudo docker exec obico-server_web_1 env

Using the command from: https://www.obico.io/docs/server-guides/email_guide/ this does update the environment variable properly and allows it to operate as expected when paired with the above mention of removing all comments and quotes

sudo docker-compose up --build -d

To Reproduce Steps to reproduce the behavior:

  1. ...
  2. ...
  3. ...

Screenshots If applicable, add screenshots to help explain your problem.

Hosting environment (please complete the following information):

Additional context Add any other context about the problem here.

kennethjiang commented 2 years ago

Than you @MallocArray for reporting these problems in the doc. I pushed https://github.com/TheSpaghettiDetective/obico-server/commit/e3e0c80f0a23923d5a2e8aacaf5f95ebfcf7f355

Not entirely sure about the deal around " in .env. It worked for me on Mac. I'm suspecting it's related to the docker version/platform...? Can you do a bit more research on this topic? I don't want to change it so that it fix a problem for some platforms but causes a problem for others.

MallocArray commented 2 years ago

I know that changing EMAIL_HOST=smtp.office365.com to EMAIL_HOST="smtp.office365.com" stopped it from being able to send in my Oracle Cloud Instance running Ubuntu 20.04. I'll have to get the exact Docker version that I'm running.

I can test it again as I was attempting several things when I started narrowing down to just that.

The comments also came through in my environment variables inside of the container which I think adds to the issue. If you have comments in the .env lines, can you check what value you see in the container? So if your .env has EMAIL_HOST="smtp.office365.com" # Such as "smtp.gmail.com" what do you see when you run

sudo docker exec obico-server_web_1 env

In my output, I was seeing

EMAIL_HOST="smtp.office365.com"  # Such as "smtp.gmail.com"

which means the actual environment variable inside of the container had the full string just as it was, including the comment, while I would have expected that to be stripped out.

kennethjiang commented 2 years ago

I think this is relevant.

MallocArray commented 2 years ago

Are you using straight docker then? From how I read that link, it sounds like there is a difference in how docker and docker-compose treat the variable. Or are you using a newer version of docker-compose maybe?

This is what I get when using the latest Ubuntu 20.04 template from Oracle Cloud and install docker-compose with apt

sudo apt install docker-compose jq zip -y

$ docker-compose --version
docker-compose version 1.25.0, build unknown
$ docker --version
Docker version 20.10.12, build 20.10.12-0ubuntu2~20.04.1
kennethjiang commented 2 years ago

https://github.com/TheSpaghettiDetective/obico-server/commit/c079c45afc3c11258751ea1f969798f2b64c6e1c

kennethjiang commented 2 years ago

It looks like the newer version of docker-compose handles quotes. But it should be safe to remove quotes based on the official docs.

MallocArray commented 2 years ago

ok, thanks. From this link, it looks like I need to use a different package name to install the latest version of compose, which I'll test out tomorrow https://docs.docker.com/compose/install/ sudo apt-get install docker-compose-plugin