[Feature] Documented instructions for podman #1912
Replies: 11 comments 22 replies
-
I believe podman-compose should be a drop-in replacement for docker-compose, right? |
Beta Was this translation helpful? Give feedback.
-
I run Immich with podman-compose:
Downside is that it doesn't start the infra container. And without the infra container, no systemd unit files can be created. So after running that command above, you have to $ podman ps -a
### search for id of "created but not started" infra container
$ podman start <ID_INFRA_CONT> Afterwards in podman generate systemd --new --name --files pod_immich
systemctl --user daemon-reload
systemctl --user enable pod-pod_immich .service
systemctl --user start pod-pod_immich .service Et voilà, you have your Immich stack up and running. Auto-start after reboot. |
Beta Was this translation helpful? Give feedback.
-
I got my instance up and running and didn't want to use compose, figured I'd share notes: Some meta notes:
Prepare:
Invoking podman as the memory user:
Then to daemonize:
|
Beta Was this translation helpful? Give feedback.
-
An updated version (there were some breaking changes), seems to work for now.
|
Beta Was this translation helpful? Give feedback.
-
Thanks to @Equidamoid's script, I generated a pod spec. It can be used to run it on your k8s cluster or use
|
Beta Was this translation helpful? Give feedback.
-
In my opinion, podman is a better technology than docker. I'm also using podman, so Immich works in user space and is managed by systemd.
For now, I'm using As of now, Quadlet only creates single containers, but starting from Podman 5.0, it will work with pods. I can share the script when it happens. |
Beta Was this translation helpful? Give feedback.
-
I got around to an upgrade today, it's been a while. In the past I did switch to quadlet, using a kube file. So what I've got now in # immich.kube
[Kube]
Yaml=immich.yml
[Install]
WantedBy=multi-user.target default.target and # immich.yml
# Save the output of this file and use kubectl create -f to import
# it into Kubernetes.
#
# Created with podman-4.7.2
apiVersion: v1
kind: Pod
metadata:
annotations:
bind-mount-options: /space8/immich/tsdata:Z
creationTimestamp: "2023-11-14T14:47:23Z"
labels:
app: immich
name: immich
spec:
containers:
- name: server
args:
- start.sh
- immich
env:
- name: DB_USERNAME
value: postgres
- name: DB_PASSWORD
value: postgres
- name: DB_DATABASE_NAME
value: immich
- name: REDIS_HOSTNAME
value: immich-redis
- name: DB_HOSTNAME
value: immich-postgres
image: ghcr.io/immich-app/immich-server:v1.94.1
ports:
- containerPort: 3001
hostPort: 2283
volumeMounts:
- mountPath: /usr/src/app/upload
name: space8-immich-upload-host-0
- mountPath: /mnt/Photos
name: space8-Photos-host-1
- name: microservices
args:
- start.sh
- microservices
command:
- /bin/sh
env:
- name: DB_DATABASE_NAME
value: immich
- name: REDIS_HOSTNAME
value: immich-redis
- name: DB_PASSWORD
value: postgres
- name: DB_USERNAME
value: postgres
image: ghcr.io/immich-app/immich-server:v1.94.1
volumeMounts:
- mountPath: /usr/src/app/upload
name: space8-immich-upload-host-0
- mountPath: /mnt/Photos
name: space8-Photos-host-1
- name: machine-learning
args:
- ./start.sh
image: ghcr.io/immich-app/immich-machine-learning:v1.94.1
volumeMounts:
- mountPath: /cache
name: space8-immich-model-cache-host-0
- name: redis
args:
- redis-server
- --save
- "60"
- "1"
- --loglevel
- warning
image: docker.io/library/redis:latest
volumeMounts:
- mountPath: /data
name: space8-immich-redis-data-host-0
- name: postgres
args:
- postgres
env:
- name: POSTGRES_PASSWORD
value: postgres
- name: POSTGRES_USER
value: postgres
- name: POSTGRES_DB
value: immich
image: docker.io/tensorchord/pgvecto-rs:pg14-v0.1.11
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: space8-immich-postgres-pgdata-host-0
volumes:
- hostPath:
path: /space8/immich/upload
type: Directory
name: space8-immich-upload-host-0
- hostPath:
path: /space8/Photos
type: Directory
name: space8-Photos-host-1
- hostPath:
path: /space8/immich/redis/data
type: Directory
name: space8-immich-redis-data-host-0
- hostPath:
path: /space8/immich/model-cache
type: Directory
name: space8-immich-model-cache-host-0
- hostPath:
path: /space8/immich/postgres/pgdata
type: Directory
name: space8-immich-postgres-pgdata-host-0 Everything seems to be working this way. I did have one issue related to the postgres image change and needed to issue a psql command in the postgres container but that was only because I was so far behind and didn't read all the release notes :) |
Beta Was this translation helpful? Give feedback.
-
Thanks to @cidrblock for the kube YAML! For me the microservices container wasn't starting with I tweaked the YAML a bit, mainly by separating the config env variables to a Change the env vars in the beginning (at least TZ and DB_PASSWORD), paths in the apiVersion: v1
kind: ConfigMap
metadata:
name: immich-config
data:
TZ: Europe/Helsinki
NODE_ENV: production
# LOG_LEVEL: verbose, debug, warn, error
LOG_LEVEL: debug
#IMMICH_MEDIA_LOCATION: "./upload"
#IMMICH_CONFIG_FILE:
#IMMICH_WEB_ROOT:
#IMMICH_REVERSE_GEOCODING_ROOT:
#HOST: 0.0.0.0
#SERVER_PORT: 3001
#MICROSERVICES_PORT: 3002
#MACHINE_LEARNING_HOST: 0.0.0.0
#MACHINE_LEARNING_PORT: 3003
#DB_URL:
DB_HOSTNAME: localhost
DB_PORT: 5432
DB_USERNAME: immich
DB_PASSWORD: Your-Secret-Postgres-Password
DB_DATABASE_NAME: immich
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
#REDIS_URL:
#REDIS_USERNAME:
#REDIS_PASSWORD:
---
apiVersion: v1
kind: Pod
metadata:
name: immich
labels:
app: immich
annotations:
spec:
## Volume definitions, set paths to stored data here
volumes:
- hostPath:
## Equivalent of UPLOAD_LOCATION in docker-compose
path: /path/to/immich/data/
type: Directory
name: immich-data-host
- hostPath:
path: /path/to/immich/model-cache/
type: Directory
name: immich-model-cache-host
- name: immich-psql
persistentVolumeClaim:
claimName: immich-psql
- hostPath:
path: /path/to/immich/redis
type: Directory
name: immich-redis-host
## Container definitions
containers:
- name: server
image: ghcr.io/immich-app/immich-server:v1.105.1
resource: {}
securityContext:
capabilities:
drop:
- CAP_MKNOD
- CAP_NET_RAW
- CAP_AUDIT_WRITE
args:
- start.sh
- immich
volumeMounts:
- mountPath: /usr/src/app/upload
name: immich-data-host
ports:
## Change hostPort here
- containerPort: 3001
hostPort: 8086
envFrom:
- configMapRef:
name: immich-config
optional: false
- name: microservices
image: ghcr.io/immich-app/immich-server:v1.105.1
args:
- start.sh
- microservices
envFrom:
- configMapRef:
name: immich-config
optional: false
volumeMounts:
- mountPath: /usr/src/app/upload
name: immich-data-host
- name: machine-learning
args:
- ./start.sh
image: ghcr.io/immich-app/immich-machine-learning:v1.105.1
volumeMounts:
- mountPath: /cache
name: immich-model-cache-host
envFrom:
- configMapRef:
name: immich-config
optional: false
- name: psql
image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0
resource: {}
securityContext:
capabilities:
drop:
- CAP_MKNOD
- CAP_NET_RAW
- CAP_AUDIT_WRITE
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: immich-psql
env:
- name: POSTGRES_USER
valueFrom:
configMapKeyRef:
name: immich-config
key: DB_USERNAME
- name: POSTGRES_PASSWORD
valueFrom:
configMapKeyRef:
name: immich-config
key: DB_PASSWORD
- name: POSTGRES_DB
valueFrom:
configMapKeyRef:
name: immich-config
key: DB_DATABASE_NAME
- name: POSTGRES_INITDB_ARGS
value: "--data-checksums"
args: ["-c" ,"shared_preload_libraries=vectors.so", "-c", 'search_path="$$user", public, vectors', "-c", "logging_collector=on", "-c", "max_wal_size=2GB", "-c", "shared_buffers=512MB", "-c", "wal_compression=on"]
- name: redis
image: docker.io/library/redis:6.2-alpine
args:
- redis-server
- --save
- 60
- 1
- --loglevel
- warning
resources: {}
securityContext:
capabilities:
drop:
- CAP_MKNOD
- CAP_NET_RAW
- CAP_AUDIT_WRITE
volumeMounts:
- mountPath: /data
name: immich-redis-host
restartPolicy: Always
status: {} Edit: On SELinux systems the context of the host folders needs to be set manually with
|
Beta Was this translation helpful? Give feedback.
-
Another way of implementing Immich with Podman 5.0 and above is using Quadlets to create a pod. Notes:
/etc/containers/systemd/users/immich.pod
/etc/containers/systemd/users/immich-postgres.container
/etc/containers/systemd/users/immich-redis.container
/etc/containers/systemd/users/immich-machine_learning.container
/etc/containers/systemd/users/immich-microservices.container
/etc/containers/systemd/users/immich-server.container
|
Beta Was this translation helpful? Give feedback.
-
I'm re-writing the Quadlets based on latest Immich 106. Again all notes for convinience: Notes:
/etc/containers/systemd/users/immich.pod
/etc/containers/systemd/users/immich-postgres.container
/etc/containers/systemd/users/immich-redis.container
/etc/containers/systemd/users/immich-machine_learning.container
/etc/containers/systemd/users/immich-server.container
|
Beta Was this translation helpful? Give feedback.
-
TCP binding port has changed to 2283 in v118. Change Also in my install auto-update fails at the restart step with |
Beta Was this translation helpful? Give feedback.
-
The feature
Hey there-
Thanks for immich btw, it is wonderful.
I was curious if instructions could be documented for setting up immich with podman in a pod.
I was able to figure it out by reading the dockerfile and documented it here.
https://gist.github.com/cidrblock/b569205d6ab5f75a0ceac5af4730a67e
(I chose to use paths instead of named volumes for ease of backup, having everything related in a single directory)
Hopefully that might help,
-brad
Platform
Beta Was this translation helpful? Give feedback.
All reactions