forked from linnealovespie/baserow
Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c77c17608f | |||
| 60a9a35e31 | |||
| 065357a1f9 | |||
| d8654ee02d | |||
| 0b489b7797 | |||
| 2844bc06cb | |||
| 19a867a6aa | |||
| 9c795ec4d2 | |||
| 4e8b4de017 | |||
| 3cece29758 | |||
| 1b04cfa554 | |||
| ad43624925 | |||
| 8d8676bde7 | |||
| 630d08f506 | |||
| b03cc94e5e | |||
| 9978d84d16 | |||
| d5af00327f | |||
| 679bcc4ce8 | |||
| 563641ac48 | |||
|
aaa0711fa4
|
|||
| 30e84c7733 | |||
| e9e606a33a | |||
| 6a0711aba7 | |||
| a2d5028661 | |||
| 818ec9bc13 | |||
|
af3d655c8f
|
|||
| 1936226bf5 | |||
| 0865766102 | |||
| 475484928f | |||
| 3158926e7b | |||
| 8ae0634c82 | |||
| ca1e0ec1c3 | |||
| 14b65c2ecd | |||
| c5994bd7e4 | |||
| 136ad45cfb | |||
| 26e98e915d | |||
| aa6b8472f5 | |||
| f19c498001 | |||
| db18e08971 |
@@ -28,5 +28,4 @@ LETS_ENCRYPT_ENV=production
|
||||
|
||||
SECRET_SECRET_KEY_VERSION=v1
|
||||
SECRET_JWT_KEY_VERSION=v1
|
||||
SECRET_DB_PASSWORD_VERSION=v1
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
if [ "$1" == "pre-backup" ]; then
|
||||
# Remove any existing db dump and then create a new one
|
||||
rm -rf $DATA_DIR/postgres/postgres-backup
|
||||
source /baserow/data/.pgpass
|
||||
PGPASSWORD=$DATABASE_PASSWORD pg_dump -j 2 -h localhost -U baserow baserow --format=directory -f $DATA_DIR/postgres/postgres-backup
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$1" == "post-backup" ]; then
|
||||
# rm -rf $DATA_DIR/postgres/postgres-backup
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$1" == "pre-restore" ]; then
|
||||
pkill -STOP -f "webfrontend"
|
||||
pkill -STOP -f "celery"
|
||||
pkill -STOP -f "caddy"
|
||||
|
||||
# Disconnect any remaining idle sessions from the 'baserow' database
|
||||
# This prevents "database is being accessed by other users" errors during pg_restore -c
|
||||
source /baserow/data/.pgpass
|
||||
PGPASSWORD=$DATABASE_PASSWORD psql -h localhost -U baserow -d postgres -c "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'baserow' AND pid <> pg_backend_pid();"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$1" == "post-restore" ]; then
|
||||
source /baserow/data/.pgpass
|
||||
PGPASSWORD=$DATABASE_PASSWORD pg_restore -j 2 -h localhost -U baserow -d baserow -c $DATA_DIR/postgres/postgres-backup
|
||||
pkill -CONT -f "webfrontend"
|
||||
pkill -CONT -f "celery"
|
||||
pkill -CONT -f "caddy"
|
||||
exit
|
||||
fi
|
||||
+13
-47
@@ -3,26 +3,18 @@ version: "3.8"
|
||||
|
||||
services:
|
||||
app:
|
||||
image: baserow/baserow:1.35.3
|
||||
depends_on:
|
||||
- db
|
||||
image: baserow/baserow:2.3.3
|
||||
networks:
|
||||
- proxy
|
||||
- internal
|
||||
environment:
|
||||
- BASEROW_PUBLIC_URL=https://${DOMAIN}
|
||||
- SECRET_KEY_FILE=/run/secrets/secret_key
|
||||
- BASEROW_JWT_SIGNING_KEY_FILE=/run/secrets/jwt_key
|
||||
- BASEROW_CADDY_ADDRESSES=:80
|
||||
- BASEROW_BUILDER_DOMAINS=${WILDCARD_DOMAIN}
|
||||
- DATABASE_HOST=db
|
||||
- DATABASE_NAME=postgres
|
||||
- DATABASE_USER=postgres
|
||||
- DATABASE_PASSWORD_FILE=/run/secrets/db_password
|
||||
secrets:
|
||||
- secret_key
|
||||
- jwt_key
|
||||
- db_password
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
@@ -38,7 +30,10 @@ services:
|
||||
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
|
||||
- "backupbot.backup=true"
|
||||
- "backupbot.backup.path=/baserow/data"
|
||||
- "coop-cloud.${STACK_NAME}.version=1.2.0+1.35.3"
|
||||
- "backupbot.backup.pre-hook=/backup.sh pre-backup"
|
||||
- "backupbot.backup.post-hook=/backup.sh post-backup"
|
||||
- "backupbot.restore.post-hook=/backup.sh post-restore"
|
||||
- "coop-cloud.${STACK_NAME}.version=2.3.3+2.3.3"
|
||||
healthcheck:
|
||||
test: ["CMD", "./baserow.sh", "backend-cmd", "backend-healthcheck"]
|
||||
interval: 30s
|
||||
@@ -47,43 +42,22 @@ services:
|
||||
start_period: 1m
|
||||
volumes:
|
||||
- baserow_data:/baserow/data
|
||||
db:
|
||||
image: postgres:15
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
environment:
|
||||
- POSTGRES_USER=postgres
|
||||
- POSTGRES_PASSWORD_FILE=/run/secrets/db_password
|
||||
- POSTGRES_DB=postgres
|
||||
networks:
|
||||
internal:
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
labels:
|
||||
backupbot.backup.pre-hook: "/pg_backup.sh backup"
|
||||
backupbot.backup.volumes.postgres.path: "backup.sql"
|
||||
backupbot.restore.post-hook: '/pg_backup.sh restore'
|
||||
configs:
|
||||
- source: pg_backup
|
||||
target: /pg_backup.sh
|
||||
mode: 0555
|
||||
secrets:
|
||||
- db_password
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready", "-U", "postgres"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
- source: backup-postgres
|
||||
target: /backup.sh
|
||||
mode: 0777
|
||||
|
||||
volumes:
|
||||
baserow_data:
|
||||
postgres_data:
|
||||
|
||||
configs:
|
||||
backup-postgres:
|
||||
name: ${STACK_NAME}_backup-postgres_${PG_BACKUP_CONFIG_VERSION}
|
||||
file: ./backup-postgres.sh
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
external: true
|
||||
internal:
|
||||
|
||||
secrets:
|
||||
secret_key:
|
||||
@@ -92,11 +66,3 @@ secrets:
|
||||
jwt_key:
|
||||
external: true
|
||||
name: ${STACK_NAME}_jwt_key_${SECRET_JWT_KEY_VERSION}
|
||||
db_password:
|
||||
external: true
|
||||
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
|
||||
|
||||
configs:
|
||||
pg_backup:
|
||||
name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
|
||||
file: pg_backup.sh
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
BACKUP_FILE='/var/lib/postgresql/data/backup.sql'
|
||||
|
||||
function backup {
|
||||
export PGPASSWORD=$(cat /run/secrets/db_password)
|
||||
pg_dump -U ${POSTGRES_USER} ${POSTGRES_DB} > $BACKUP_FILE
|
||||
}
|
||||
|
||||
function restore {
|
||||
cd /var/lib/postgresql/data/
|
||||
restore_config(){
|
||||
# Restore allowed connections
|
||||
cat pg_hba.conf.bak > pg_hba.conf
|
||||
su postgres -c 'pg_ctl reload'
|
||||
}
|
||||
# Don't allow any other connections than local
|
||||
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
|
||||
psql -U ${POSTGRES_USER} -d postgres -c "DROP DATABASE ${POSTGRES_DB} WITH (FORCE);"
|
||||
createdb -U ${POSTGRES_USER} ${POSTGRES_DB}
|
||||
psql -U ${POSTGRES_USER} -d ${POSTGRES_DB} -1 -f $BACKUP_FILE
|
||||
|
||||
trap - EXIT INT TERM
|
||||
restore_config
|
||||
}
|
||||
|
||||
$@
|
||||
@@ -0,0 +1 @@
|
||||
Backup/restore of the postgres database backend will now use pg_dump and pg_restore
|
||||
@@ -0,0 +1,3 @@
|
||||
= 1 Breaking Change =
|
||||
|
||||
[Builder] Data source now return content with human property names instead of technical ones #4135
|
||||
@@ -0,0 +1,3 @@
|
||||
See release notes here ->
|
||||
|
||||
https://baserow.io/blog/baserow-2-2-release-notes
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:recommended"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user