I
Immich•2y ago
stavros-k

Which environment variables are used by each container?

Hello, I'm trying to figure out which environment variables are used by each containers, but I don't see them anywhere documented (only what they do, but not which continer makes use of them). What I'm trying to accomplish: I want each container to have exactly the info it needs, no more no less. For example, I don't think the proxy needs the database credentials. Is there somewhere I can get this info? Thanks
51 Replies
bo0tzz
bo0tzz•2y ago
There is no good documentation of this yet, it's one of the things we've been putting off unfortunately
stavros-k
stavros-kOP•2y ago
I don't mind looking into the code, assuming that for each service/container there is a "config init" file. If there is such thing, can you point me to it?
jrasm91
jrasm91•2y ago
The best way is to just do a search for process.env. that will show most of the variables.
stavros-k
stavros-kOP•2y ago
Thanks I'll see if I can create a small .md file with a table. And you can update/fix/extend it afterwards
jrasm91
jrasm91•2y ago
It would be great to add a section to the docs.
stavros-k
stavros-kOP•2y ago
Sounds good!
jrasm91
jrasm91•2y ago
In the docs/ folder you can run the docs locally and they work with .md files. You could add a new section under administration for Environment Variables
No description
jrasm91
jrasm91•2y ago
We can help correct and update them if you put together an initial draft. I'd also like to simpliy/consolidate this and whitelist the specific env variables in the compose files as well.
stavros-k
stavros-kOP•2y ago
I'm thinking something like | env | description | default | services |
bo0tzz
bo0tzz•2y ago
Nitpick but under the install section might be a better spot? Administration is mostly concerned with things in the UI
jrasm91
jrasm91•2y ago
Fair enough, yeah that's probably better. I'd also love to delete all the comments from the example.env and all the other places they show up (copied) in the docs.
jrasm91
jrasm91•2y ago
No description
bo0tzz
bo0tzz•2y ago
Yeah absolutely, I'd love for all that documentation to be in this new page instead
jrasm91
jrasm91•2y ago
Yes, just link to the new page instead.
bo0tzz
bo0tzz•2y ago
So the example.env is only the vars that are strictly required, and nothing else
stavros-k
stavros-kOP•2y ago
I suppose server + microservices use the same envs right?
bo0tzz
bo0tzz•2y ago
Mostly yes, I think there may be a handful that are different though?
jrasm91
jrasm91•2y ago
There is a port one specific to each
stavros-k
stavros-kOP•2y ago
Cool I'll keep an eye
jrasm91
jrasm91•2y ago
Both use NODE_ENV, DB*, REDIS*, TYPESENSE* Both use IMMICH_MEDIA_LOCATION and IMMICH_MACHINE_LEARNING_URL
stavros-k
stavros-kOP•2y ago
and TZ ?
jrasm91
jrasm91•2y ago
That's just for testing Some unit tests would fail depending on what timezone you were running them in 😛
stavros-k
stavros-kOP•2y ago
FAQ | Immich
What is the difference between the cloud icon on the mobile app?
jrasm91
jrasm91•2y ago
REVERSE_GEOCODING* is only used in microservices I believe TZ is not specific to immich
stavros-k
stavros-kOP•2y ago
Yea it's system specific, but for example microsservices use it, if I'm understanding correctly
jrasm91
jrasm91•2y ago
No we don't. We use exiftool to extract metadata and it uses the time zone of the container as a fallback in some situations. Microservices uses exif tool and exif tool uses TZ in some situations. If you want to document that, that's fine with me. It's not an "immich" envirionment variable in my opinion if we don't ever read it and do something based it being set to something. But it's worth noting we use certain tools which can be configured with their own environment variables, which should have their own documentation somewhere.
stavros-k
stavros-kOP•2y ago
This an initial draft so far. Categories can be added for those tools (Description could be expanded later)
# Environment Variables

| Variable | Description | Default | Services |
| :------------: | :------------: | :----------------: | :------- |
| `TZ` | Timezone | `UTC` | microservices |
| `NODE_ENV` | Node Environment | `production` | server, microservices |

> `TZ` is only used by the `exiftool` in the microservices container.
> It is considered as a fallback timezone if the timezone cannot be determined from the image metadata.

## Redis

| Variable | Description | Default | Services |
| :------------: | :------------: | :----------------: | :------- |
| `REDIS_URL` | Redis URL | `` | server, microservices |
| `REDIS_HOST` | Redis Host | `immich_redis` | server, microservices |
| `REDIS_PORT` | Redis Port | `6379` | server, microservices |
| `REDIS_INDEX` | Redis Index | `0` | server, microservices |
| `REDIS_USERNAME` | Redis Username | `` | server, microservices |
| `REDIS_PASSWORD` | Redis Password | `` | server, microservices |
| `REDIS_SOCKET` | Redis Socket | `` | server, microservices |

`REDIS_SOCKET`

## Typesense

| Variable | Description | Default | Services |
| :------------: | :------------: | :----------------: | :------- |
| `TYPESENSE_URL` | Typesense URL | `` | server, microservices |
| `TYPESENSE_API_KEY` | Typesense API Key | `` | server, microservices |
| `TYPESENSE_HOST` | Typesense Host | `typesense` | server, microservices |
| `TYPESENSE_PORT` | Typesense Port | `8108` | server, microservices |
| `TYPESENSE_PROTOCOL` | Typesense Protocol | `http` | server, microservices |
# Environment Variables

| Variable | Description | Default | Services |
| :------------: | :------------: | :----------------: | :------- |
| `TZ` | Timezone | `UTC` | microservices |
| `NODE_ENV` | Node Environment | `production` | server, microservices |

> `TZ` is only used by the `exiftool` in the microservices container.
> It is considered as a fallback timezone if the timezone cannot be determined from the image metadata.

## Redis

| Variable | Description | Default | Services |
| :------------: | :------------: | :----------------: | :------- |
| `REDIS_URL` | Redis URL | `` | server, microservices |
| `REDIS_HOST` | Redis Host | `immich_redis` | server, microservices |
| `REDIS_PORT` | Redis Port | `6379` | server, microservices |
| `REDIS_INDEX` | Redis Index | `0` | server, microservices |
| `REDIS_USERNAME` | Redis Username | `` | server, microservices |
| `REDIS_PASSWORD` | Redis Password | `` | server, microservices |
| `REDIS_SOCKET` | Redis Socket | `` | server, microservices |

`REDIS_SOCKET`

## Typesense

| Variable | Description | Default | Services |
| :------------: | :------------: | :----------------: | :------- |
| `TYPESENSE_URL` | Typesense URL | `` | server, microservices |
| `TYPESENSE_API_KEY` | Typesense API Key | `` | server, microservices |
| `TYPESENSE_HOST` | Typesense Host | `typesense` | server, microservices |
| `TYPESENSE_PORT` | Typesense Port | `8108` | server, microservices |
| `TYPESENSE_PROTOCOL` | Typesense Protocol | `http` | server, microservices |
jrasm91
jrasm91•2y ago
TZ does not default to UTC by default
stavros-k
stavros-kOP•2y ago
Or we can remove the description from the table And have after each section (##), subsections (###) for each env with a longer description And instaeld of description on the table we have a Required column with yes/no value
jrasm91
jrasm91•2y ago
I think different sections is good for groups of stuff, but tables for the actual envs like you have them for redis, typesense, etc. is good.
stavros-k
stavros-kOP•2y ago
Is mapbox removed? I can only find refs in a .env.test file
bo0tzz
bo0tzz•2y ago
Indeed
stavros-k
stavros-kOP•2y ago
Cool, I'll clean it up too
bo0tzz
bo0tzz•2y ago
Awesome stuff!
stavros-k
stavros-kOP•2y ago
Is the JWT_SECRET removed?
bo0tzz
bo0tzz•2y ago
A few notes from my first look through: REVERSE_GEOCODING_DUMP_DIRECTORY can be moved to Paths, and that section might want a general note that these are all paths internal to the container? If DB_URL is set, none of the other DB_* vars are used. I'm not sure whether this also applies to the redis or typesense settings (can't check rn).
jrasm91
jrasm91•2y ago
JWT secret is not used anymore. Yes - if redis url is provided the rest of them are ignore. If typesense url is provided the rest of the are ignored.
stavros-k
stavros-kOP•2y ago
Yep pushed some updates regarding those! Do you know what happens with redis_socket?
jrasm91
jrasm91•2y ago
It can be used to specify a socket? We can link to redis io documentation for details on each one
stavros-k
stavros-kOP•2y ago
I mean, does it prefer socket if both hostname and socket is defined?
jrasm91
jrasm91•2y ago
https://ioredis.readthedocs.io/en/latest/API/
Local domain socket path. If set the port, host and family will be ignored.
stavros-k
stavros-kOP•2y ago
awesome
jrasm91
jrasm91•2y ago
I think all the reverse geocoding stuff should be in one section If you look at the deployment you have some misc ` symbols https://immich-136b3d57o-immich.vercel.app/docs/install/environment-variables
stavros-k
stavros-kOP•2y ago
Hmm looks like double ` is not intepreted as empty. For empty defautls should we keep the field empty or for example -
jrasm91
jrasm91•2y ago
Just don't put a value in it Are you running the docs locally?
stavros-k
stavros-kOP•2y ago
Not yet, just trying to get the info there and then work on formatting
jrasm91
jrasm91•2y ago
It auto-refreshes on save You can use :::info and :::tip
:::info
This is an info box
:::
:::info
This is an info box
:::
stavros-k
stavros-kOP•2y ago
I'm off for today! Will do some more tomorrow! Cya
thomas
thomas•2y ago
fwiw I had to go through this process manually as I write all my own Kubernetes manifests https://github.com/uhthomas/automata/tree/6aebeea4d3bd66c47aa0eb2d8a1dbacdc23a9b71/k8s/unwind/immich Would be good to compare
stavros-k
stavros-kOP•2y ago
Thanks! From a quick look seems that everything looks ok!
thomas
thomas•2y ago
Cool! Thanks for checking

Did you find this page helpful?