From 83613f6d869715a7e3272025d4cdba9967fba07e Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 7 Mar 2025 21:42:45 +0100 Subject: [PATCH] feat(roles): Add auto updating to some roles Miniflux, searx, shaarli and wallabag will be automatically updated by shepherd. --- roles/miniflux/defaults/main.yml | 2 ++ roles/miniflux/templates/docker-stack.yml.j2 | 5 +++++ roles/searx/defaults/main.yml | 7 +++++-- roles/searx/templates/docker-stack.yml.j2 | 7 ++++++- roles/shaarli/defaults/main.yml | 2 ++ roles/shaarli/templates/docker-stack.yml.j2 | 5 +++++ roles/wallabag/defaults/main.yml | 2 ++ roles/wallabag/templates/docker-stack.yml.j2 | 7 ++++++- 8 files changed, 33 insertions(+), 4 deletions(-) diff --git a/roles/miniflux/defaults/main.yml b/roles/miniflux/defaults/main.yml index a241f22..d93c12f 100644 --- a/roles/miniflux/defaults/main.yml +++ b/roles/miniflux/defaults/main.yml @@ -8,6 +8,8 @@ miniflux_use_https: true # the subdomain link miniflux will be reachable under subdomain_alias: rss +miniflux_autoupdate: true + # Should ideally be overwritten in encrypted group/host vars miniflux_admin_username: myadmin miniflux_admin_password: mypassword diff --git a/roles/miniflux/templates/docker-stack.yml.j2 b/roles/miniflux/templates/docker-stack.yml.j2 index 7af9ed7..15af1ed 100644 --- a/roles/miniflux/templates/docker-stack.yml.j2 +++ b/roles/miniflux/templates/docker-stack.yml.j2 @@ -24,6 +24,11 @@ services: {% else %} - "BASE_URL={{ (miniflux_use_https == True) | ternary('https', 'http') }}://localhost/{{ (subdomain_alias is not undefined and not none) | ternary(subdomain_alias, stack_name) }}" {% endif %} +{% if miniflux_autoupdate is defined and miniflux_autoupdate %} + deploy: + labels: + - shepherd.autoupdate=true +{% endif %} db: image: postgres:11 diff --git a/roles/searx/defaults/main.yml b/roles/searx/defaults/main.yml index 5204c77..dd9fa5a 100644 --- a/roles/searx/defaults/main.yml +++ b/roles/searx/defaults/main.yml @@ -5,8 +5,11 @@ searx_upstream_file_dir: "{{ docker_stack_files_dir }}/{{ stack_name }}" searx_use_https: true +searx_autoupdate: true + # the subdomain link searx will be reachable under subdomain_alias: search + # searx_authentication: -# - username: mysearxusername -# password: JDJhJDE0JFdjUnQ5WWllcU8wa01xS0JBS2dlMy5zMEhRTmxqTXdIZmdjcTN6ZGFwRjJlYUdoSHAwRUhL # mysearxpassword +# - username: # mysearxusername +# password: # mysearxpassword diff --git a/roles/searx/templates/docker-stack.yml.j2 b/roles/searx/templates/docker-stack.yml.j2 index 9c1cd2d..9b853ac 100644 --- a/roles/searx/templates/docker-stack.yml.j2 +++ b/roles/searx/templates/docker-stack.yml.j2 @@ -13,7 +13,7 @@ services: start_period: 1m environment: - BIND_ADDRESS=0.0.0.0:8080 -{% if server_domain is not undefined and not none %} +{% if server_domain is not undefined and not none %} - "BASE_URL={{ (searx_use_https == True) | ternary('https', 'http') }}://{{ (subdomain_alias is not undefined and not none) | ternary(subdomain_alias, stack_name) }}.{{server_domain}}" {% else %} - "BASE_URL={{ (searx_use_https == True) | ternary('https', 'http') }}://localhost/{{ (subdomain_alias is not undefined and not none) | ternary(subdomain_alias, stack_name) }}" @@ -21,6 +21,11 @@ services: volumes: - /etc/localtime:/etc/localtime:ro - data:/etc/searx:rw +{% if searx_autoupdate is defined and searx_autoupdate %} + deploy: + labels: + - shepherd.autoupdate=true +{% endif %} volumes: data: diff --git a/roles/shaarli/defaults/main.yml b/roles/shaarli/defaults/main.yml index 45f1bef..662c888 100644 --- a/roles/shaarli/defaults/main.yml +++ b/roles/shaarli/defaults/main.yml @@ -5,6 +5,8 @@ shaarli_upstream_file_dir: "{{ docker_stack_files_dir }}/{{ stack_name }}" shaarli_use_https: true +shaarli_autoupdate: true + # the subdomain link shaarli will be reachable under subdomain_alias: links diff --git a/roles/shaarli/templates/docker-stack.yml.j2 b/roles/shaarli/templates/docker-stack.yml.j2 index a90157a..0ee7f70 100644 --- a/roles/shaarli/templates/docker-stack.yml.j2 +++ b/roles/shaarli/templates/docker-stack.yml.j2 @@ -14,6 +14,11 @@ services: volumes: - data:/var/www/shaarli/data - cache:/var/www/shaarli/cache +{% if shaarli_autoupdate is defined and shaarli_autoupdate %} + deploy: + labels: + - shepherd.autoupdate=true +{% endif %} {% if backup_enable is not undefined and not false and shaarli_backup_enable is not undefined and not false %} backup: diff --git a/roles/wallabag/defaults/main.yml b/roles/wallabag/defaults/main.yml index c7b830c..55de954 100644 --- a/roles/wallabag/defaults/main.yml +++ b/roles/wallabag/defaults/main.yml @@ -5,5 +5,7 @@ wallabag_upstream_file_dir: "{{ docker_stack_files_dir }}/{{ stack_name }}" wallabag_use_https: true +wallabag_autoupdate: true + # the subdomain link wallabag will be reachable under subdomain_alias: read diff --git a/roles/wallabag/templates/docker-stack.yml.j2 b/roles/wallabag/templates/docker-stack.yml.j2 index ee7e307..387f3d7 100644 --- a/roles/wallabag/templates/docker-stack.yml.j2 +++ b/roles/wallabag/templates/docker-stack.yml.j2 @@ -15,11 +15,16 @@ services: - data:/var/www/wallabag/data environment: - SYMFONY__ENV__FOSUSER_REGISTRATION=false -{% if server_domain is not undefined and not none %} +{% if server_domain is not undefined and not none %} - "SYMFONY__ENV__DOMAIN_NAME={{ (wallabag_use_https == True) | ternary('https', 'http') }}://{{ (subdomain_alias is not undefined and not none) | ternary(subdomain_alias, stack_name) }}.{{server_domain}}" {% else %} - SYMFONY__ENV__DOMAIN_NAME={{ (wallabag_use_https == True) | ternary('https', 'http') }}://localhost {% endif %} +{% if wallabag_autoupdate is defined and wallabag_autoupdate %} + deploy: + labels: + - shepherd.autoupdate=true +{% endif %} redis: image: redis:alpine