Skip to content

Commit 3c4ea33

Browse files
authored
Merge pull request #55 from silinternational/develop
Release 2.2.2
2 parents 9bc051e + c51d434 commit 3c4ea33

File tree

4 files changed

+60
-25
lines changed

4 files changed

+60
-25
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
start:
2+
echo This Makefile has no default action. Be specific.
3+
4+
do-full-recovery:
5+
docker-compose run --rm do-full-recovery

docker-compose.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,11 @@ services:
33
app:
44
build: .
55
volumes:
6-
- ./:/usr/src/app
6+
- ./:/usr/src/app
7+
8+
do-full-recovery:
9+
build: recovery/.
10+
volumes:
11+
- ./:/data
12+
working_dir: /data
13+
command: ./recovery/do-full-recovery.sh

recovery/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM node:10
2+
3+
# Install the AWS CLI
4+
RUN curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
5+
RUN unzip awscli-bundle.zip
6+
RUN ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
7+
8+
# Install the Serverless Framework
9+
RUN npm install -g serverless

recovery/do-full-recovery.sh

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,31 @@ echo "[Press Enter to continue] "
2424
read unusedVariable2
2525
echo ""
2626

27-
echo "*** WARNING ***"
28-
echo "You should ONLY run this from the root folder of your local copy of the "
29-
echo "Serverless MFA API's files. You are currently in the following folder: "
3027
echo ""
31-
pwd
28+
echo "--------------------- Configuring AWS CLI profiles ----------------------"
3229
echo ""
33-
echo "Please cancel this if that is not the appropriate folder. "
34-
echo "[Press Enter to continue] "
35-
read unusedVariable3
30+
31+
echo "Please enter the AWS Access Key ID/Secret for the source AWS account, "
32+
echo "which we will use to download the backup data from S3."
33+
echo ""
34+
echo "For the default region, use the region where the current Serverless MFA "
35+
echo "API is running (probably us-east-1). The Default output format can be "
36+
echo "left blank."
37+
aws configure --profile restore-s3-backups
3638
echo ""
3739

40+
echo "Now please enter the AWS Access Key ID/Secret for the target AWS "
41+
echo "account, which we will use to create the new copy of the Serverless MFA "
42+
echo "API. "
3843
echo ""
39-
echo "--------------------- Preparing to download backups ---------------------"
44+
echo "For the default region, use the region where you want to deploy the new "
45+
echo "copy of the Serverless MFA API (such as us-east-1, us-east-2, us-west-1, "
46+
echo "or us-west-2). The Default output format can be left blank."
47+
aws configure
4048
echo ""
4149

42-
echo "Which AWS CLI profile should we use to download the backup data from the "
43-
echo "existing Serverless MFA API that you are trying to recover? "
44-
echo "EXAMPLE: sourceAWSaccount-dynamodb-backup-manager-yourname"
45-
read awsProfileForDownloadingBackups
50+
echo ""
51+
echo "--------------------- Preparing to download backups ---------------------"
4652
echo ""
4753

4854
echo "What is the S3 bucket where those backups are stored? "
@@ -54,15 +60,15 @@ aws s3 sync \
5460
--delete \
5561
--acl private \
5662
--sse AES256 \
57-
--profile "${awsProfileForDownloadingBackups}" \
63+
--profile "restore-s3-backups" \
5864
"s3://${s3bucketToRestoreFrom}" \
5965
"recovery/TempCopyOfBackups/"
6066

6167
echo ""
6268
echo "------------- Installing serverless-mfa-api's dependencies --------------"
6369
echo ""
6470

65-
sudo npm i -g npm
71+
npm i -g npm
6672

6773
npm ci
6874

@@ -97,7 +103,7 @@ echo ""
97103
echo "---------------------- Installing backups library -----------------------"
98104
echo ""
99105

100-
sudo npm install gulp-cli -g
106+
npm install gulp-cli -g
101107

102108
if [ ! -d "./recovery/DynamoDbBackUp" ]; then
103109
cd ./recovery
@@ -121,6 +127,7 @@ echo ""
121127
echo "What name do you want to use for the new S3 Bucket where backups will be "
122128
echo "stored? "
123129
echo "EXAMPLE: targetAWSaccount.backups.dynamodb.${newServiceName}"
130+
echo "(but replace targetAWSaccount with the name of the target AWS account)"
124131
read newS3bucketName
125132
echo ""
126133

@@ -251,16 +258,23 @@ echo ""
251258
echo "---------------------- Finished setting up the new ----------------------"
252259
echo "--------------- Serverless MFA API with data from backups ---------------"
253260
echo ""
261+
echo " IMPORTANT! "
262+
echo ""
254263
echo "You can now update your systems that need to use this, giving them the "
255-
echo "new API Gateway URL (visible in the Serverless output a ways above this "
256-
echo "line, as well as in the AWS CloudFormation 'Service Endpoint' Output for "
257-
echo "the ${newServiceName}-${stage} stack) as the new value for their "
258-
echo "apiBaseUrl. (The apiKey and apiSecret will not have changed, since those "
259-
echo "were in the restored data.) "
260-
echo ""
261-
echo "If using this with our IdP-in-a-Box, you will need to update the "
262-
echo "mfa_totp_apibaseurl and mfa_u2f_apibaseurl Terraform variables for the "
263-
echo "ID Broker workspace of the applicable IdP."
264+
echo "new API Gateway URL. To find that... "
265+
echo ""
266+
echo "1. Sign in to the target AWS account. "
267+
echo "2. Go to CloudFormation. "
268+
echo "3. Find the ${newServiceName}-${stage} stack. "
269+
echo "4. In its Outputs section, find the 'Service Endpoint' URL. "
270+
echo "5. ADD A TRAILING SLASH and use that as the new value for the apiBaseUrl "
271+
echo " of any IdP that should use this new copy of the Serverless MFA API. "
272+
echo " (The apiKey and apiSecret will not have changed, since those were in "
273+
echo " the restored data.) "
274+
echo ""
275+
echo " If using this with our IdP-in-a-Box, you will do so by updating the "
276+
echo " mfa_totp_apibaseurl and mfa_u2f_apibaseurl Terraform variables for "
277+
echo " the ID Broker workspace of the applicable IdP."
264278
echo ""
265279
echo "========================================================================="
266280
echo ""

0 commit comments

Comments
 (0)