diff --git a/pica-db-backup/postgres-run.sh b/pica-db-backup/postgres-run.sh index ab13139cbd3faf0b193f6040fe39c836aa3b3ca5..a06d7d36e45b96a9fc79075adc8b9df60946b859 100755 --- a/pica-db-backup/postgres-run.sh +++ b/pica-db-backup/postgres-run.sh @@ -10,7 +10,8 @@ BACKUP_FOLDER=${BACKUP_FOLDER:-"/backup/"} ping -c 1 -W 1 "${POSTGRES_HOST}" || { echo -e "\n=========== ${POSTGRES_HOST} not available, skipping backup... ===========\n"; exit 1; } -BACKUP_CMD="pg_dump -w -c > $BACKUP_FOLDER"'${BACKUP_NAME}' +BACKUP_CMD="pg_dump -w -c --format=c > $BACKUP_FOLDER"'${BACKUP_NAME}' +RESTORE_CMD="pg_restore -c \$1" # Make sure backup folder exists mkdir -p "${BACKUP_FOLDER}" @@ -31,13 +32,10 @@ export PGUSER=$POSTGRES_USER export PGPASSWORD=$POSTGRES_PASS DATE=\$(date +\%Y.\%m.\%d.\%H\%M\%S) -BACKUP_NAME=\$DATE.sql +BACKUP_NAME=\$DATE.dump echo "=> ${POSTGRES_SERVICE_NAME}: Backup started: \${BACKUP_NAME}" if ${BACKUP_CMD} ;then - echo " => Compress files $BACKUP_FOLDER\$DATE.tar.gz" - tar -czvf $BACKUP_FOLDER\$DATE.tar.gz $BACKUP_FOLDER\${BACKUP_NAME} && \ - rm -rf $BACKUP_FOLDER\$BACKUP_NAME && \ echo "${POSTGRES_SERVICE_NAME}: Backup succeeded" else echo "${POSTGRES_SERVICE_NAME}: Backup failed" @@ -64,14 +62,11 @@ export PGUSER=$POSTGRES_USER export PGPASSWORD=$POSTGRES_PASS echo "=> ${POSTGRES_SERVICE_NAME}: Restore database from \$1" -tar -xzvf \$1 -output="\$(echo \$1 | awk -F'.tar.gz' '{print \$1".sql"}')" -if psql < \$output ;then +if ${RESTORE_CMD} ;then echo "${POSTGRES_SERVICE_NAME}: Restore succeeded" else echo "${POSTGRES_SERVICE_NAME}: Restore failed" fi -rm -Rf \$output EOF chmod +x /$restore_script_name diff --git a/pica-mattermost/Dockerfile b/pica-mattermost/Dockerfile index 93682d5e09c5e44994b25b9cb09fe4dc823e5450..1867c5b17bd0fbb139eec78c4337324c75bec3a7 100644 --- a/pica-mattermost/Dockerfile +++ b/pica-mattermost/Dockerfile @@ -35,7 +35,7 @@ RUN mkdir -p /mattermost/data /mattermost/plugins /mattermost/client/plugins \ && setcap cap_net_bind_service=+ep /mattermost/bin/mattermost #Healthcheck to make sure container is ready -HEALTHCHECK --interval=5m --timeout=3s CMD curl --fail http://localhost:8000//api/v4/system/ping || exit 1 +HEALTHCHECK --interval=20s --timeout=3s CMD curl --fail http://localhost:8000//api/v4/system/ping || exit 1 # Configure entrypoint and command COPY entrypoint.sh /