diff --git a/defaults/main.yml b/defaults/main.yml index 637331e..1cdedd7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -53,6 +53,8 @@ photoprism: disable_webdav: "false" # disables built-in WebDAV server disable_settings: "false" # disables settings UI and API + autoupdate: "false" # Update photoprism automatically (true/false) + ## Run as a non-root user after initialization (supported: 0, 33, 50-99, 500-600, and 900-1200): uid: "" # PHOTOPRISM_UID: 1000 gid: "" # PHOTOPRISM_GID: 1000 @@ -79,6 +81,8 @@ photoprism: upload: "true" # allows uploads that MAY be offensive (no effect without TensorFlow) db: + image: "mariadb" # Database image + version: "10.10" # Database image version driver: "mysql" # or "sqlite". Use MariaDB 10.5+ or MySQL 8+ instead of SQLite for improved host: "mariadb" # MariaDB or MySQL database server (hostname:port) port: 3306 diff --git a/tasks/config.yml b/tasks/config.yml index 7a7ebf8..1697503 100644 --- a/tasks/config.yml +++ b/tasks/config.yml @@ -14,8 +14,8 @@ - name: "PHOTOPRISM | Write configuration files" ansible.builtin.template: - src: "{{ item }}.j2" - dest: "{{ photoprism_config_path | expanduser | realpath }}/{{ item {{" + src: "photoprism/{{ item }}.j2" + dest: "{{ photoprism_config_path | expanduser | realpath }}/{{ item }}" mode: '0640' loop: - "docker-compose.yml" diff --git a/templates/photoprism/docker-compose.yml.j2 b/templates/photoprism/docker-compose.yml.j2 index c327445..a38ef58 100644 --- a/templates/photoprism/docker-compose.yml.j2 +++ b/templates/photoprism/docker-compose.yml.j2 @@ -56,7 +56,7 @@ services: ports: - "{{ photoprism.site.port }}:2342" # HTTP port (host:container) env_file: - - "{{ grafana_setup_path | expanduser | realpath }}/photoprism.yml" + - "{{ photoprism_config_path | expanduser | realpath }}/photoprism.yml" working_dir: "/photoprism" # do not change or remove ## Storage Folders: "~" is a shortcut for your home directory, "." for the current directory @@ -65,14 +65,16 @@ services: - "~/Pictures:/photoprism/originals" # Original media files (DO NOT REMOVE) # - "/example/family:/photoprism/originals/family" # *Additional* media folders can be mounted like this # - "~/Import:/photoprism/import" # *Optional* base folder from which files can be imported to originals - - "./storage:/photoprism/storage" # *Writable* storage folder for cache, database, and sidecar files (DO NOT REMOVE) + - "{{ photoprism_cache_path }}:/photoprism/storage" # *Writable* storage folder for cache, database, and sidecar files (DO NOT REMOVE) {% if photoprism.devices is defined and photoprism.devices|length >= 1 %} devices: {% for device in photoprism.devices %} - - "{{ device }} + - "{{ device }}" {% endfor %} {% endif %} + networks: + - photoprism ## Database Server (recommended) ## see https://docs.photoprism.app/getting-started/faq/#should-i-use-sqlite-mariadb-or-mysql @@ -80,19 +82,21 @@ services: ## If MariaDB gets stuck in a restart loop, this points to a memory or filesystem issue: ## https://docs.photoprism.app/getting-started/troubleshooting/#fatal-server-errors restart: unless-stopped - image: mariadb:10.10 + image: "{{ photoprism.db.image }}:{{ photoprism.db.version }} env_file: - "{{ grafana_setup_path | expanduser | realpath }}/db.yml" security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239 - seccomp:unconfined - apparmor:unconfined command: mysqld --innodb-buffer-pool-size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120 - ## Never store database files on an unreliable device such as a USB flash drive, an SD card, or a shared network folder: + ## Never store database files on an unreliable device such as a USB flash drive, + ## an SD card, or a shared network folder: volumes: - - "./database:/var/lib/mysql" # DO NOT REMOVE - environment: - + - "{{ photoprism_db_path }}:/var/lib/mysql" + networks: + - photoprism +{% if photoprism.system.autoupdate == "true" %} ## Watchtower upgrades services automatically (optional) ## see https://docs.photoprism.app/getting-started/updates/#watchtower ## activate via "COMPOSE_PROFILES=update docker compose up -d" @@ -106,4 +110,7 @@ services: volumes: - "/var/run/docker.sock:/var/run/docker.sock" - "~/.docker/config.json:/config.json" # optional, for authentication if you have a Docker Hub account +{% endif %} +networks: + photoprism: {}