-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·72 lines (66 loc) · 2.73 KB
/
entrypoint.sh
File metadata and controls
executable file
·72 lines (66 loc) · 2.73 KB
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
#!/bin/bash
set -e
case "$1" in
postgres)
echo $POSTGRES_URI:5432:*:postgres:$POSTGRES_PASSWORD > $HOME/.pgpass
chmod 0600 /root/.pgpass
echo "Starting auto postgres backup"
/cronjobs/autopostgresbackup.sh
echo "Syncing to $AWS_BACKUPS_BUCKET_URI/postgres"
aws s3 sync /cronjobs/backups/postgres "$AWS_BACKUPS_BUCKET_URI/postgres"
rm -rf /cronjobs/backups/postgres/*
;;
neo4j)
echo "Starting auto neo backup"
/cronjobs/autoneobackup.sh || true
echo "Syncing to $AWS_BACKUPS_BUCKET_URI/neo4j"
aws s3 sync /cronjobs/backups/neo4j "$AWS_BACKUPS_BUCKET_URI/neo4j"
rm -rf /cronjobs/backups/neo4j/*
;;
elasticsearch)
echo "Starting auto elastic backup"
/cronjobs/autoelasticbackup.py --host "$ES_URI" \
--snapshot wri-api-backups-es7 \
--role_arn "$ES_BACKUP_IAM_ROLE" \
--bucket "$AWS_BACKUPS_BUCKET_NAME" \
--base_path elasticsearch-7 \
|| true
;;
mongo)
echo "Starting auto mongo backup"
BACKUP_DIR="/cronjobs/backups/mongo"
# List of databases with default backup strategy
default_backups=("area"
"contextual-layers"
"dataset"
"doc-orchestrator"
"forms"
"geostore"
"layer"
"layerbackup"
"metadata"
"story"
"subscription"
"user"
"vocabulary"
"widget")
for db in "${default_backups[@]}"; do
/cronjobs/automongobackup.sh --dbhost "$MONGODB_URI" \
--dbname "$db" \
--backup_dir "$BACKUP_DIR" || true
echo "Syncing areas backup to $AWS_BACKUPS_BUCKET_URI/mongo"
aws s3 sync "$BACKUP_DIR" "$AWS_BACKUPS_BUCKET_URI/mongo"
done
# Databases with custom backup strategy
/cronjobs/automongobackup.sh --dbhost "$MONGODB_URI" \
--dbname control-tower \
--exclude_collection statistics \
--backup_dir "$BACKUP_DIR" || true
echo "Syncing areas backup to $AWS_BACKUPS_BUCKET_URI/mongo"
aws s3 sync "$BACKUP_DIR" "$AWS_BACKUPS_BUCKET_URI/mongo"
# Clean up
rm -rf ${BACKUP_DIR:?}/*
;;
*)
exec "$@"
esac