Compare commits

..
14 Commits
Author SHA1 Message Date
dannygroenewegen 37f41adc1a chore: publish 5.3.0+v6.2.0 release 2026-10-22 12:30:05 +02:00
dannygroenewegen f94b8cbe9f feat: add healthcheck to the app service 2026-10-22 12:23:33 +02:00
dannygroenewegen ade1d1191d fix: correct backup volume label 2026-10-19 16:50:19 +02:00
dannygroenewegen 78cb8281c4 feat: add set_config function 2026-10-19 16:50:19 +02:00
dannygroenewegen c51126fce2 feat: add optional admin user bootstrap overlay 2026-10-14 16:39:02 +02:00
javielico cee9b4986f chore: publish 5.2.0+v6.2.0 release 2026-08-10 15:18:06 +01:00
javielico 9049f72956 chore: update image tags 2026-08-10 15:17:53 +01:00
stevensting 63d122855f Merge pull request 'fix db backups' (#5) from fix-backups into main
Reviewed-on: coop-cloud/listmonk#5
2026-06-16 18:52:50 +00:00
stevensting 52ca435ce5 Merge pull request 'chore: Configure Renovate' (#3) from renovate/configure into main
Reviewed-on: coop-cloud/listmonk#3
2026-06-16 18:52:31 +00:00
stevensting 7f343a96c4 fix db backups 2026-06-16 20:51:05 +02:00
knoflook fc6cece84e chore: publish 5.1.0+v6.1.0 release 2026-04-09 17:00:35 +02:00
knoflook 2c53efc5fe chore: update image tags 2026-04-09 16:46:21 +02:00
decentral1se 542ff11abf Merge pull request 'Add instruction to make upload work' (#4) from jeppebundsgaard/listmonk:main into main
Reviewed-on: coop-cloud/listmonk#4
Reviewed-by: decentral1se <decentral1se@noreply.git.coopcloud.tech>
2026-04-04 11:46:24 +00:00
renovate-bot cfce5e6f79 Add renovate.json 2026-03-10 17:52:50 +00:00
9 changed files with 178 additions and 15 deletions
+8
View File
@@ -3,4 +3,12 @@ TYPE=listmonk
DOMAIN=listmonk.example.com
LETS_ENCRYPT_ENV=production
COMPOSE_FILE="compose.yml"
SECRET_DB_PASSWORD_VERSION=v1
# Admin bootstrap (only used on the very first --install run; without it, the first visitor
# to the login page gets a create admin user form)
#COMPOSE_FILE="$COMPOSE_FILE:compose.adminbootstrap.yml"
#LISTMONK_ADMIN_USER=admin
#SECRET_ADMIN_PW_VERSION=v1
+7 -6
View File
@@ -6,7 +6,7 @@
* **Category**: Development
* **Status**: 2, beta
* **Image**: [`listmonk/listmonk`](https://hub.docker.com/r/listmonk/listmonk/), 2, upstream
* **Healthcheck**: No
* **Healthcheck**: Yes
* **Backups**: Yes
* **Email**: Yes
* **Tests**: 2
@@ -17,8 +17,9 @@
1. Set up Docker Swarm and [`abra`][abra]
2. Deploy [`coop-cloud/traefik`][cc-traefik]
3. `abra app new listmonk --secrets` (optionally with `--pass` if you'd like
to save secrets in `pass`)
4. `abra app config YOURAPPDOMAIN` - be sure to change `$DOMAIN` to something that resolves to your Docker swarm box. Nothing to change apart from the DOMAIN at the moment.
5. `abra app deploy YOURAPPDOMAIN`
6. To make media uploads work, go to Settings->Media uploads and set upload path to "/uploads" and click the Save-button.
3. `abra app new listmonk`
4. `abra app config YOURAPPDOMAIN`
5. (optional) To set the admin user yourself instead of letting the welcome form create one, uncomment the admin bootstrap lines in `.env`.
6. `abra app secret generate YOURAPPDOMAIN`
7. `abra app deploy YOURAPPDOMAIN`
8. To make media uploads work, go to Settings->Media uploads and set upload path to "/uploads" and click the Save-button.
+50 -1
View File
@@ -1,2 +1,51 @@
export CONFIG_TOML_VERSION=v2
export APP_ENTRYPOINT_VERSION=v1
export APP_ENTRYPOINT_VERSION=v2
export PG_BACKUP_VERSION=v3
# Writes one row of listmonk's flat key/value `settings` table (key TEXT UNIQUE, value JSONB).
#
# VALUE is an unquoted scalar/array/object, not pre-quoted JSON text: true/false, numbers
# and [...]/{...} pass straight through as-is; anything else is treated as a string and
# wrapped via Postgres's to_jsonb().
# For array/object values, escape ", { and } with a \.
#
# Usage: db set_setting <key> <raw_value>
# db set_setting app.cache_slow_queries true
# db set_setting upload.max_file_size 6000
# db set_setting app.root_url example.com
# db set_setting upload.extensions [\"jpg\",\"jpeg\",\"png\"]
# db set_setting security.oidc \{\"enabled\":true,\"provider_name\":\"SSO\"\}
set_setting() {
if [ "$TARGET" != "db" ]; then
echo "ERROR: set_setting must run in the db container -- call it as 'db set_setting ...'" >&2
exit 1
fi
local KEY="$1" VALUE="$2"
if [ -z "$KEY" ] || [ -z "$VALUE" ]; then
echo "Usage: set_setting <key> <raw_value>" >&2
exit 1
fi
local ESCAPED_VALUE
ESCAPED_VALUE="$(printf '%s' "$VALUE" | sed "s/'/''/g")"
local VALUE_EXPR
if [ "$VALUE" = "true" ] || [ "$VALUE" = "false" ] || [[ "$VALUE" =~ ^-?[0-9]+(\.[0-9]+)?$ ]] \
|| [[ "$VALUE" == \[*\] ]] || [[ "$VALUE" == \{*\} ]]; then
VALUE_EXPR="'${ESCAPED_VALUE}'::jsonb"
else
VALUE_EXPR="to_jsonb('${ESCAPED_VALUE}'::text)"
fi
if ! PGPASSWORD="$(cat "$POSTGRES_PASSWORD_FILE")" psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -d "$POSTGRES_DB" <<SQL | grep -qx "UPDATE 1"
UPDATE settings SET value = ${VALUE_EXPR}, updated_at = now() WHERE key = '${KEY}';
SQL
then
echo "ERROR: no row matched key '${KEY}' in settings, or '${VALUE}' isn't valid" >&2
exit 1
fi
echo "Set '${KEY}'"
}
+14
View File
@@ -0,0 +1,14 @@
---
version: "3.8"
services:
app:
environment:
- LISTMONK_ADMIN_USER=${LISTMONK_ADMIN_USER:-admin}
secrets:
- admin_pw
secrets:
admin_pw:
name: ${STACK_NAME}_admin_pw_${SECRET_ADMIN_PW_VERSION}
external: true
+18 -8
View File
@@ -3,7 +3,7 @@ version: "3.8"
services:
app:
image: listmonk/listmonk:v6.0.0
image: listmonk/listmonk:v6.2.0
networks:
- internal
- proxy
@@ -14,6 +14,11 @@ services:
- db_password
depends_on:
- db
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:9000/health"]
interval: 10s
timeout: 5s
retries: 6
configs:
- source: config_toml
target: /listmonk/config.toml
@@ -31,7 +36,7 @@ services:
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=9000"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
- "coop-cloud.${STACK_NAME}.version=5.0.0+v6.0.0"
- "coop-cloud.${STACK_NAME}.version=5.3.0+v6.2.0"
volumes:
- "uploads:/uploads"
@@ -54,12 +59,14 @@ services:
- "postgres:/var/lib/postgresql"
deploy:
labels:
backupbot.backup: "true"
backupbot.backup.pre-hook: sh -c 'pg_dump -U "$$POSTGRES_USER" -Fc "$$POSTGRES_DB" | gzip > "/postgres.dump.gz"'
backupbot.backup.path: "/postgres.dump.gz"
backupbot.backup.post-hook: "rm -f /postgres.dump.gz"
backupbot.restore: "true"
backupbot.restore.post-hook: sh -c 'gzip -d /postgres.dump.gz && pg_restore --clean -U "$$POSTGRES_USER" --dbname="$$POSTGRES_DB" < /postgres.dump && rm -f /postgres.dump'
backupbot.backup: ${ENABLE_BACKUPS:-true}
backupbot.backup.volumes.postgres.path: "backup.sql"
backupbot.backup.pre-hook: "/pg_backup.sh backup"
backupbot.restore.post-hook: '/pg_backup.sh restore'
configs:
- source: pg_backup
target: /pg_backup.sh
mode: 0555
secrets:
db_password:
@@ -74,6 +81,9 @@ configs:
app_entrypoint:
name: ${STACK_NAME}_app_entrypoint_${APP_ENTRYPOINT_VERSION}
file: docker-entrypoint.sh
pg_backup:
name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
file: pg_backup.sh
networks:
internal:
+6
View File
@@ -1,6 +1,12 @@
#!/bin/sh
set -e
cd /listmonk
# listmonk's admin bootstrap vars have no *_FILE support
if [ -f /run/secrets/admin_pw ]; then
export LISTMONK_ADMIN_PASSWORD="$(cat /run/secrets/admin_pw)"
fi
./listmonk --install --yes --idempotent
./listmonk --upgrade --yes
./listmonk
Executable
+65
View File
@@ -0,0 +1,65 @@
#!/bin/bash
set -e
DATADIR="${PGDATA:-/var/lib/postgresql/18/docker}"
LATEST_BACKUP_FILE="/var/lib/postgresql/backup.sql"
function backup {
if [ -f "$POSTGRES_PASSWORD_FILE" ]; then
export PGPASSWORD=$(cat "$POSTGRES_PASSWORD_FILE")
fi
echo "Creating backup at ${LATEST_BACKUP_FILE}..."
pg_dump -U "${POSTGRES_USER:-postgres}" "${POSTGRES_DB:-postgres}" > "${LATEST_BACKUP_FILE}"
echo "Backup done. You will find it at ${LATEST_BACKUP_FILE}"
}
function restore {
echo "Restoring database from ${LATEST_BACKUP_FILE}..."
cd ${DATADIR}
function restore_config {
echo "Restoring original pg_hba.conf configuration..."
cat pg_hba.conf.bak > pg_hba.conf
su postgres -c 'pg_ctl reload'
}
# Don't allow any other connections than local
echo "Setting up temporary pg_hba.conf to only allow local connections..."
cp pg_hba.conf pg_hba.conf.bak
echo "local all all trust" > pg_hba.conf
su postgres -c 'pg_ctl reload'
trap restore_config EXIT INT TERM
# Recreate Database
echo "Dropping existing database ${POSTGRES_DB:-postgres}..."
psql -U "${POSTGRES_USER:-postgres}" -d postgres -c "DROP DATABASE \"${POSTGRES_DB:-postgres}\" WITH (FORCE);"
echo "Creating fresh database ${POSTGRES_DB:-postgres}..."
createdb -U "${POSTGRES_USER:-postgres}" "${POSTGRES_DB:-postgres}"
echo "Restoring data from ${LATEST_BACKUP_FILE}..."
psql -U "${POSTGRES_USER:-postgres}" -d "${POSTGRES_DB:-postgres}" -1 -f "${LATEST_BACKUP_FILE}"
trap - EXIT INT TERM
restore_config
echo "Database restore completed successfully."
}
# Execute the function passed as argument
case "$1" in
backup)
backup
;;
restore)
restore
;;
*)
echo "Usage: $0 {backup|restore}"
exit 1
;;
esac
+4
View File
@@ -0,0 +1,4 @@
- Optional admin-bootstrap overlay: sets the initial admin user/password before first install
- set_setting abra.sh helper for writing Listmonk's settings directly to db
- Healthcheck for the app service.
- Fix Postgres backup: wrong volume label
+6
View File
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
}