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

feat(deployment): no env_file #14889

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

mmomjian
Copy link
Contributor

@mmomjian mmomjian commented Dec 23, 2024

With container consolidations, at this point the env_file directive is causing increased support burden for no benefit. I propose that we remove it and expressly declare the necessary variables.

The only thing that we lose by removing env_file from ML is the TZ, which I don't believe is needed. open to any discussion. This should be a non-breaking change, even for our copy pasters

Not too sure how exactly to apply it to the dev and prod YAMLs but should be very easy, I can work on it if we move forward. One big benefit is eliminating a setup step for portainer users.

Copy link
Contributor

@jrasm91 jrasm91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

docker/docker-compose.yml Outdated Show resolved Hide resolved
@mmomjian mmomjian marked this pull request as ready for review December 29, 2024 04:18
@mmomjian mmomjian requested a review from bo0tzz as a code owner December 29, 2024 04:18
@mmomjian
Copy link
Contributor Author

Per the discussion on discord do we want to add REDIS_HOSTNAME or hold off for the new project for that?

# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
# TZ=Etc/UTC
# To set a timezone, change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
TZ=Etc/UTC
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change this to an empty string (TZ=‘’) and log a warning on server startup if empty?

@@ -40,8 +43,6 @@ services:
# service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
volumes:
- model-cache:/cache
env_file:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be confusing. There are many environmental variables in the machine learning service, including commonly used ones like for preloading certain models.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the new Get Immich generator is also doing away with the env, Isn’t it best practice to assign the env vars to the corresponding container?

@@ -19,8 +19,11 @@ services:
# Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
- ${UPLOAD_LOCATION}:/usr/src/app/upload
- /etc/localtime:/etc/localtime:ro
env_file:
- .env
environment:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, I think it's confusing to have a .env file that only applies these variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that’s just how Docker env works, so I would argue our current approach is MORE confusing. It’s caused a lot of issue for people especially with stuff like Portainer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's a .env file, I expect it to apply to the containers in the Compose file. It's surprising for it to sometimes do this and sometimes not depending on which variable I'm adding.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then perhaps it would be better to deprecate the .env entirely when we move to the get.immich generator and provide a static docker-compose?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't assume the user won't ever need to add an env after they start using the compose file. If and when they do, there should be a place to put that env that ideally isn't the compose file itself; not needing to modify the file directly is part of the point of the generator.

The .env file makes this a complete non-issue. I guess I'm not seeing the practical benefit for this change - what are the problems with the .env file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants