From 699e1b15fddbc13ca32523083f6c03de1b7f1735 Mon Sep 17 00:00:00 2001 From: Toben Archer Date: Mon, 9 Aug 2021 10:36:42 -0500 Subject: [PATCH 1/7] Initial build out. I've created the Role but I do not yet know if it will work. --- roles/piwigo/defaults/main.yml | 17 +++++++++++++++++ roles/piwigo/tasks/main.yml | 27 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 roles/piwigo/defaults/main.yml create mode 100644 roles/piwigo/tasks/main.yml diff --git a/roles/piwigo/defaults/main.yml b/roles/piwigo/defaults/main.yml new file mode 100644 index 00000000..532d2ce9 --- /dev/null +++ b/roles/piwigo/defaults/main.yml @@ -0,0 +1,17 @@ +--- +piwigo_enabled: false +piwigo_available_externally: "false" + +# directories +piwigo_config_directory: "{{ docker_home }}/piwigo/config" +piwigo_photos: "{{ photos_root }}" + +piwigo_photos_permission: "rw" + +# network +piwigo_hostname: "piwigo" + +# specs +piwigo_memory: "1g" + +piwigo_version: "docker" diff --git a/roles/piwigo/tasks/main.yml b/roles/piwigo/tasks/main.yml new file mode 100644 index 00000000..0f7325e4 --- /dev/null +++ b/roles/piwigo/tasks/main.yml @@ -0,0 +1,27 @@ +--- +- name: Create Piwigo Directories + file: + path: "{{ item }}" + state: directory + with_items: + - "{{ piwigo_config_directory }}" + - "{{ piwigo_logs }}" + +- name: Piwigo Docker Container + docker_container: + name: piwigo + image: linuxserver/piwigo + pull: true + volumes: + - "{{ piwigo_config_directory }}:/config:rw" + - "{{ piwigo_photos }}:/gallery:rw" + network_mode: "host" + restart_policy: unless_stopped + memory: "{{ piwigo_memory }}" + lables: + traefik.enable: "{{ piwigo_available_externally }}" + traefik.http.routers.piwigo.rule: "Host(`{{ piwigo_hostname }}.{{ ansible_nas_domain }}`)" + traefik.http.routers.piwigo.tls.certresolver: "letsencrypt" + traefik.http.routers.piwigo.tls.domains[0].main: "{{ ansible_nas_domain }}" + traefik.http.routers.piwigo.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" + traefik.http.services.piwigo.loadbalancer.server.port: 80 From 902fd6f42c7a14edd5c8ad0bcd65df4ac76d9fdc Mon Sep 17 00:00:00 2001 From: Toben Archer Date: Mon, 9 Aug 2021 13:17:40 -0500 Subject: [PATCH 2/7] Container pulled and running But I still need to do some tweaks yet. --- nas.yml | 5 +++++ roles/piwigo/defaults/main.yml | 4 ++++ roles/piwigo/tasks/main.yml | 12 ++++++++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/nas.yml b/nas.yml index c3db9849..5e8c45fe 100644 --- a/nas.yml +++ b/nas.yml @@ -278,6 +278,11 @@ - dokuwiki when: (dokuwiki_enabled | default(False)) + - role: piwigo + tags: + - piwigo + when: (piwigo_enabled | default(False)) + tasks: - import_tasks: tasks/thelounge.yml when: (thelounge_enabled | default(False)) diff --git a/roles/piwigo/defaults/main.yml b/roles/piwigo/defaults/main.yml index 532d2ce9..182b1ed3 100644 --- a/roles/piwigo/defaults/main.yml +++ b/roles/piwigo/defaults/main.yml @@ -6,6 +6,10 @@ piwigo_available_externally: "false" piwigo_config_directory: "{{ docker_home }}/piwigo/config" piwigo_photos: "{{ photos_root }}" +# uid / gid +piwigo_user_id: "1000" +piwigo_group_id: "1000" + piwigo_photos_permission: "rw" # network diff --git a/roles/piwigo/tasks/main.yml b/roles/piwigo/tasks/main.yml index 0f7325e4..490e0e63 100644 --- a/roles/piwigo/tasks/main.yml +++ b/roles/piwigo/tasks/main.yml @@ -5,7 +5,6 @@ state: directory with_items: - "{{ piwigo_config_directory }}" - - "{{ piwigo_logs }}" - name: Piwigo Docker Container docker_container: @@ -16,12 +15,17 @@ - "{{ piwigo_config_directory }}:/config:rw" - "{{ piwigo_photos }}:/gallery:rw" network_mode: "host" - restart_policy: unless_stopped + env: + TZ: "{{ ansible_nas_timezone }}" + PUID: "{{ piwigo_user_id }}" + PGID: "{{ piwigo_group_id }}" + VERSION: "{{ piwigo_version }}" + restart_policy: unless-stopped memory: "{{ piwigo_memory }}" - lables: + labels: traefik.enable: "{{ piwigo_available_externally }}" traefik.http.routers.piwigo.rule: "Host(`{{ piwigo_hostname }}.{{ ansible_nas_domain }}`)" traefik.http.routers.piwigo.tls.certresolver: "letsencrypt" traefik.http.routers.piwigo.tls.domains[0].main: "{{ ansible_nas_domain }}" traefik.http.routers.piwigo.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" - traefik.http.services.piwigo.loadbalancer.server.port: 80 + traefik.http.services.piwigo.loadbalancer.server.port: "16923" From 91fc4301db0741405226fb90f58305421c66b8a0 Mon Sep 17 00:00:00 2001 From: Toben Archer Date: Tue, 17 Aug 2021 11:57:54 -0500 Subject: [PATCH 3/7] Fixed the networking. The container now shows up in traefik correctly. But now it looks like I may need to setup a database container. --- roles/piwigo/defaults/main.yml | 1 + roles/piwigo/tasks/main.yml | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/piwigo/defaults/main.yml b/roles/piwigo/defaults/main.yml index 182b1ed3..080151d7 100644 --- a/roles/piwigo/defaults/main.yml +++ b/roles/piwigo/defaults/main.yml @@ -14,6 +14,7 @@ piwigo_photos_permission: "rw" # network piwigo_hostname: "piwigo" +piwigo_port: "16923" # specs piwigo_memory: "1g" diff --git a/roles/piwigo/tasks/main.yml b/roles/piwigo/tasks/main.yml index 490e0e63..c57b81be 100644 --- a/roles/piwigo/tasks/main.yml +++ b/roles/piwigo/tasks/main.yml @@ -14,7 +14,8 @@ volumes: - "{{ piwigo_config_directory }}:/config:rw" - "{{ piwigo_photos }}:/gallery:rw" - network_mode: "host" + ports: + - "{{ piwigo_port }}:80" env: TZ: "{{ ansible_nas_timezone }}" PUID: "{{ piwigo_user_id }}" @@ -28,4 +29,4 @@ traefik.http.routers.piwigo.tls.certresolver: "letsencrypt" traefik.http.routers.piwigo.tls.domains[0].main: "{{ ansible_nas_domain }}" traefik.http.routers.piwigo.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" - traefik.http.services.piwigo.loadbalancer.server.port: "16923" + traefik.http.services.piwigo.loadbalancer.server.port: "80" From 7002b4378a42b9d50d1c199474dfe43e47f0e0fe Mon Sep 17 00:00:00 2001 From: Toben Archer Date: Tue, 17 Aug 2021 13:49:47 -0500 Subject: [PATCH 4/7] Everything built. Now I need to add all the administrative bits for ansible-nas. I would also like to set it up to pre-populate the configuration information for the database like gitea does. I'll have to read a few more docs for that. But the important part is this is up now. --- roles/piwigo/defaults/main.yml | 2 ++ roles/piwigo/tasks/main.yml | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/roles/piwigo/defaults/main.yml b/roles/piwigo/defaults/main.yml index 080151d7..c9aabe68 100644 --- a/roles/piwigo/defaults/main.yml +++ b/roles/piwigo/defaults/main.yml @@ -4,6 +4,7 @@ piwigo_available_externally: "false" # directories piwigo_config_directory: "{{ docker_home }}/piwigo/config" +piwigo_data_directory: "{{ docker_home }}/piwigo/data" piwigo_photos: "{{ photos_root }}" # uid / gid @@ -18,5 +19,6 @@ piwigo_port: "16923" # specs piwigo_memory: "1g" +piwigo_mysql_memory: "1g" piwigo_version: "docker" diff --git a/roles/piwigo/tasks/main.yml b/roles/piwigo/tasks/main.yml index c57b81be..e0777eed 100644 --- a/roles/piwigo/tasks/main.yml +++ b/roles/piwigo/tasks/main.yml @@ -5,6 +5,22 @@ state: directory with_items: - "{{ piwigo_config_directory }}" + - "{{ piwigo_data_directory }}" + +- name: create MySQL container for Piwigo + docker_container: + name: piwigo-mysql + image: mysql:5.7 + pull: true + volumes: + - "{{ piwigo_data_directory }}/mysql:/var/lib/mysql:rw" + env: + MYSQL_DATABASE: "piwigo" + MYSQL_USER: "piwigo" + MYSQL_PASSWORD: "piwigo" + MYSQL_ROOT_PASSWORD: "piwigo" + restart_policy: unless-stopped + memory: "{{ piwigo_mysql_memory }}" - name: Piwigo Docker Container docker_container: @@ -14,6 +30,8 @@ volumes: - "{{ piwigo_config_directory }}:/config:rw" - "{{ piwigo_photos }}:/gallery:rw" + links: + - piwigo-mysql:db ports: - "{{ piwigo_port }}:80" env: From 4e213cf37b497538a99f925641fbdf7dbcb3b71b Mon Sep 17 00:00:00 2001 From: Toben Archer Date: Tue, 17 Aug 2021 18:13:25 -0500 Subject: [PATCH 5/7] All the docs updated --- README.md | 1 + docs/applications/piwigo.md | 33 +++++++++++++++++++++++++ docs/configuration/application_ports.md | 1 + roles/piwigo/defaults/main.yml | 5 +++- roles/piwigo/tasks/main.yml | 7 +++--- 5 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 docs/applications/piwigo.md diff --git a/README.md b/README.md index 8f26199d..1e4b2189 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ Ansible config and a bunch of Docker containers. * [Ombi](https://ombi.io/) - web application that automatically gives your users the ability to request content * [Organizr](https://organizr.app/) - ORGANIZR aims to be your one stop shop for your Servers Frontend. * [openHAB](https://www.openhab.org/) - A vendor and technology agnostic open source automation software for your home +* [Piwigo](https://piwigo.org/) - Photo Gallery Software * [Plex](https://www.plex.tv/) - Plex Media Server * [Portainer](https://portainer.io/) - for managing Docker and running custom images * [pyLoad](https://pyload.net/) - A download manager with a friendly web-interface diff --git a/docs/applications/piwigo.md b/docs/applications/piwigo.md new file mode 100644 index 00000000..11e78658 --- /dev/null +++ b/docs/applications/piwigo.md @@ -0,0 +1,33 @@ +# Piwigo - Open Source Photo Gallery + +Homepage: [Piwigo.org](https://piwigo.org) + +Piwigo is open source photo gallery software for the web. Designed for organisations, teams and individuals. + +## Usage + +Set `piwigo_enabled: true` in your `inventories//nas.yml` file. + +If you want to access Piwigo externally, set `piwigo_available_externally: "true"` in your `inventories//nas.yml` file. + +The Piwigo web interface can be found at http://ansible_nas_host_or_ip:16923. + +## Specific Configuration + +piwigo_mysql_user: "piwigo" +piwigo_mysql_password: "piwigo" +piwigo_mysql_root_password: "piwigo" +nventories/alfheim/group_vars/nas.yml +Optional configurations: + + - Set `piwigo_mysql_user` in `inventories//group_vars/nas.yml` before installing Piwigo, this defaults to "piwigo". + - Set `piwigo_mysql_password` in `inventories//group_vars/nas.yml` before installing Piwigo, this defaults to "piwigo". + - Set `piwigo_mysql_root_password` in `inventories//group_vars/nas.yml` before installing Piwigo, this defaults to "piwigo". + + - On first run you'll need to enter database details: + - Host: `db:3306` + - Username: the value of piwigo_mysql_user, defaults to "piwigo" + - Password: the value of piwigo_password, defaults to "piwigo" + - Database Name: `piwigo` + - Database tables prefix: should be prefilled with `piwigo_` + diff --git a/docs/configuration/application_ports.md b/docs/configuration/application_ports.md index 2944a814..572a0f16 100644 --- a/docs/configuration/application_ports.md +++ b/docs/configuration/application_ports.md @@ -56,6 +56,7 @@ By default, applications can be found on the ports listed below. | openHAB | 7778 | Host | HTTPS | | Organizr | 10081 | Bridge | HTTP | | Organizr | 10444 | Bridge | HTTPS | +| Piwigo | 16923 | Bridge | HTTP | | Plex | 32400 | Bridge | HTTP | | Portainer | 9000 | Bridge | HTTP | | pyload | 8000 | Bridge | HTTP | diff --git a/roles/piwigo/defaults/main.yml b/roles/piwigo/defaults/main.yml index c9aabe68..7ab80125 100644 --- a/roles/piwigo/defaults/main.yml +++ b/roles/piwigo/defaults/main.yml @@ -5,11 +5,14 @@ piwigo_available_externally: "false" # directories piwigo_config_directory: "{{ docker_home }}/piwigo/config" piwigo_data_directory: "{{ docker_home }}/piwigo/data" -piwigo_photos: "{{ photos_root }}" +piwigo_photos: "{{ photos_root }}/piwigo" # uid / gid piwigo_user_id: "1000" piwigo_group_id: "1000" +piwigo_mysql_user: "piwigo" +piwigo_mysql_password: "piwigo" +piwigo_mysql_root_password: "piwigo" piwigo_photos_permission: "rw" diff --git a/roles/piwigo/tasks/main.yml b/roles/piwigo/tasks/main.yml index e0777eed..126cc44d 100644 --- a/roles/piwigo/tasks/main.yml +++ b/roles/piwigo/tasks/main.yml @@ -6,6 +6,7 @@ with_items: - "{{ piwigo_config_directory }}" - "{{ piwigo_data_directory }}" + - "{{ piwigo_photos }}" - name: create MySQL container for Piwigo docker_container: @@ -16,9 +17,9 @@ - "{{ piwigo_data_directory }}/mysql:/var/lib/mysql:rw" env: MYSQL_DATABASE: "piwigo" - MYSQL_USER: "piwigo" - MYSQL_PASSWORD: "piwigo" - MYSQL_ROOT_PASSWORD: "piwigo" + MYSQL_USER: "{{ piwigo_mysql_user }}" + MYSQL_PASSWORD: "{{ piwigo_mysql_password }}" + MYSQL_ROOT_PASSWORD: "{{ piwigo_mysql_root_password }}" restart_policy: unless-stopped memory: "{{ piwigo_mysql_memory }}" From 7629864d79f3f13e3f326ab104ee928982d8b487 Mon Sep 17 00:00:00 2001 From: Toben Archer Date: Tue, 17 Aug 2021 18:36:32 -0500 Subject: [PATCH 6/7] Left some scafolding behind. --- docs/applications/piwigo.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/applications/piwigo.md b/docs/applications/piwigo.md index 11e78658..cdf2a5cd 100644 --- a/docs/applications/piwigo.md +++ b/docs/applications/piwigo.md @@ -14,10 +14,6 @@ The Piwigo web interface can be found at http://ansible_nas_host_or_ip:16923. ## Specific Configuration -piwigo_mysql_user: "piwigo" -piwigo_mysql_password: "piwigo" -piwigo_mysql_root_password: "piwigo" -nventories/alfheim/group_vars/nas.yml Optional configurations: - Set `piwigo_mysql_user` in `inventories//group_vars/nas.yml` before installing Piwigo, this defaults to "piwigo". From 1aa693ba6c8429160159a0ebefd58d47f8d3d4e0 Mon Sep 17 00:00:00 2001 From: Toben Archer Date: Thu, 25 Nov 2021 11:31:26 -0600 Subject: [PATCH 7/7] Correcting GUID and UID. --- roles/piwigo/defaults/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/piwigo/defaults/main.yml b/roles/piwigo/defaults/main.yml index 7ab80125..c070ada4 100644 --- a/roles/piwigo/defaults/main.yml +++ b/roles/piwigo/defaults/main.yml @@ -8,8 +8,8 @@ piwigo_data_directory: "{{ docker_home }}/piwigo/data" piwigo_photos: "{{ photos_root }}/piwigo" # uid / gid -piwigo_user_id: "1000" -piwigo_group_id: "1000" +piwigo_user_id: "0" +piwigo_group_id: "0" piwigo_mysql_user: "piwigo" piwigo_mysql_password: "piwigo" piwigo_mysql_root_password: "piwigo"