Now it works - except it doesn't. Maybe I shouldn't hide the error in the compactor.
Some checks are pending
CI/CD / build-backup-job (push) Waiting to run
CI/CD / build-and-test-backend (push) Waiting to run

This commit is contained in:
Felipe Cotti 2025-01-27 02:31:12 -03:00
parent 98c58363d9
commit c28dc06816
3 changed files with 4 additions and 6 deletions

View file

@ -16,4 +16,3 @@ BACKUP_S3_ACCESS_ID=0000000000000000000000000
BACKUP_S3_SECRET_ID=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA BACKUP_S3_SECRET_ID=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BACKUP_S3_ENDPOINT=https://s3.us-east-005.backblazeb2.com BACKUP_S3_ENDPOINT=https://s3.us-east-005.backblazeb2.com
BACKUP_S3_REGION=us-east-005 BACKUP_S3_REGION=us-east-005
BACKUP_SOURCE_PATH=/backups/guestbooky_$(date +\%Y-\%m-\%d)

View file

@ -66,7 +66,7 @@ services:
--username ${GUESTBOOKY_USER} --username ${GUESTBOOKY_USER}
--password ${GUESTBOOKY_USER} --password ${GUESTBOOKY_USER}
--authenticationDatabase ${GUESTBOOKY_DB_NAME} --authenticationDatabase ${GUESTBOOKY_DB_NAME}
--out ${BACKUP_SOURCE_PATH} && touch /backups/backup_done" --out /backups/guestbooky_$(date +\%Y-\%m-\%d) && touch /backups/backup_done"
volumes: volumes:
- ./backups:/backups - ./backups:/backups
depends_on: depends_on:
@ -88,10 +88,9 @@ services:
BACKUP_S3_SECRET_ID: ${BACKUP_S3_SECRET_ID} BACKUP_S3_SECRET_ID: ${BACKUP_S3_SECRET_ID}
BACKUP_S3_ENDPOINT: ${BACKUP_S3_ENDPOINT} BACKUP_S3_ENDPOINT: ${BACKUP_S3_ENDPOINT}
BACKUP_S3_REGION: ${BACKUP_S3_REGION} BACKUP_S3_REGION: ${BACKUP_S3_REGION}
BACKUP_SOURCE_PATH: ${BACKUP_SOURCE_PATH}
BACKUP_DESTINATION_PATH: ${BACKUP_SOURCE_PATH}.gzip
volumes: volumes:
- ./backups:/backups - ./backups:/backups
command: sh -c "export BACKUP_SOURCE_PATH=/backups/guestbooky_$(date +\%Y-\%m-\%d) && export BACKUP_DESTINATION_PATH=/backups/guestbooky_$(date +\%Y-\%m-\%d).gzip && /root/guestbooky-backup"
volumes: volumes:
mongodata: mongodata:

View file

@ -34,7 +34,7 @@ func Compact(source, destination string) error {
defer zipWriter.Close() defer zipWriter.Close()
if _, err := io.Copy(zipWriter, originFileHandle); err != nil { if _, err := io.Copy(zipWriter, originFileHandle); err != nil {
return errors.New("failed to copy file") return errors.New("failed to copy zip to destination file: " + err.Error()) //nolint:wraperr
} }
return nil return nil