jails immich appjail

I am following:

I had immich running on podman and want to migrate it to a native appjail for perhaps marginally better performance and integration with FreeBSD.

That said, I had to deviate from the configuration because it for whatever reason isn't working and still isn't working for me:

.env:
Code:
UPLOAD_LOCATION=/media/immich/app-jail/app_data
DB_DATA_LOCATION=/media/immich/app-jail/postgres
CACHE_LOCATION=/media/immich/app-jail/cache
REDIS_DATA_LOCATION=/media/immich/app-jail/redis
TZ=Etc/UTC
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE_NAME=immich
DIRECTOR_PROJECT=immich

Makejail:
Code:
OPTION container=boot args:--pull
OPTION overwrite=force

appjail-director.yml:
Code:
options:
  - alias:
  - ip4_inherit:

services:
  immich-server:
    name: immich_server
    priority: 100
    options:
      - from: ghcr.io/daemonless/immich-server:latest
    volumes:
      - immich-data: /data

    oci:
      environment:
        - DB_HOSTNAME: 127.0.0.1
        - DB_USERNAME: ${DB_USERNAME}
        - DB_PASSWORD: ${DB_PASSWORD}
        - REDIS_HOSTNAME: 127.0.0.1
        - IMMICH_MACHINE_LEARNING_URL: [URL]http://127.0.0.1:3003[/URL]
        - TZ: ${TZ}

  immich-machine-learning:
    name: immich_machine_learning
    options:
      - from: ghcr.io/daemonless/immich-ml:latest
    oci:
      environment:
        - HF_HOME: /cache/huggingface
        - MPLCONFIGDIR: /tmp
        - TZ: ${TZ}
    volumes:
      - model-cache: /cache

  redis:
    name: immich_redis
    options:
      - from: ghcr.io/daemonless/redis:latest
    oci:
      environment:
        - LANG: C.UTF-8
        - TZ: ${TZ}
    volumes:
      - redis-data: /config

  database:
    name: immich_postgres
    options:
      - from: ghcr.io/daemonless/immich-postgres:latest
      - template: immich-postgres-template.conf
    oci:
      environment:
        - POSTGRES_PASSWORD: ${DB_PASSWORD}
        - POSTGRES_USER: ${DB_USERNAME}
        - POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - db-data: /var/lib/postgresql/data

volumes:
  immich-data:
    device: ${UPLOAD_LOCATION}

  model-cache:
    device: /media/immich/app-jail/cache
  redis-data:
    device: /media/immich/app-jail/redis
  db-data:
    device: /media/immich/app-jail/postgres

run.sh:
Code:
#!/bin/sh
. .env
# Set required environment variables for AppJail
export DB_USERNAME DB_PASSWORD DB_DATABASE_NAME TZ \
  UPLOAD_LOCATION CACHE_LOCATION REDIS_DATA_LOCATION DB_DATA_LOCATION
# Create directories and assign ownership to UID 1000 (standard OCI non-root user)
mkdir -p "$UPLOAD_LOCATION" "$CACHE_LOCATION" "$REDIS_DATA_LOCATION" "$DB_DATA_LOCATION"
chown -R 1000:1000 /media/immich/app-jail
# Bring up the environment
appjail-director up

I am removing any env variables from appjail-directory.yml because it seems like for whatever reason, they're not being picked up. I suspect that is why provisioning is failing.
 
I removed all the vars from appjail-director.yml, but am still ending up with

Code:
./run.sh
Starting Director (project:immich) ...
Destroying database (immich_postgres) ... Done.
Creating immich-machine-learning (immich_machine_learning) ... FAIL!

I think the next steps are to add debug logging to the python scripts. There isn't much for me to see and debug.
 
add debug logging to the python scripts
Learn to use pdb. Don't have to add anything to the code itself, just python3 -m pdb mypython.py will invoke it. Set breakpoints at interesting spots, have it break, then check the contents of various variables and structures to see if it all matches up. Single step through interesting code to see if it does what it's supposed to do.
 
Back
Top