File tree 4 files changed +105
-12
lines changed
4 files changed +105
-12
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ STAGE=dev
4
+
5
+ show_help () {
6
+ cat << EOF
7
+ Usage: ${0##*/ } [-p]
8
+
9
+ By default, deploy to dev environment on AWS account 812644853088
10
+
11
+ -p PRODUCTION 192458993663
12
+ -d DEMO 915001051872
13
+ -l localhost
14
+
15
+ EOF
16
+ }
17
+
18
+ while getopts " pdl" opt
19
+ do
20
+ case $opt in
21
+ p)
22
+ echo " PRODUCTION" >&2
23
+ STAGE=prod
24
+ ;;
25
+ d)
26
+ echo " DEMO" >&2
27
+ STAGE=demo
28
+ ;;
29
+ l)
30
+ echo " localhost" >&2
31
+ STAGE=localhost
32
+ ;;
33
+ * )
34
+ show_help >&2
35
+ exit 1
36
+ ;;
37
+ esac
38
+ done
39
+ AWS_PROFILE=uneet-$STAGE
40
+ shift " $(( OPTIND- 1 )) " # Discard the options and sentinel --
41
+
42
+ if test $AWS_PROFILE == uneet-localhost
43
+ then
44
+ echo mongorestore -h 127.0.0.1 --drop --port 27017 $dir
45
+ else
46
+ MONGO_PASSWORD=$( aws --profile $AWS_PROFILE ssm get-parameters --names MONGO_PASSWORD --with-decryption --query Parameters[0].Value --output text)
47
+ MONGO_CONNECT=$( aws --profile $AWS_PROFILE ssm get-parameters --names MONGO_CONNECT --query Parameters[0].Value --output text)
48
+ mongodump --uri=" mongodb://root:$MONGO_PASSWORD @$MONGO_CONNECT " -o $( date " +$STAGE -%s" )
49
+ fi
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ STAGE=dev
4
+
5
+ show_help () {
6
+ cat << EOF
7
+ Usage: ${0##*/ } [-p]
8
+
9
+ By default, deploy to dev environment on AWS account 812644853088
10
+
11
+ -p PRODUCTION 192458993663
12
+ -d DEMO 915001051872
13
+ -l localhost
14
+
15
+ EOF
16
+ }
17
+
18
+ while getopts " pdl" opt
19
+ do
20
+ case $opt in
21
+ p)
22
+ echo " PRODUCTION" >&2
23
+ STAGE=prod
24
+ ;;
25
+ d)
26
+ echo " DEMO" >&2
27
+ STAGE=demo
28
+ ;;
29
+ l)
30
+ echo " localhost" >&2
31
+ STAGE=localhost
32
+ ;;
33
+ * )
34
+ show_help >&2
35
+ exit 1
36
+ ;;
37
+ esac
38
+ done
39
+ AWS_PROFILE=uneet-$STAGE
40
+ shift " $(( OPTIND- 1 )) " # Discard the options and sentinel --
41
+
42
+ dir=" $1 "
43
+ if ! test -d " $dir "
44
+ then
45
+ echo Please supply a backup directory argument
46
+ exit
47
+ fi
48
+
49
+ if test $AWS_PROFILE == uneet-localhost
50
+ then
51
+ echo mongorestore -h 127.0.0.1 --drop --port 27017 $dir
52
+ else
53
+ MONGO_PASSWORD=$( aws --profile $AWS_PROFILE ssm get-parameters --names MONGO_PASSWORD --with-decryption --query Parameters[0].Value --output text)
54
+ MONGO_CONNECT=$( aws --profile $AWS_PROFILE ssm get-parameters --names MONGO_CONNECT --query Parameters[0].Value --output text)
55
+ mongorestore --drop --uri=" mongodb://root:$MONGO_PASSWORD @$MONGO_CONNECT " $dir
56
+ fi
You can’t perform that action at this time.
0 commit comments