Skip to content
This repository has been archived by the owner on Apr 29, 2022. It is now read-only.

Commit

Permalink
fix backup script
Browse files Browse the repository at this point in the history
  • Loading branch information
sballesteros committed Dec 14, 2019
1 parent 021b14b commit b0e9dc8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,9 @@ the databases)**.

##### Azure

Visit https://portal.azure.com/ All the resources we used are defined in a
`rapid-prereview` resource group.

1. Install Azure CLI (see
https://docs.microsoft.com/en-us/cli/azure/?view=azure-cli-latest)
2. Run `az login` to login to the CLI
Expand All @@ -386,10 +389,8 @@ Some basic info about the service health can be found at https://rapid-prereview

Backups are stored in a blob storage container on azure.

- Install AzCopy see
https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-v10
(on a mac you can put the binary in `/usr/local/bin` so it's available in the
PATH.
- run `azcopy login` to authenticate
- run `npm run backup` **Be aware that this will source the production
1. Install Azure CLI (see
https://docs.microsoft.com/en-us/cli/azure/?view=azure-cli-latest)
2. Run `az login` to login to the CLI
3. Run `npm run backup` **Be aware that this will source the production
environment variables.**
9 changes: 8 additions & 1 deletion backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

COUCH_URL=${COUCH_PROTOCOL}//${COUCH_USERNAME}:${COUCH_PASSWORD}@${COUCH_HOST}:${COUCH_PORT}

## TODO pipe to azcopy
npx couchbackup --url ${COUCH_URL} --db rapid-prereview-index | gzip > rapid-prereview-index.txt.gz
npx couchbackup --url ${COUCH_URL} --db rapid-prereview-docs | gzip > rapid-prereview-docs.txt.gz
npx couchbackup --url ${COUCH_URL} --db rapid-prereview-users | gzip > rapid-prereview-users.txt.gz

az storage blob upload --account-name rapidprereviewprivate --container-name "rapid-prereview-backups" --name "rapid-prereview-index.txt.gz" --file "rapid-prereview-index.txt.gz"
az storage blob upload --account-name rapidprereviewprivate --container-name "rapid-prereview-backups" --name "rapid-prereview-docs.txt.gz" --file "rapid-prereview-docs.txt.gz"
az storage blob upload --account-name rapidprereviewprivate --container-name "rapid-prereview-backups" --name "rapid-prereview-users.txt.gz" --file "rapid-prereview-users.txt.gz"

rm rapid-prereview-index.txt.gz
rm rapid-prereview-docs.txt.gz
rm rapid-prereview-users.txt.gz

0 comments on commit b0e9dc8

Please sign in to comment.