chore(prod): support .env.docker in crons, fix WAL mapping and add canvas copy in Dockerfile
Some checks failed
CI / Deploy production (on server) (push) Has been cancelled
CI / Lint, Test & Build (push) Has been cancelled

This commit is contained in:
Antigravity
2026-05-20 19:21:49 +00:00
parent 495f9a631b
commit 2db12adffc
7 changed files with 48 additions and 1 deletions

View File

@@ -1,6 +1,13 @@
#!/bin/bash
set -euo pipefail
# Load environment variables from .env.docker if it exists
if [ -f "/opt/memento/.env.docker" ]; then
set -a
source "/opt/memento/.env.docker"
set +a
fi
BACKUP_DIR="/opt/memento/backups"
WAL_DIR="$BACKUP_DIR/wal"
SNAPSHOT_DIR="$BACKUP_DIR/snapshots"

View File

@@ -1,6 +1,13 @@
#!/bin/bash
set -euo pipefail
# Load environment variables from .env.docker if it exists
if [ -f "/opt/memento/.env.docker" ]; then
set -a
source "/opt/memento/.env.docker"
set +a
fi
SNAPSHOT_DIR="/opt/memento/backups/snapshots"
SSH_KEY="/root/.ssh/memento-nas"
NAS1="sepehr@192.168.1.132"

View File

@@ -1,6 +1,13 @@
#!/bin/bash
set -euo pipefail
# Load environment variables from .env.docker if it exists
if [ -f "/opt/memento/.env.docker" ]; then
set -a
source "/opt/memento/.env.docker"
set +a
fi
BACKUP_DIR="/opt/memento/backups"
SNAPSHOT_DIR="$BACKUP_DIR/snapshots"
PG_CONTAINER="memento-postgres"

View File

@@ -1,6 +1,13 @@
#!/bin/bash
set -euo pipefail
# Load environment variables from .env.docker if it exists
if [ -f "/opt/memento/.env.docker" ]; then
set -a
source "/opt/memento/.env.docker"
set +a
fi
BACKUP_DIR="/opt/memento/backups"
WAL_DIR="$BACKUP_DIR/wal"
PG_CONTAINER="memento-postgres"
@@ -19,13 +26,23 @@ log "=== Setting up WAL archiving ==="
docker exec "$PG_CONTAINER" bash -c "mkdir -p /var/lib/postgresql/backups/wal"
log "Configuring PostgreSQL WAL parameters..."
docker exec "$PG_CONTAINER" psql -U "$PG_USER" -d "$PG_DB" -c "ALTER SYSTEM SET wal_level = replica;"
docker exec "$PG_CONTAINER" psql -U "$PG_USER" -d "$PG_DB" -c "ALTER SYSTEM SET archive_mode = on;"
docker exec "$PG_CONTAINER" psql -U "$PG_USER" -d "$PG_DB" -c "ALTER SYSTEM SET archive_command = 'cp %p /var/lib/postgresql/backups/wal/%f';"
docker exec "$PG_CONTAINER" psql -U "$PG_USER" -d "$PG_DB" -c "ALTER SYSTEM SET max_wal_senders = 3;"
docker exec "$PG_CONTAINER" psql -U "$PG_USER" -d "$PG_DB" -c "ALTER SYSTEM SET wal_keep_size = '1GB';"
log "Reloading PostgreSQL configuration..."
log "Restarting PostgreSQL container to apply WAL parameters (required for wal_level)..."
docker restart "$PG_CONTAINER"
# Wait for PostgreSQL to be ready
log "Waiting for PostgreSQL to be ready..."
until docker exec "$PG_CONTAINER" pg_isready -U "$PG_USER" -d "$PG_DB" >/dev/null 2>&1; do
sleep 1
done
log "PostgreSQL is ready. Reloading config..."
docker exec "$PG_CONTAINER" psql -U "$PG_USER" -d "$PG_DB" -c "SELECT pg_reload_conf();"
log "WAL archiving enabled. Archives stored in /var/lib/postgresql/backups/wal/"

View File

@@ -1,6 +1,13 @@
#!/bin/bash
set -euo pipefail
# Load environment variables from .env.docker if it exists
if [ -f "/opt/memento/.env.docker" ]; then
set -a
source "/opt/memento/.env.docker"
set +a
fi
BACKUP_DIR="/opt/memento/backups"
SNAPSHOT_DIR="$BACKUP_DIR/snapshots"
PG_CONTAINER="memento-postgres"