Skip to content

Commit

Permalink
chore: Better log and options
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Christie committed Jan 4, 2024
1 parent b81be07 commit dec6f26
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions sql-backup/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,21 @@ if [ -v BACKUP_VOLUME_IS_S3 ]; then
# i.e. is BACKUP_VOLUME_S3_URL or BACKUP_VOLUME_S3_REQUEST_STYLE defined?
S3FS_EXTRA_OPTIONS=""
if [ -n "$BACKUP_VOLUME_S3_URL" ]; then
echo "--] s3fs BACKUP_VOLUME_S3_URL=${BACKUP_VOLUME_S3_URL}"
S3FS_EXTRA_OPTIONS+="-o url=${BACKUP_VOLUME_S3_URL}"
fi
if [ -n "$BACKUP_VOLUME_S3_REQUEST_STYLE" ]; then
echo "--] s3fs BACKUP_VOLUME_S3_REQUEST_STYLE=${BACKUP_VOLUME_S3_REQUEST_STYLE}"
S3FS_EXTRA_OPTIONS+=" -o ${BACKUP_VOLUME_S3_REQUEST_STYLE}"
fi

# Create the target directory ('/backup')
# and then invoke s3fs
mkdir -p /backup
S3FS_CMD_OPTIONS="/backup -o passwd_file=/tmp/.passwd-s3fs ${S3FS_EXTRA_OPTIONS}"
S3FS_CMD_OPTIONS="-o passwd_file=/tmp/.passwd-s3fs ${S3FS_EXTRA_OPTIONS}"
echo "--] s3fs AWS_BUCKET_NAME=${AWS_BUCKET_NAME}"
echo "--] s3fs S3FS_CMD_OPTIONS=${S3FS_CMD_OPTIONS}"
s3fs ${AWS_BUCKET_NAME} ${S3FS_CMD_OPTIONS}
s3fs ${AWS_BUCKET_NAME} /backup ${S3FS_CMD_OPTIONS}

# And then wait (to avoid weird /backup root directories not existing)
echo "--] Sleeping for 4 seconds..."
Expand Down
6 changes: 4 additions & 2 deletions sql-recovery/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,21 @@ if [ -v BACKUP_VOLUME_IS_S3 ]; then
# i.e. is BACKUP_VOLUME_S3_URL or BACKUP_VOLUME_S3_REQUEST_STYLE defined?
S3FS_EXTRA_OPTIONS=""
if [ -n "$BACKUP_VOLUME_S3_URL" ]; then
echo "--] s3fs BACKUP_VOLUME_S3_URL=${BACKUP_VOLUME_S3_URL}"
S3FS_EXTRA_OPTIONS+="-o url=${BACKUP_VOLUME_S3_URL}"
fi
if [ -n "$BACKUP_VOLUME_S3_REQUEST_STYLE" ]; then
echo "--] s3fs BACKUP_VOLUME_S3_REQUEST_STYLE=${BACKUP_VOLUME_S3_REQUEST_STYLE}"
S3FS_EXTRA_OPTIONS+=" -o ${BACKUP_VOLUME_S3_REQUEST_STYLE}"
fi

# Create the target directory ('/backup')
# and then invoke s3fs
mkdir -p /backup
S3FS_CMD_OPTIONS="/backup -o passwd_file=/tmp/.passwd-s3fs ${S3FS_EXTRA_OPTIONS}"
S3FS_CMD_OPTIONS="-o passwd_file=/tmp/.passwd-s3fs ${S3FS_EXTRA_OPTIONS}"
echo "--] s3fs AWS_BUCKET_NAME=${AWS_BUCKET_NAME}"
echo "--] s3fs S3FS_CMD_OPTIONS=${S3FS_CMD_OPTIONS}"
s3fs ${AWS_BUCKET_NAME} ${S3FS_CMD_OPTIONS}
s3fs ${AWS_BUCKET_NAME} /backup ${S3FS_CMD_OPTIONS}

# And then wait (to avoid weird /backup root directories not existing)
echo "--] Sleeping for 4 seconds..."
Expand Down

0 comments on commit dec6f26

Please sign in to comment.