Compare commits
11 Commits
4.0.0+v5.0.1
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 63d122855f | |||
| 52ca435ce5 | |||
| 7f343a96c4 | |||
| fc6cece84e | |||
| 2c53efc5fe | |||
| 542ff11abf | |||
| e6caad12ff | |||
| cfce5e6f79 | |||
| 9251725aac | |||
| 58e7c6cf8b | |||
| b31122c149 |
@@ -7,8 +7,8 @@
|
||||
* **Status**: 2, beta
|
||||
* **Image**: [`listmonk/listmonk`](https://hub.docker.com/r/listmonk/listmonk/), 2, upstream
|
||||
* **Healthcheck**: No
|
||||
* **Backups**: No
|
||||
* **Email**: ?
|
||||
* **Backups**: Yes
|
||||
* **Email**: Yes
|
||||
* **Tests**: 2
|
||||
* **SSO**: No
|
||||
<!-- endmetadata -->
|
||||
@@ -21,3 +21,4 @@
|
||||
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.
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export CONFIG_TOML_VERSION=v2
|
||||
export APP_ENTRYPOINT_VERSION=v1
|
||||
export PG_BACKUP_VERSION=v2
|
||||
+16
-11
@@ -3,7 +3,7 @@ version: "3.8"
|
||||
|
||||
services:
|
||||
app:
|
||||
image: listmonk/listmonk:v5.0.1
|
||||
image: listmonk/listmonk:v6.1.0
|
||||
networks:
|
||||
- internal
|
||||
- proxy
|
||||
@@ -31,12 +31,12 @@ 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=4.0.0+v5.0.1"
|
||||
- "coop-cloud.${STACK_NAME}.version=5.1.0+v6.1.0"
|
||||
volumes:
|
||||
- "uploads:/uploads"
|
||||
|
||||
db:
|
||||
image: postgres:13
|
||||
image: postgres:18
|
||||
networks:
|
||||
- internal
|
||||
secrets:
|
||||
@@ -51,15 +51,17 @@ services:
|
||||
timeout: 5s
|
||||
retries: 6
|
||||
volumes:
|
||||
- "postgres_data:/var/lib/postgresql/data"
|
||||
- "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_data.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 +76,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:
|
||||
@@ -81,5 +86,5 @@ networks:
|
||||
external: true
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
postgres:
|
||||
uploads:
|
||||
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
BACKUP_PATH="/var/lib/postgresql/data"
|
||||
LATEST_BACKUP_FILE="${BACKUP_PATH}/backup.sql"
|
||||
|
||||
function backup {
|
||||
FILE_WITH_DATE="${BACKUP_PATH}/backup_$(date +%F).sql"
|
||||
|
||||
if [ -f "$POSTGRES_PASSWORD_FILE" ]; then
|
||||
export PGPASSWORD=$(cat "$POSTGRES_PASSWORD_FILE")
|
||||
fi
|
||||
|
||||
echo "Creating backup at ${FILE_WITH_DATE}..."
|
||||
pg_dump -U "${POSTGRES_USER:-postgres}" "${POSTGRES_DB:-postgres}" > "${FILE_WITH_DATE}"
|
||||
|
||||
echo "Copying to ${LATEST_BACKUP_FILE}..."
|
||||
cp -f "${FILE_WITH_DATE}" "${LATEST_BACKUP_FILE}"
|
||||
|
||||
echo "Backup done. You will find it at ${LATEST_BACKUP_FILE}"
|
||||
}
|
||||
|
||||
function restore {
|
||||
echo "Restoring database from ${LATEST_BACKUP_FILE}..."
|
||||
|
||||
cd ${BACKUP_PATH}
|
||||
|
||||
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
|
||||
@@ -0,0 +1,17 @@
|
||||
!!! Postgres major version upgrade and volume change !!!
|
||||
We're bumping from postgres 13 to 18 and the storage location of files has
|
||||
changed from /var/lib/postgres/data to /var/lib/postgres/18. Volume was
|
||||
adjusted accordingly. Take a dump of DB before the upgrade by running
|
||||
|
||||
pg_dump -U listmonk -Fc -b -f /var/lib/postgres/data/dump
|
||||
|
||||
in the db container of the app. Then pull this file out from the docker volume
|
||||
|
||||
Then deploy the new version of the app. Next, copy the dump that you just
|
||||
made into new volume /var/lib/docker/volumes/your_app_name_postgres/_data/dump
|
||||
After that you can run
|
||||
|
||||
pg_restore --clean -U listmonk -d listmonk /var/lib/postgres/dump
|
||||
|
||||
Afterwards you should restart the db container and it should be all good.
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:recommended"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user