Skip to content

Commit

Permalink
Update s3 bucket and file marching logic for mongo replication
Browse files Browse the repository at this point in the history
We no longer have mongo-normal direcorty in the
govuk-integration-database-backups s3 bucket. Those are now in
shared-documentdb.

The file matching also stopped returning file name. It was not updated to match
the end of the expression with `\>`
  • Loading branch information
AgaDufrat committed Jan 25, 2024
1 parent 47c5f91 commit 1ed1231
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/replicate-mongodb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ case "$app" in
database="${app//-/_}_production"
;;
"asset-manager")
hostname=mongo-normal
hostname=shared-documentdb
database=govuk_assets_production
;;
*)
hostname=mongo-normal
hostname=shared-documentdb
database="${app//-/_}_production"
;;
esac
Expand All @@ -49,7 +49,7 @@ if [[ -e "$archive_path" ]]; then
echo "Skipping download - remove ${archive_path} to force a new download on the next run"
else
mkdir -p "$archive_dir"
remote_file_name=$(aws s3 ls "s3://${bucket}/${hostname}/" | grep "[[:digit:]]-$database.gz" | tail -n1 | sed 's/^.* .* .* //')
remote_file_name=$(aws s3 ls "s3://${bucket}/${hostname}/" | grep -e "-$database.gz\>" | tail -n1 | sed 's/^.* .* .* //')
aws s3 cp "s3://${bucket}/${hostname}/${remote_file_name}" "$archive_path"
fi

Expand Down

0 comments on commit 1ed1231

Please sign in to comment.