Skip to main content

Environment variables

A Lifer server is configured with environment variables. Everything has a default: the single-file setup needs only the database address and your photos folder. With Docker, a variable goes under the api service's environment: in docker-compose.yml, or, with the .env setup, in .env. Lifer works out on its own whether it's reached over plain http:// or HTTPS, and it never sends email: a forgotten password is reset from the server's shell.

The desktop app sets all of these itself. You never need to touch them there.

Adding a variable with the .env setup​

Docker Compose only passes a variable into the container if it's listed under the api service's environment: section. The shipped docker-compose.yml lists the ones marked In compose file: Yes below. For those, set the value in .env and run docker compose up -d again.

For any other variable, add a line yourself, for example:

services:
api:
environment:
# ...the existing lines...
MAX_UPLOAD_BYTES: ${MAX_UPLOAD_BYTES:-}

Then set the value in .env and run docker compose up -d again.

A variable that's present but empty (like LIFER_LIBRARY_ROOTS= in the shipped .env) counts as unset, so Lifer uses its default.

Docker Compose settings​

These are read by the repository's docker-compose.yml itself, not by Lifer, so they only apply to the .env setup. Set them in .env.

VariableDefaultWhat it does
LIFER_VERSIONreleaseWhich Lifer image to run. release is the newest stable version. Set a version like 0.9.1 to stay on it, or a minor line like 0.9 to get only that line's fixes. See Upgrading.
DB_PASSWORDliferThe database's first password. The compose file gives it to the postgres container and puts it in DATABASE_URL. Leave it unset: on its first start Lifer replaces lifer with a generated password. See Database password to use your own.
RENDER_GROUP_ID107Intel or AMD GPUs only, with hwaccel.yml: the server's render group number, so Lifer can open the GPU. See GPU acceleration.

The common ones​

VariableDefaultIn compose fileWhat it does
PORT4000YesThe port Lifer listens on. The compose file publishes the same port on the host.
LIFER_STORAGE_DIR./data/liferYes (as the /data volume)The folder on the host that holds your photo library. It can be an external drive or a NAS share. Docker mounts it at /data inside the container. Lifer creates it if it's missing.
PUID568Yes (as the api user)The user ID Lifer runs as. Lifer never runs as root. On each start the permissions step gives the library and app data to this user. See File ownership.
PGID568Yes (as the api group)The group ID Lifer runs as, paired with PUID.
LIFER_LIBRARY_ROOTSemptyYesExtra folders Lifer may import from, build trips from, and save photos to, besides the library. A comma-separated list of Label=/container/path entries (or just /container/path, which uses the folder name as the label). Each one must also be mounted as a volume. See Extra library folders.
LIFER_FREEZE_RESTART_SECONDS120YesIf the server stops responding for this many seconds, it writes what it was doing to the log and restarts itself. Needs restart: unless-stopped, which the compose file has. 0 keeps only the log warning and never restarts.

Security and reverse proxies​

Only needed behind a reverse proxy. See Reverse proxy and HTTPS. The login cookie is HTTPS only exactly when you reach Lifer over HTTPS, directly or through a proxy that sends X-Forwarded-Proto, so there's nothing to set for it.

VariableDefaultIn compose fileWhat it does
TRUST_PROXYunset (no proxy trusted)YesWhich reverse proxy Lifer believes about each visitor's real IP address and whether they used HTTPS. Set it if Lifer is behind a reverse proxy: otherwise every visitor looks like the proxy, and the login limit is shared by all of them. Give the proxy's address as Lifer sees it, like 192.168.1.5, or a range like 172.16.0.0/12; loopback for a proxy on the same machine outside Docker; or a number of hops, like 2, for a public proxy such as Cloudflare in front of your own. Also accepts true, false, or a comma-separated list. See Reverse proxy and HTTPS.

Uploads​

VariableDefaultIn compose fileWhat it does
MAX_UPLOAD_BYTES0 (no limit)YesThe largest single file, in bytes, anyone can upload. 0 means no limit. Set it only as a safety net for a small disk, for example 53687091200 for 50 GB. An upload over the cap is refused before it starts.
LIFER_MAX_IMAGE_PIXELS2000000000 (2 gigapixels)YesThe largest photo, in pixels, Lifer will open. It guards against broken or malicious files; memory use depends on a photo's width more than its total pixels, so even very large panoramas are fine. 0 means no limit.
LIFER_UPLOAD_WORK_DIRnext to the libraryYesWhere uploads are received and kept until they're imported. By default Lifer uses the uploads folder in APP_DATA_DIR when that's on the same drive as the library, and otherwise a hidden .lifer-uploads folder inside the library, so filing a finished upload is a quick move rather than a second copy. Set it only if you want uploads received somewhere else, for example because that drive is short on space. Unfinished uploads are removed 2 hours after their last piece arrived.
LIFER_MAX_JSON_BODY_BYTES67108864 (64 MB)YesThe largest ordinary (non-upload) request. Uploads aren't affected by it. You shouldn't need to change it.
RATE_LIMIT_PER_MINUTE3000NoHow many requests one address can make per minute before Lifer answers "too many requests" for the rest of that minute. It's generous on purpose: scrolling a large gallery makes many requests, and everyone in a household usually shares one address. Photo images and imports each get their own, larger budget (20 and 10 times this), so a big import doesn't slow down the rest. 0 turns it off. Behind a reverse proxy, set TRUST_PROXY so each visitor is counted separately rather than all as the proxy. Sign-in has its own, much stricter limit. The desktop app doesn't use it.

Uploads are sent in resumable pieces, so there's no request-size setting to keep in step with your reverse proxy. See Reverse proxy.

Storage paths inside the container​

The compose file sets these for you. Change them only if you build your own setup.

VariableDefaultIn compose fileWhat it does
DATABASE_URLpostgres://lifer:lifer@localhost:5432/liferYesThe Postgres connection string. The compose file points it at the bundled postgres service, with the password from DB_PASSWORD. Lifer needs Postgres 16 or newer with the pgcrypto, pg_trgm and unaccent extensions, which come with standard Postgres. It doesn't need PostGIS.
DATA_DIR/data in DockerYesWhere the photo library is, inside the container.
APP_DATA_DIR/app-data in DockerYesWhere Lifer keeps its own files: thumbnails and preview images of your photos, the offline map, the species recognition models, and catalog downloads. None of it is original data: Lifer can download or rebuild it.
WEB_DIST_DIRthe built web app inside the imageNoWhere the web app's files are. Only for custom builds.
NODE_ENVproductionYesStandard Node.js setting. Leave it as is.
APP_VERSIONset when the image is builtNoThe version Lifer reports, used for the "newer release" banner. Leave it as is.

Download sources​

Lifer downloads regions, catalog updates and models from the project's GitHub releases and from Hugging Face. You'd only change these to use a mirror or for development.

VariableDefaultWhat it does
PACK_INDEX_URLthe packs-latest release on GitHubThe list of downloadable regions.
CATALOG_MANIFEST_URLthe catalog-latest release on GitHubA small file Lifer checks to see if a newer species catalog exists.
CATALOG_SEED_URLthe catalog-latest release on GitHubThe species catalog itself. Docker images already include a copy, so a new server works without internet on first start.
EMBEDDING_MODEL_URLthe models release on GitHubThe general image model (CLIP ViT-L/14, compressed to run well on a CPU) used for Gallery content search, duplicate detection, and suggestions until the identification model is installed.
EMBEDDING_MODEL_GPU_URLCLIP ViT-L/14 on Hugging FaceThe full-precision copy of the general image model, downloaded only when Lifer moves species recognition onto a GPU.
ID_MODEL_URLthe models release on GitHubThe species identification model (BioCLIP 2) used for species suggestions.
ID_MODEL_GPU_URLthe models release on GitHubThe full-precision copy of the identification model, downloaded only when Lifer moves species recognition onto a GPU. See One-time downloads for NVIDIA.
SCENE_MODEL_URLthe models release on GitHubThe scene model (UperNet ConvNeXt, ADE20K) that finds scenes and colors for Gallery search.
SCENE_MODEL_FP32_URLthe models release on GitHubThe full-precision copy of the scene model, which Intel Macs run instead.
MAP_DOWNLOAD_URLthe map-latest release on GitHubWhere to download the offline basemap from. Only needed to use a different map file.
MAP_DETAIL_INDEX_URLthe map-detail-latest release on GitHubThe list of per-country detailed maps. Only needed to use different files.
RELIEF_DOWNLOAD_URLthe map-latest release on GitHubWhere to download the map's shaded relief from (about 90 MB). Only needed to use a different file. The map draws without shading without it.

These are all unset in the shipped compose file, so add them under environment: if you use them.

Performance​

You rarely need these. The defaults suit a typical home server.

VariableDefaultWhat it does
PG_POOL_MAX20The most database connections Lifer opens at once. Lower it if your Postgres is shared and short on connections.
LIFER_VECTOR_CACHE_MB128How much memory, in MB, Lifer uses to keep your own photos' matching data in memory. It speeds up species suggestions, duplicate checks and Gallery content search. Raise it for a very large library on a server with memory to spare.
INAT_MIN_HOST_INTERVAL_MS1000The shortest gap, in milliseconds, between requests Lifer sends to iNaturalist, shared by every part of Lifer that calls it. Raise it (for example to 2500) if iNaturalist starts limiting your server.
LIFER_GPUunset (automatic)Set to off to keep species recognition on the CPU even when a GPU is available. Only for troubleshooting: by default Lifer uses a GPU only when it gives the same results and is faster. Already listed in the compose file. See GPU acceleration.
LIFER_CRASH_REPORTSunset (on)Set to off to never save or offer crash reports. For packagers who ship Lifer with no way to send one.
LOG_LEVELinfoHow much the server logs: error, warn, info, debug or trace. Use debug when troubleshooting, then set it back.
LIFER_INFERENCE_IN_PROCESSunsetSet to 1 to run the species recognition models on Lifer's main thread instead of a separate background worker. Only for debugging: the app can become unresponsive while photos are matched.

Rarely used​

VariableDefaultWhat it does
SINGLE_USER_MODEunsetUsed by the desktop app, which has no login: the app's own window is signed in with the per-launch secret LIFER_LAUNCH_TOKEN instead. Never set this on a server. Lifer refuses to start with SINGLE_USER_MODE=1 unless it also has LIFER_LAUNCH_TOKEN, and in this mode it only listens on 127.0.0.1 and refuses requests that came through a proxy.
INAT_CLIENT_IDLifer's own iNaturalist appOnly to link iNaturalist through an iNaturalist application you registered yourself at inaturalist.org/oauth/applications: its client ID.
INAT_REDIRECT_URILifer's sign-in page (with your own app: the address you opened Lifer at, plus /api/inaturalist/callback)Only with your own INAT_CLIENT_ID: the redirect URI you registered with that application, if it isn't the default.
LIFER_ALLOW_UNTOKENED_DESKTOPunsetFor development only. Set to 1 to let SINGLE_USER_MODE run without the desktop app's launch token; every request on 127.0.0.1 is then signed in as the local user, with no credential. Never set this on a server.

The desktop app also sets a few internal variables (LIFER_LAUNCH_TOKEN, LIFER_LAUNCH_ID, LIFER_PARENT_STDIN, LIFER_PG_CTL, LIFER_PG_DATA, LIFER_PG_DUMP, LIFER_DB_BACKUP_DIR, and for matching on this computer LIFER_INFERENCE_TOKEN and LIFER_MODEL_DIR) to manage its background processes. They aren't meant to be set by hand.