Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Help about MediaWiki
FUTO
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Introduction to a Self Managed Life: a 13 hour & 28 minute presentation by FUTO software
(section)
Main Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== 5.2 Edit the <code>docker-compose.yml</code> file ==== Open the file for editing: <pre>nano -w docker-compose.yml</pre> This file in its entirety is fine as is. Nothing has to be changed. The two lines I add are to allow immich access to the <code>~/Pictures</code> directory where my ZFS pool’s files are located, and the <code>~/androidbackup/DCIM</code> directory where the photos & videos I took using the camera app on my android phone are stored. The two lines I added to the file below are: <pre> - /home/louis/androidbackup/DCIM:/files/phonepics:rw - /home/louis/Pictures:/files/zfspics:ro</pre> These lines do the following: * Makes <code>/home/louis/androidbackup/DCIM</code> on the host computer Immich is running on show up as <code>/files/phonepics</code> inside the docker container for Immich, with read write permissions. * Makes <code>/home/louis/Pictures</code> on the host computer Immich is running on show up as <code>/files/zfspics</code> inside the docker container for Immich, with read only permissions. To see where I put these in the context of the full file, look below: <pre># # WARNING: Make sure to use the docker-compose.yml of the current release: # # https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml # # The compose file on main may not be compatible with the latest release. # name: immich services: immich-server: container_name: immich_server image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release} # extends: # file: hwaccel.transcoding.yml # service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding volumes: # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file - ${UPLOAD_LOCATION}:/usr/src/app/upload - /etc/localtime:/etc/localtime:ro - /home/louis/androidbackup/DCIM:/files/phonepics:rw - /home/louis/Pictures:/files/zfspics:ro env_file: - .env ports: - '2283:2283' depends_on: - redis - database restart: always healthcheck: disable: false immich-machine-learning: container_name: immich_machine_learning # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag. # Example tag: ${IMMICH_VERSION:-release}-cuda image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release} # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration # file: hwaccel.ml.yml # service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable volumes: - model-cache:/cache env_file: - .env restart: always healthcheck: disable: false redis: container_name: immich_redis image: docker.io/redis:6.2-alpine@sha256:2ba50e1ac3a0ea17b736ce9db2b0a9f6f8b85d4c27d5f5accc6a416d8f42c6d5 healthcheck: test: redis-cli ping || exit 1 restart: always database: container_name: immich_postgres image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0 environment: POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_USER: ${DB_USERNAME} POSTGRES_DB: ${DB_DATABASE_NAME} POSTGRES_INITDB_ARGS: '--data-checksums' volumes: # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file - ${DB_DATA_LOCATION}:/var/lib/postgresql/data healthcheck: test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1 interval: 5m start_interval: 30s start_period: 5m command: [ 'postgres', '-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', ] restart: always volumes: model-cache:</pre> <blockquote>'''DOCKER CHEAT SHEET: going through <code>docker-compose.yml</code> file for Immich''' This file sets up a bunch of containers''(virtualized, minimalistic computers that run inside your computer)'' for the Immich photo gallery/library/machine learning & management system. '''1. <code>name: immich</code>''' This is the name of the overall Docker Compose project. '''2. <code>services:</code>''' This section lists all the containers (services) that make up the Immich application. Each service is a part of the overall program. '''immich-server''' '''3. <code>immich-server:</code>''' This is the primary backend service of Immich. It handles the main functions of the program like uploading, managing, & displaying photos. '''4. <code>container_name: immich_server</code>''' This is the name of the container so when you run <code>docker ps -a</code> to see what containers are running you can see this one and know what it is for immediately. Custom name for the main immich container so it is easy to find when you type <code>docker ps -a</code> . Sometimes while debugging things that are not working you may want to enter the environment of the virtual container''(this is like sshing into your server, but into the virtual server that runs immich)'', which you can do by typing <code>docker exec -it immich_server bash</code> - but to do that you need to know which container is which! This is where using sensible names comes into play. '''5. <code>image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}</code>''' This tells it what Docker image to use for the backend. It pulls the latest stable version unless you’ve overridden <code>IMMICH_VERSION</code> in your <code>.env</code> file. Since Immich does not destroy their software with new releases, I am setting it to grab the latest version. '''6. <code>volumes:</code>''' * <code>${UPLOAD_LOCATION}:/usr/src/app/upload</code>: Links the photo upload storage location from your system to the container. The path <code>${UPLOAD_LOCATION}</code> is defined in the <code>.env</code> file. Whatever this is will show up inside the container at <code>/usr/src/app/upload</code> * <code>/etc/localtime:/etc/localtime:ro</code>: This makes the container use the same time as your computer’s time. The <code>:ro</code> makes it read-only so your computer can’t do what the characters in predestination did. The only thing worse than using google photos is '''''SPOILER ALERT''''' having your machine send you back in time so you are an orphan who was its own mother like in '''Predestination'''. Still a decent time travel movie but it has nothing on '''Primer'''. * <code>/home/louis/androidbackup/DCIM:/files/phonepics:rw</code>: Maps a directory with phone pictures to <code>/files/phonepics</code> in the container. This is read-write (<code>rw</code>). SO whatever is inside my <code>/home/louis/androidbackup/DCIM</code> directory on the <code>androidstuff</code> virtual machine running at <code>192.168.5.5</code> that we set up will show up inside the <code>immich-server</code> docker container under the directory <code>/files/phonepics</code>. * <code>/home/louis/Pictures:/files/zfspics:ro</code>: Maps a directory with other pictures to <code>/files/zfspics</code> in the container. This one is read-only (<code>ro</code>). '''7. <code>env_file:</code>''' Loads environment variables from the <code>.env</code> file, which centralizes configuration settings. '''8. <code>ports:</code>''' * <code>'2283:2283'</code>: Maps port <code>2283</code> on your host system to port <code>2283</code> in the container. This allows you to access Immich’s server on your browser at <code>http://192.168.5.5:2283</code> since we are installing this dockerized deployment of Immich to the <code>androidstuff</code> virtual machine located at <code>192.168.5.5</code> '''9. <code>depends_on:</code>''' This lists the services this container depends on. <code>redis</code> and <code>database</code> must be running before the server starts. Don’t be scared by the word depends. It is included in ''“dependency”'', but you’re using a docker image deployed by good developers; dependencies are no longer something to be afraid of :) I promise :) '''10. <code>restart: always</code>''' Automatically restarts the container if it crashes or if the system reboots. When you turn the system on immich will be on without having to go to its directory & run <code>docker compose up -d</code> each time the computer starts. '''11. <code>healthcheck:</code>''' Monitors the container’s health. The <code>disable: false</code> line means health checks are enabled. '''immich-machine-learning''' '''12. <code>immich-machine-learning:</code>''' This container handles machine learning tasks, like face or object recognition''(searching for “cat on chair”)'' in your photos. '''13. <code>container_name: immich_machine_learning</code>''' Custom name for the machine learning container so it is easy to find when you type <code>docker ps -a</code> . Sometimes while debugging things that are not working you may want to enter the environment of the virtual container''(this is like sshing into your server, but into the virtual server that runs immich)'', which you can do by typing <code>docker exec -it immich_machine_learning bash</code> - but to do that you need to know which container is which! This is where using sensible names comes into play. '''14. <code>image:</code>''' Pulls the machine learning image from GitHub. You can enable hardware acceleration by adding a specific tag (e.g., <code>-cuda</code>) if supported by your system. '''15. <code>volumes:</code>''' * <code>model-cache:/cache</code>: Links a Docker-managed volume to the container’s <code>/cache</code> directory for storing machine learning model data. '''16. <code>env_file:</code>''' Loads environment variables from <code>.env</code> for consistent configuration. For instance, instead of editing certain configuration files after or while setting up/compiling the program, you put them in the environment file and when the docker container starts, it uses what is in the environment file. '''17. <code>restart: always</code>''' The container restarts if it crashes & will start up with the computer. '''18. <code>healthcheck:</code>''' Keeps the container healthy and ensures it’s running properly. '''redis''' '''19. <code>redis:</code>''' Redis is a high-speed database used for caching data and managing background tasks. '''20. <code>container_name: immich_redis</code>''' Custom name for the Redis container so it is easy to find when you type <code>docker ps -a</code> . Sometimes while debugging things that are not working you may want to enter the environment of the virtual container''(this is like sshing into your server, but into the virtual server that runs immich)'', which you can do by typing <code>docker exec -it immich_redis bash</code> - but to do that you need to know which container is which! This is where using sensible names comes into play. '''21. <code>image:</code>''' Specifies the exact Redis image to use, including a SHA256 checksum for security. '''22. <code>healthcheck:</code>''' Runs a simple test (<code>redis-cli ping</code>) to confirm the Redis service is working. '''23. <code>restart: always</code>''' Automatically restarts Redis if it fails/it starts with the computer. '''database''' '''24. <code>database:</code>''' This is the PostgreSQL database, which stores metadata and application data for Immich. '''25. <code>container_name: immich_postgres</code>''' Custom name for the database container so it is easy to find when you type <code>docker ps -a</code> . Sometimes while debugging things that are not working you may want to enter the environment of the virtual container''(this is like sshing into your server, but into the virtual server that runs immich)'', which you can do by typing <code>docker exec -it immich_postgres bash</code> - but to do that you need to know which container is which! This is where using sensible names comes into play. '''26. <code>image:</code>''' Specifies a custom PostgreSQL image with vector support, used by Immich for advanced search features. '''27. <code>environment:</code>''' - <code>POSTGRES_PASSWORD</code>: Password for the database. - <code>POSTGRES_USER</code>: Username for the database. - <code>POSTGRES_DB</code>: Name of the database. - <code>POSTGRES_INITDB_ARGS</code>: Additional arguments for database '''28. <code>volumes:</code>''' * <code>${DB_DATA_LOCATION}:/var/lib/postgresql/data</code>: Maps the database storage location from your system to the container. Edit <code>${DB_DATA_LOCATION}</code> in the <code>.env</code> file to change where your database files are stored. '''29. <code>healthcheck:</code>''' Runs periodic checks to ensure the database is healthy. It verifies that the database is running, accessible, and free of checksum errors. '''30. <code>command:</code>''' Customizes PostgreSQL’s behavior with specific options, like enabling vector indexing (<code>shared_preload_libraries=vectors.so</code>) & improving performance with optimized settings like <code>max_wal_size=2GB</code>. '''31. <code>restart: always</code>''' Makes database container restart if something goes wrong/it starts with the computer. '''volumes''' '''32. <code>volumes:</code>''' - <code>model-cache</code>: A named volume for storing machine learning models. This ensures that cached data persists across container restarts or recreations. </blockquote> <span id="step-5-start-the-system"></span>
Summary:
Please note that all contributions to FUTO may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
FUTO:Copyrights
for details).
Do not submit copyrighted work without permission!
To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:
Cancel
Editing help
(opens in new window)