Skip to main content

Install with Docker

Run Lifer on a NAS or any always-on computer, and reach it from a browser or the desktop app on any device. You need Docker with Docker Compose. You don't need to download the source code.

The server runs as two containers: Lifer itself (image ghcr.io/sparklysparkspark/lifer-app, for 64-bit Intel/AMD and ARM) and a Postgres database. Check the requirements first.

Install​

  1. Pick the folder for your wildlife photos: make a new one, or use the one you already keep them in, for example /mnt/tank/photos. Lifer files new imports into it by species, and Import a library brings in what's already there.

  2. Save this as docker-compose.yml in a folder of its own, with <your-photos-folder> replaced by that folder's path, in both places:

    services:
    postgres:
    image: postgres:18-alpine
    restart: unless-stopped
    # Time to finish writing on shutdown, and enough shared memory for large queries.
    stop_grace_period: 1m
    shm_size: 256mb
    environment:
    POSTGRES_USER: lifer
    POSTGRES_DB: lifer
    # Only for the first start: Lifer then moves the database onto a generated password.
    POSTGRES_PASSWORD: lifer
    volumes:
    - lifer-db:/var/lib/postgresql
    healthcheck:
    test: ["CMD-SHELL", "pg_isready -h 127.0.0.1 -U lifer -d lifer"]
    interval: 2s
    timeout: 3s
    retries: 30

    # Runs for a moment at each start, so Lifer can write to your photos folder.
    permissions:
    image: ghcr.io/sparklysparkspark/lifer-app:release
    user: "0:0"
    network_mode: none
    restart: "no"
    entrypoint: ["/usr/local/bin/lifer-fix-permissions"]
    command: ["/data", "/app-data"]
    volumes:
    - <your-photos-folder>:/data
    - lifer-app-data:/app-data

    api:
    # "release" is the newest stable version. Use a version number, like 0.12.0, to update
    # only when you choose.
    image: ghcr.io/sparklysparkspark/lifer-app:release
    restart: unless-stopped
    init: true
    user: "568:568"
    depends_on:
    postgres:
    condition: service_healthy
    permissions:
    condition: service_completed_successfully
    environment:
    DATABASE_URL: postgres://lifer:lifer@postgres:5432/lifer
    NODE_ENV: production
    PORT: 4000
    DATA_DIR: /data
    APP_DATA_DIR: /app-data
    ports:
    - "4000:4000"
    volumes:
    # Your wildlife photos.
    - <your-photos-folder>:/data
    # Lifer's own files: previews, the offline map, models, downloads.
    - lifer-app-data:/app-data

    volumes:
    lifer-db:
    lifer-app-data:

    Lifer's own files and its database live in Docker volumes, so there's nothing else to make. The permissions step lets Lifer write to your photos folder; see File ownership.

  3. Start Lifer from that folder:

    docker compose up -d

    This downloads the ready-made image. Nothing is built on your server.

  4. Open http://<server-ip>:4000 in a browser, using your server's LAN IP address, and create your account.

Every other setting has a default. The ones you might want later are in Environment variables, and they go under environment: in the same file.

On a NAS with a Docker interface (a TrueNAS Custom App, Portainer Stacks, Synology Container Manager, or Unraid's Compose Manager plugin), paste the file from step 2 into it, with your photos folder filled in. You don't need a terminal.

Alternative: the repository's compose file with a .env file​

The repository has a fuller docker-compose.yml that reads its settings from a .env file (rename .env.example to .env). It's the same setup with every optional setting listed, so you can change one by editing .env, and PUID and PGID choosing the user Lifer runs as (see File ownership).

In .env, set LIFER_STORAGE_DIR to your photo library folder, then run docker compose up -d.

Lifer works out on its own whether each request came over plain http:// or HTTPS, so there's nothing to set for that.

Lifer serves the web app and its API on one port (PORT, 4000 by default). For HTTPS or a domain name, put a reverse proxy in front. See Reverse proxy and HTTPS.

Create the first account​

A Lifer server has exactly one account, and whoever opens Lifer first creates it. Do this right after you start the server, before you make it reachable from outside your home network.

  1. Open Lifer in a browser. It shows a setup form instead of a login.
  2. Enter your Email, a Password (at least 8 characters), and Confirm password.
  3. Click Make account.

There's no setup code or invite to enter: the first person to reach the form gets the account. After the account exists, the setup form is gone for good. If you ever forget the password, see Reset a forgotten password.

Lifer then walks you through a short first-run setup. See Getting started.

Volumes​

The compose file stores data in three places:

Inside the containerOn your serverWhat it holds
/dataYour photo library folder (LIFER_STORAGE_DIR with .env)Your photo library. Birds, Mammals and other folders go directly in here.
/app-dataDocker volume lifer-app-dataLifer's own files: thumbnails and preview images of your photos, the offline map, species recognition models, and catalog downloads. Lifer can download or rebuild all of it, but a lost volume means a slow rebuild.
/var/lib/postgresql (in the postgres container)Docker volume lifer-dbThe database: your species assignments, ratings, tags, albums, trips and settings.

Your photos and the database are what you must back up.

Postgres is only reachable by Lifer, inside Docker. It doesn't use your server's port 5432, so it won't clash with another database. To reach it yourself, go through Docker, for example docker compose exec postgres psql -U lifer lifer. Backups work the same way.

To move or rename the library folder, stop Lifer first (docker compose down), move the folder, update its path in docker-compose.yml (or LIFER_STORAGE_DIR in .env), then start Lifer again. Moving it while Lifer runs makes every upload fail until Lifer restarts.

The species catalog is built into the image, so a new server shows countries and checklists right away, even without internet access.

File ownership​

Lifer doesn't run as root. It runs as user and group 568 (the same apps user TrueNAS uses), and every file it creates in your library belongs to that user.

To run Lifer as your own account instead, use your own numbers (run id on the server to see them): in the single-file setup, change user: "568:568" under api: and add them as PUID and PGID under an environment: for permissions:; with the .env setup, set PUID and PGID in .env.

Each time you run docker compose up, a short-lived permissions container runs first, as root. It creates the library folder and the lifer-app-data volume if they're missing, then:

  • gives everything in the lifer-app-data volume to PUID:PGID, since those are Lifer's own files;
  • gives the top of your library folder to PUID:PGID, so Lifer can create folders in it;
  • gives PUID:PGID any files in the library that belong to root, once.

It never changes library files that belong to anyone else, such as files written by an SMB share, Syncthing or another app, or folders you add under Extra library folders. Make sure the PUID user can read those, and write to them if Lifer should rename, tag or save photos there. Lifer starts once the permissions container has finished. Its log shows what it did:

docker compose logs permissions

To have Lifer's files belong to your own account instead, set PUID and PGID to its numbers (run id on the server to see them), then run docker compose up -d again. Files Lifer already wrote keep their old owner, so change them yourself, for example with sudo chown -R 1000:1000 /mnt/photos/lifer.

Database password​

There's nothing to set. The database starts with the password lifer from the compose file, and on its first start Lifer replaces it with a long random one, saved as secrets/db-password in the app-data folder (/app-data). The database can't be reached from your network either way (see Volumes).

Lifer only does this while the compose file says lifer. To use a password of your own instead, change it inside Postgres first, then put it in POSTGRES_PASSWORD and DATABASE_URL (or DB_PASSWORD in .env), and run docker compose up -d:

docker compose exec postgres psql -U lifer -c "ALTER USER lifer PASSWORD 'new-password'"

If the app-data folder is lost but the database isn't, Lifer can't connect and its log says so. Set the database back to lifer with the same command, using lifer as the new password, then run docker compose up -d: Lifer generates a new password on start.

Extra library folders​

On a server, Lifer can only read and write folders you give it. Besides /data, you can add more, for example an existing photo archive on another disk. Lifer can then import from them, build trips from them, and save photos to them.

  1. Mount each folder into the api container. In docker-compose.yml, under api: > volumes:, add a line like:

    - /srv/nas/photos:/library/nas
  2. List it with a label, under api: > environment::

    LIFER_LIBRARY_ROOTS: NAS=/library/nas

    With the .env setup, put LIFER_LIBRARY_ROOTS=NAS=/library/nas in .env instead.

    Separate several with commas: NAS=/library/nas,Archive=/library/archive.

  3. Run docker compose up -d again.

The folders show up in Settings > Storage > Extra library folders. Anything outside /data and these folders is refused.

All the settings are listed in Environment variables.

GPU (optional)​

Lifer can use an NVIDIA, Intel or AMD graphics card to match species faster. It tests the GPU by itself and only uses it when it's faster, so all you do is pass it into the container. The compose file has the lines ready to uncomment. See GPU acceleration.

Updating​

Lifer doesn't update itself on a server. You choose when to update:

  1. Back up the database. Updates can change the database, and there's no way back to an older version afterwards.

  2. Read the release notes for anything you need to do.

  3. From the folder with docker-compose.yml, run:

    docker compose pull
    docker compose up -d

Lifer applies any database changes by itself when it starts. The web app shows a banner when a newer release exists.

See Upgrading for choosing a version, rolling back, and auto-updaters.

Admin commands​

The image includes lifer-admin for tasks you do from a shell inside the container:

docker compose exec api lifer-admin list-users
docker compose exec api lifer-admin reset-password

reset-password asks for the new password twice, without showing it. It also signs out every device that was logged in.

If you run Lifer as a Custom App on TrueNAS, you can also open the app's Shell in the TrueNAS web interface and type lifer-admin commands directly.

Server logs​

docker compose logs -f api

See Troubleshooting for log lines worth knowing.