diff --git a/dns.yml b/dns.yml index 455bb31..f34069b 100644 --- a/dns.yml +++ b/dns.yml @@ -45,6 +45,8 @@ dns_records: - name: "forms" ip: "152.53.36.98" + - name: "listmonk" + ip: "152.53.36.98" - name: "repair" ip: "152.53.36.98" diff --git a/group_vars/all/domains.yml b/group_vars/all/domains.yml index e4f0845..cbcffd7 100644 --- a/group_vars/all/domains.yml +++ b/group_vars/all/domains.yml @@ -25,6 +25,7 @@ subdomains: bytestash: "snippets.{{ primary_domain }}" # ByteStash code snippets gotify: "gotify.{{ primary_domain }}" # Gotify notifications gotify_assistant: "gotify-assistant.{{ primary_domain }}" # iGotify iOS assistant + listmonk: "listmonk.{{ secondary_domain }}" # Listmonk mailing list # Email domains for notifications email_domains: diff --git a/group_vars/docker/services.yml b/group_vars/docker/services.yml index 4e6147a..a0407e9 100644 --- a/group_vars/docker/services.yml +++ b/group_vars/docker/services.yml @@ -6,7 +6,7 @@ service_categories: development: ["gitea", "bytestash"] media: ["audiobookshelf", "calibre", "hoarder", "manyfold"] productivity: ["paperlessngx", "baikal", "syncthing", "heyform", "dawarich", "obsidian-livesync"] - communication: ["gotosocial"] + communication: ["gotosocial", "listmonk"] monitoring: ["glance", "changedetection", "appriseapi", "gotify", "cronmaster"] # Common service configuration diff --git a/roles/docker/files/Caddyfile b/roles/docker/files/Caddyfile index 71ae610..d965052 100644 --- a/roles/docker/files/Caddyfile +++ b/roles/docker/files/Caddyfile @@ -97,3 +97,7 @@ nerder.land { forms.nerder.land { reverse_proxy heyform-heyform-1:8000 } + +listmonk.nerder.land { + reverse_proxy listmonk:9000 +} diff --git a/roles/docker/tasks/communication/listmonk.yml b/roles/docker/tasks/communication/listmonk.yml new file mode 100644 index 0000000..3073546 --- /dev/null +++ b/roles/docker/tasks/communication/listmonk.yml @@ -0,0 +1,19 @@ +- name: make listmonk directories + ansible.builtin.file: + path: "{{ item }}" + state: directory + loop: + - /opt/stacks/listmonk + +- name: Template out the compose file + ansible.builtin.template: + src: listmonk-compose.yml.j2 + dest: /opt/stacks/listmonk/compose.yml + owner: root + mode: 644 + +- name: deploy listmonk stack + community.docker.docker_compose_v2: + project_src: /opt/stacks/listmonk + files: + - compose.yml diff --git a/roles/docker/tasks/communication/main.yml b/roles/docker/tasks/communication/main.yml index 572aeb0..cc8caaf 100644 --- a/roles/docker/tasks/communication/main.yml +++ b/roles/docker/tasks/communication/main.yml @@ -7,4 +7,8 @@ - name: Install postiz import_tasks: postiz.yml - tags: postiz \ No newline at end of file + tags: postiz + +- name: Install listmonk + import_tasks: listmonk.yml + tags: listmonk \ No newline at end of file diff --git a/roles/docker/templates/listmonk-compose.yml.j2 b/roles/docker/templates/listmonk-compose.yml.j2 new file mode 100644 index 0000000..3c04397 --- /dev/null +++ b/roles/docker/templates/listmonk-compose.yml.j2 @@ -0,0 +1,58 @@ +services: + listmonk: + image: listmonk/listmonk:latest + restart: unless-stopped + ports: + - "9000:9000" + depends_on: + db: + condition: service_healthy + command: [sh, -c, "./listmonk --install --idempotent --yes --config '' && ./listmonk --upgrade --yes --config '' && ./listmonk --config ''"] + environment: + LISTMONK_app__address: 0.0.0.0:9000 + LISTMONK_db__user: listmonk + LISTMONK_db__password: {{ vault_listmonk.postgres_password }} + LISTMONK_db__database: listmonk + LISTMONK_db__host: db + LISTMONK_db__port: 5432 + LISTMONK_db__ssl_mode: disable + LISTMONK_db__max_open: 25 + LISTMONK_db__max_idle: 25 + LISTMONK_db__max_lifetime: 300s + TZ: Etc/UTC + LISTMONK_ADMIN_USER: {{ vault_listmonk.admin_user }} + LISTMONK_ADMIN_PASSWORD: {{ vault_listmonk.admin_password }} + volumes: + - uploads:/listmonk/uploads + labels: + glance.name: Listmonk + glance.url: https://{{ subdomains.listmonk }}/ + glance.description: Mailing list manager + glance.id: listmonk + + db: + image: postgres:17-alpine + restart: unless-stopped + environment: + POSTGRES_USER: listmonk + POSTGRES_PASSWORD: {{ vault_listmonk.postgres_password }} + POSTGRES_DB: listmonk + healthcheck: + test: ["CMD-SHELL", "pg_isready -U listmonk"] + interval: 10s + timeout: 5s + retries: 6 + volumes: + - listmonk-data:/var/lib/postgresql/data + labels: + glance.parent: listmonk + glance.name: DB + +volumes: + uploads: + listmonk-data: + +networks: + default: + external: true + name: {{ docker.network_name }}