Compare commits
4 Commits
fixed_imag
...
upgrade-1.
| Author | SHA1 | Date | |
|---|---|---|---|
| 720faa0beb | |||
| 306f448adf | |||
| ff03db348f | |||
| a6f646a2c8 |
1
abra.sh
1
abra.sh
@ -1 +1,2 @@
|
|||||||
export GHOST_ENTRYPOINT_VERSION=v1
|
export GHOST_ENTRYPOINT_VERSION=v1
|
||||||
|
export MYSQL_BACKUP_VERSION=v1
|
||||||
|
|||||||
21
compose.yml
21
compose.yml
@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: ghost:6.21.2-alpine
|
image: ghost:6.43.1-alpine
|
||||||
environment:
|
environment:
|
||||||
# see https://ghost.org/docs/config/#configuration-options
|
# see https://ghost.org/docs/config/#configuration-options
|
||||||
database__client: mysql
|
database__client: mysql
|
||||||
@ -51,13 +51,13 @@ services:
|
|||||||
- "traefik.http.middlewares.${STACK_NAME}-redirect.redirectscheme.permanent=true"
|
- "traefik.http.middlewares.${STACK_NAME}-redirect.redirectscheme.permanent=true"
|
||||||
- "backupbot.backup=true"
|
- "backupbot.backup=true"
|
||||||
- "backupbot.backup.path=/var/lib/ghost/content"
|
- "backupbot.backup.path=/var/lib/ghost/content"
|
||||||
- "coop-cloud.${STACK_NAME}.version=1.1.1+6-alpine"
|
- "coop-cloud.${STACK_NAME}.version=1.3.0+6.43.1-alpine"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "--header=X-Forwarded-Proto: https", "--spider", "-q", "http://localhost:2368/ghost/api/admin/site"]
|
test: ["CMD", "wget", "--header=X-Forwarded-Proto: https", "--spider", "-q", "http://localhost:2368/ghost/api/admin/site"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 10
|
retries: 10
|
||||||
start_period: 1m
|
start_period: 15m
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: mysql:8.0
|
image: mysql:8.0
|
||||||
@ -67,21 +67,25 @@ services:
|
|||||||
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db_password
|
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db_password
|
||||||
secrets:
|
secrets:
|
||||||
- db_password
|
- db_password
|
||||||
|
configs:
|
||||||
|
- source: mysql_backup
|
||||||
|
target: /mysql_backup.sh
|
||||||
|
mode: 0555
|
||||||
volumes:
|
volumes:
|
||||||
- "mysql:/var/lib/mysql"
|
- "mysql:/var/lib/mysql"
|
||||||
deploy:
|
deploy:
|
||||||
labels:
|
labels:
|
||||||
- "backupbot.backup=true"
|
- "backupbot.backup=true"
|
||||||
- "backupbot.backup.pre-hook=mysqldump -u root -p\"$$(cat /run/secrets/db_password)\" ghost --tab /var/lib/mysql-files/"
|
- "backupbot.backup.pre-hook=/mysql_backup.sh backup"
|
||||||
- "backupbot.backup.post-hook=rm -rf /var/lib/mysql-files/*"
|
- "backupbot.backup.volumes.mysql.path=backup.sql.gz"
|
||||||
- "backupbot.backup.path=/var/lib/mysql-files/"
|
- "backupbot.restore.post-hook=/mysql_backup.sh restore"
|
||||||
|
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p\"$$(cat /run/secrets/db_password)\""]
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p\"$$(cat /run/secrets/db_password)\""]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 10
|
retries: 10
|
||||||
start_period: 1m
|
start_period: 15m
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
proxy:
|
proxy:
|
||||||
@ -104,3 +108,6 @@ configs:
|
|||||||
ghost_entrypoint:
|
ghost_entrypoint:
|
||||||
name: ${STACK_NAME}_ghost_entrypoint_${GHOST_ENTRYPOINT_VERSION}
|
name: ${STACK_NAME}_ghost_entrypoint_${GHOST_ENTRYPOINT_VERSION}
|
||||||
file: entrypoint.sh
|
file: entrypoint.sh
|
||||||
|
mysql_backup:
|
||||||
|
name: ${STACK_NAME}_mysql_backup_${MYSQL_BACKUP_VERSION}
|
||||||
|
file: mysql_backup.sh
|
||||||
28
mysql_backup.sh
Executable file
28
mysql_backup.sh
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# MySQL backup/restore hook for the `db` service. Invoked by backupbot-two via:
|
||||||
|
# backupbot.backup.pre-hook = "/mysql_backup.sh backup"
|
||||||
|
# backupbot.backup.path = "/var/lib/mysql/backup.sql.gz"
|
||||||
|
# backupbot.restore.post-hook = "/mysql_backup.sh restore"
|
||||||
|
# Backup dumps the `ghost` DB to a single gzipped file inside the mysql data volume; backupbot
|
||||||
|
# archives it. Restore reimports it. The previous recipe shipped a `mysqldump --tab` backup with NO
|
||||||
|
# restore hook (and the mysql data volume itself was not backed up), so a restored backup silently
|
||||||
|
# kept the live, un-restored DB state — data loss on restore.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
BACKUP_FILE="/var/lib/mysql/backup.sql.gz"
|
||||||
|
export MYSQL_PWD="$(cat "${MYSQL_ROOT_PASSWORD_FILE:-/run/secrets/db_password}")"
|
||||||
|
DB_NAME="ghost"
|
||||||
|
|
||||||
|
function backup {
|
||||||
|
mysqldump -u root --single-transaction --routines --triggers --databases "$DB_NAME" | gzip > "$BACKUP_FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
function restore {
|
||||||
|
# --databases dump carries CREATE DATABASE/USE + per-table DROP+CREATE (mysqldump default), so the
|
||||||
|
# reimport deterministically rebuilds every table from the archived dump.
|
||||||
|
gunzip -c "$BACKUP_FILE" | mysql -u root
|
||||||
|
}
|
||||||
|
|
||||||
|
$@
|
||||||
1
release/1.2.0+6.21.2-alpine
Normal file
1
release/1.2.0+6.21.2-alpine
Normal file
@ -0,0 +1 @@
|
|||||||
|
move IMAGE_VERSION in extra compose file to make sure, main is always a knowingly working version
|
||||||
1
release/1.3.0+6.43.1-alpine
Normal file
1
release/1.3.0+6.43.1-alpine
Normal file
@ -0,0 +1 @@
|
|||||||
|
upgrade ghost image from 6.21.2-alpine to 6.43.1-alpine (within-major, no breaking changes)
|
||||||
Reference in New Issue
Block a user