Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Conversation

dmius
Copy link
Collaborator

@dmius dmius commented Sep 20, 2018

No description provided.

@dmius dmius requested a review from NikolayS September 20, 2018 14:47
@NikolayS NikolayS changed the title Use ebs volume with backup WIP: Use ebs volume with backup Sep 23, 2018
Copy link
Collaborator

@NikolayS NikolayS left a 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"
Copy link
Collaborator

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)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Диск останется подключенным, как это лучше обработать пока нет идей.

@ane4ka ane4ka mentioned this pull request Sep 24, 2018
nancy_run.sh Outdated
apply_sql_before_db_restore
restore_dump
if [[ -z ${DB_EBS_VOLUME_ID+x} ]]; then
restore_dump;
Copy link
Collaborator

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;
Copy link
Collaborator

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);
Copy link
Collaborator

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);
Copy link
Collaborator

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;'"
Copy link
Collaborator

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.

@dmius dmius merged commit 43fc165 into master Sep 26, 2018
@dmius dmius deleted the dmius-use-ebs-vol branch September 26, 2018 14:02
dmius added a commit that referenced this pull request Oct 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants