Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
executable file
·
74 lines (61 loc) · 1.8 KB

File metadata and controls

executable file
·
74 lines (61 loc) · 1.8 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
set -e
if [[ -n "${RF_DEBUG}" ]]; then
set -x
fi
source "scripts/update"
DIR="$(dirname "$0")"
function usage() {
echo -n \
"Usage: $(basename "$0") [--download]
Load the database dump located at data/database.pgdump if present.
Otherwise, downloads the dump from S3. If the download flag is used, ignores
and overwrites the existing dump.
"
}
function download_database_backup() {
pushd "${DIR}/.."
echo "Downloading database from s3"
mkdir -p data
aws s3 cp s3://rasterfoundry-development-data-us-east-1/granary/database.pgdump data/database.pgdump
popd
}
function download_data {
pushd "${DIR}/.."
echo "Downloading data from s3"
mkdir -p data
aws s3 sync s3://rasterfoundry-development-data-us-east-1/granary/data/ data/
popd
}
function load_database_backup() {
docker-compose up -d database
sleep 1
echo "Drop granary database"
docker-compose \
exec -T database dropdb -U granary granary
echo "Create granary database"
docker-compose \
exec -T database createdb -U granary granary
echo "Restore database from backup"
# Command to create database backup
# docker-compose \
# exec -T database pg_dump -U granary -Fc granary > /tmp/data/database.pgdump
# aws s3 cp data/database.pgdump s3://rasterfoundry-development-data-us-east-1/granary/database.pgdump
docker-compose \
exec -T database pg_restore -U granary -Fc -d granary /tmp/data/database.pgdump
./scripts/migrate migrate
}
if [ "${BASH_SOURCE[0]}" = "${0}" ]
then
if [ "${1:-}" = "--help" ]
then
usage
else
if [ "${1:-}" = "--download" ] || [ ! -f data/database.pgdump ]; then
download_database_backup
download_data
fi
load_database_backup
fi
exit
fi
Morty Proxy This is a proxified and sanitized view of the page, visit original site.