-
Notifications
You must be signed in to change notification settings - Fork 7
WIP: Use ebs volume with backup #111
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!
Please see comments and text corrections.
Also, I'm a bit concerned that we don't have any error checks after "attach", "extract", and "detach" steps – if some steps fails, are we sure that the process will be interrupted and everything will be cleaned up? Maybe it's worth to have explicit checks for each step.
# None | ||
####################################### | ||
function dettach_db_ebs_drive() { | ||
docker_exec bash -c "umount /backup" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if this fails? (it can – if we still use it, for example)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Диск останется подключенным, как это лучше обработать пока нет идей.
nancy_run.sh
Outdated
apply_sql_before_db_restore | ||
restore_dump | ||
if [[ -z ${DB_EBS_VOLUME_ID+x} ]]; then | ||
restore_dump; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no ;
nancy_run.sh
Outdated
msg " docker-machine ssh $DOCKER_MACHINE" | ||
|
||
if [[ "$RUN_ON" == "aws" ]] && [[ ! -z ${DB_EBS_VOLUME_ID+x} ]]; then | ||
attach_db_ebs_drive; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no ;
nancy_run.sh
Outdated
msg "Extract database backup from EBS volume" | ||
docker_exec bash -c "rm -rf /var/lib/postgresql/9.6/main/*" | ||
|
||
local op_start_time=$(date +%s); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need in ;
nancy_run.sh
Outdated
result=$(docker_exec bash -c "([[ -f /backup/pg_wal.tar ]] \ | ||
&& tar -C /storage/postgresql/$PG_VERSION/main/pg_wal -xvf /backup/pg_wal.tar) || true") | ||
|
||
local end_time=$(date +%s); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need in ;
} | ||
|
||
if [[ ! -z ${DB_EBS_VOLUME_ID+x} ]] && [[ ! "$DB_NAME" == "test" ]]; then | ||
docker_exec bash -c "psql --set ON_ERROR_STOP=on -U postgres -c 'drop database if exists test;'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's just remove this step?
if it exists and $DB_NAME = test
, the following line (rename) will just do nothing and we'll proceed.
No description provided.