-
-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
167 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
# Basic options | ||
photoprism_enabled: false | ||
photoprism_site_caption: "AI-Powered Photos App" | ||
|
||
# Directories | ||
photoprism_data_directory: "{{ docker_home }}/photoprism" | ||
photoprism_photos_directory: "{{ photos_root }}" | ||
|
||
# External configuration | ||
photoprism_available_externally: false | ||
photoprism_hostname: photoprism | ||
photoprism_port: 2342 | ||
|
||
# Admin configs | ||
photoprism_admin_user: admin | ||
photoprism_admin_password: insecure | ||
|
||
# Database configs | ||
# You must have the database already running. | ||
# If you don't know how to do it, just leave as it is. | ||
photoprism_database_driver: sqlite | ||
photoprism_database_server: "" | ||
photoprism_database_name: "" | ||
photoprism_database_user: "" | ||
photoprism_database_password: "" | ||
|
||
# Specs | ||
photoprism_memory: 4g | ||
photoprism_container_name: photoprism |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Photoprism | ||
|
||
Homepage: <https://photoprism.app> | ||
|
||
PhotoPrism® is an AI-Powered Photos App for the Decentralized Web. | ||
|
||
It makes use of the latest technologies to tag and find pictures automatically without getting in your way. You can run it at home, on a private server, or in the cloud. | ||
|
||
## Usage | ||
|
||
Set `photoprism_enabled: true` in your `inventories/<your_inventory>/nas.yml` file. | ||
|
||
The Photoprism web interface can be found at <http://ansible_nas_host_or_ip:2342>. | ||
|
||
## Specific Configuration | ||
|
||
> Usually Photoprism has some spikes of memory when you are uploading a lot of pictures at the same time. Take that in consideration before deplying it. | ||
Make sure you change photoprism username and password in your nas.yml config file! | ||
|
||
* photoprism_admin_user: admin | ||
* photoprism_admin_password: insecure | ||
|
||
To run together with a database instead of SQLite, which is recommended by Photoprism, you can change this setup. To do it, you must already have a database running and also specify the following variables in your own nas.yml file: | ||
|
||
* photoprism_database_driver: mariadb/mysql | ||
* photoprism_database_server: "ip/sqlserver" | ||
* photoprism_database_name: "photoprism_db" | ||
* photoprism_database_user: "mydbuser" | ||
* photoprism_database_password: "insecure" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
provisioner: | ||
inventory: | ||
group_vars: | ||
all: | ||
photoprism_enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
- name: Stop | ||
hosts: all | ||
become: true | ||
tasks: | ||
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role" | ||
ansible.builtin.include_role: | ||
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" | ||
vars: | ||
photoprism_enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- ansible.builtin.include_vars: | ||
file: ../../defaults/main.yml | ||
|
||
- name: Get container state | ||
community.docker.docker_container_info: | ||
name: "{{ photoprism_container_name }}" | ||
register: result | ||
|
||
- name: Check photoprism is running | ||
ansible.builtin.assert: | ||
that: | ||
- result.container['State']['Status'] == "running" | ||
- result.container['State']['Restarting'] == false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- ansible.builtin.include_vars: | ||
file: ../../defaults/main.yml | ||
|
||
- name: Try and stop and remove photoprism | ||
community.docker.docker_container: | ||
name: "{{ photoprism_container_name }}" | ||
state: absent | ||
register: result | ||
|
||
- name: Check photoprism is stopped | ||
ansible.builtin.assert: | ||
that: | ||
- not result.changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
- name: Start Photoprism | ||
block: | ||
- name: Create Photoprism Directories | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: directory | ||
with_items: | ||
- "{{ photoprism_data_directory }}" | ||
|
||
- name: Photoprism Docker Container | ||
community.docker.docker_container: | ||
name: "{{ photoprism_container_name }}" | ||
image: photoprism/photoprism | ||
pull: true | ||
volumes: | ||
- "/etc/localtime:/etc/localtime:ro" | ||
- "{{ photoprism_data_directory }}/storage:/photoprism/storage:rw" | ||
- "{{ photoprism_photos_directory }}:/photoprism/originals:rw" | ||
env: | ||
PHOTOPRISM_SITE_CAPTION: "{{ photoprism_site_caption }}" | ||
PHOTOPRISM_ADMIN_USER: "{{ photoprism_admin_user }}" | ||
PHOTOPRISM_ADMIN_PASSWORD: "{{ photoprism_admin_password }}" | ||
PHOTOPRISM_SITE_URL: "https://{{ photoprism_hostname }}.{{ ansible_nas_domain }}" | ||
PHOTOPRISM_DATABASE_DRIVER: "{{ photoprism_database_driver }}" | ||
PHOTOPRISM_DATABASE_SERVER: "{{ photoprism_database_server }}" | ||
PHOTOPRISM_DATABASE_NAME: "{{ photoprism_database_name }}" | ||
PHOTOPRISM_DATABASE_USER: "{{ photoprism_database_user }}" | ||
PHOTOPRISM_DATABASE_PASSWORD: "{{ photoprism_database_password }}" | ||
ports: | ||
- "{{ photoprism_port }}:2342" | ||
restart_policy: unless-stopped | ||
memory: "{{ photoprism_memory }}" | ||
labels: | ||
traefik.enable: "{{ photoprism_available_externally | string }}" | ||
traefik.http.routers.photoprism.rule: "Host(`{{ photoprism_hostname }}.{{ ansible_nas_domain }}`)" | ||
traefik.http.routers.photoprism.tls.certresolver: "letsencrypt" | ||
traefik.http.routers.photoprism.tls.domains[0].main: "{{ ansible_nas_domain }}" | ||
traefik.http.routers.photoprism.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" | ||
traefik.http.routers.photoprism.service: "photoprism" | ||
traefik.http.services.photoprism.loadbalancer.server.port: "{{ photoprism_port | string }}" | ||
when: photoprism_enabled is true | ||
|
||
- name: Stop Photoprism | ||
block: | ||
- name: Stop Photoprism | ||
community.docker.docker_container: | ||
name: "{{ photoprism_container_name }}" | ||
state: absent | ||
when: photoprism_enabled is false |