first version

This commit is contained in:
cpu
2024-01-31 14:28:36 +01:00
parent ffa90bce8b
commit 3f15c9e579
11 changed files with 358 additions and 1 deletions

19
templates/env.j2 Normal file
View File

@@ -0,0 +1,19 @@
DB_USERNAME={{ immich_config_database_username }}
DB_PASSWORD={{ immich_config_database_password }}
DB_DATABASE_NAME={{ immich_config_database_name }}
IMMICH_DB_SSL=false
DB_HOSTNAME={{ immich_config_database_hostname }}
DB_PORT={{ immich_config_database_port }}
REDIS_HOSTNAME={{ immich_config_redis_hostname }}
PUID={{ immich_uid }}
PGID={{ immich_gid }}
TZ=Europe/Bratislava
MACHINE_LEARNING_WORKERS={{ immich_config_machine_learning_workers }}
MACHINE_LEARNING_WORKER_TIMEOUT={{ immich_config_machine_learning_workers_timeout }}
IMMICH_LOG_LEVEL={{ immich_config_log_level }}
{{ immich_container_additional_environment_variables }}

View File

@@ -0,0 +1,47 @@
[Unit]
Description=Immich ({{ immich_identifier }})
{% for service in immich_systemd_required_services_list %}
Requires={{ service }}
After={{ service }}
{% endfor %}
DefaultDependencies=no
[Service]
Type=simple
Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}"
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} {{ immich_identifier }} 2>/dev/null'
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm {{ immich_identifier }} 2>/dev/null'
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
--rm \
--name={{ immich_identifier }} \
--log-driver=none \
--network={{ immich_container_network }} \
--user={{ immich_uid }}:{{ immich_gid }} \
--cap-drop=ALL \
--read-only \
--env-file={{ immich_base_path }}/env \
--label-file={{ immich_base_path }}/labels \
--mount type=bind,src={{ immich_config_dir_path }},dst=/config \
--mount type=bind,src={{ immich_photos_dir_path }},dst=/photos \
--mount type=bind,src={{ immich_import_dir_path }},dst=/import,ro \
--tmpfs=/tmp:rw,noexec,nosuid,size=512m \
{% for arg in immich_container_extra_arguments %}
{{ arg }} \
{% endfor %}
{{ immich_container_image }}
{% for network in immich_container_additional_networks %}
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} {{ immich_identifier }}
{% endfor %}
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach {{ immich_identifier }}
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} {{ immich_identifier }} 2>/dev/null'
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm {{ immich_identifier }} 2>/dev/null'
Restart=always
RestartSec=30
SyslogIdentifier={{ immich_identifier }}
[Install]
WantedBy=multi-user.target

38
templates/labels.j2 Normal file
View File

@@ -0,0 +1,38 @@
{% if immich_container_labels_traefik_enabled %}
traefik.enable=true
{% if immich_container_labels_traefik_docker_network %}
traefik.docker.network={{ immich_container_labels_traefik_docker_network }}
{% endif %}
{% set middlewares = [] %}
{% if immich_container_labels_traefik_path_prefix != '/' %}
traefik.http.middlewares.{{ immich_identifier }}-slashless-redirect.redirectregex.regex=^({{ immich_container_labels_traefik_path_prefix | quote }})$
traefik.http.middlewares.{{ immich_identifier }}-slashless-redirect.redirectregex.replacement=${1}/
{% set middlewares = middlewares + [immich_identifier + '-slashless-redirect'] %}
{% endif %}
{% if immich_container_labels_traefik_path_prefix != '/' %}
traefik.http.middlewares.{{ immich_identifier }}-strip-prefix.stripprefix.prefixes={{ immich_container_labels_traefik_path_prefix }}
{% set middlewares = middlewares + [immich_identifier + '-strip-prefix'] %}
{% endif %}
traefik.http.routers.{{ immich_identifier }}.rule={{ immich_container_labels_traefik_rule }}
{% if immich_container_labels_traefik_priority | int > 0 %}
traefik.http.routers.{{ immich_identifier }}.priority={{ immich_container_labels_traefik_priority }}
{% endif %}
traefik.http.routers.{{ immich_identifier }}.service={{ immich_identifier }}
{% if middlewares | length > 0 %}
traefik.http.routers.{{ immich_identifier }}.middlewares={{ middlewares | join(',') }}
{% endif %}
traefik.http.routers.{{ immich_identifier }}.entrypoints={{ immich_container_labels_traefik_entrypoints }}
traefik.http.routers.{{ immich_identifier }}.tls={{ immich_container_labels_traefik_tls | to_json }}
{% if immich_container_labels_traefik_tls %}
traefik.http.routers.{{ immich_identifier }}.tls.certResolver={{ immich_container_labels_traefik_tls_certResolver }}
{% endif %}
traefik.http.services.{{ immich_identifier }}.loadbalancer.server.port=8080
{% endif %}
{{ immich_container_labels_additional_labels }}