-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
56 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ You'll need [docker](https://www.docker.com/) installed for running [local dynam | |
PROJECT_NAME: myproject.com | ||
REGION: ap-southeast-1 | ||
PROFILE: dev | ||
FIRST_USER_EMAIL: [email protected] | ||
``` | ||
`PROJECT_NAME` will be referenced in all resources used in AWS. It must be unique with only letters and numbers. It should also be unique for S3 bucket name and cognito pool client domain usage. I recommend using a subdomain like `admin-dev.myproject.com`. | ||
|
@@ -51,7 +52,7 @@ You'll need [docker](https://www.docker.com/) installed for running [local dynam | |
3. Run local setup script | ||
|
||
```bash | ||
yarn setup:local [email protected] | ||
yarn setup:local | ||
``` | ||
|
||
This will create cognito resources in your AWS account and then run a local dynamodb. | ||
|
@@ -93,6 +94,7 @@ Here are the services that will be running: | |
UPLOAD_BUCKET: admin-upload.myproject.com | ||
REGION: ap-southeast-1 | ||
PROFILE: my-production-profile | ||
FIRST_USER_EMAIL: [email protected] | ||
``` | ||
|
||
`PROJECT_NAME` will be referenced in all resources used in AWS. It must be unique with only letters and numbers. It should also be unique for S3 bucket name and cognito pool client domain usage. I recommend using a subdomain like `admin.myproject.com`. | ||
|
@@ -106,7 +108,7 @@ Here are the services that will be running: | |
3. Run deploy script | ||
|
||
```bash | ||
yarn deploy prod [email protected] | ||
yarn deploy prod | ||
``` | ||
|
||
The script will take about 20 minutes to finish to provisioning everything. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ PROJECT_NAME: admin.myproject.com | |
UPLOAD_BUCKET: admin-upload.myproject.com | ||
REGION: ap-southeast-1 | ||
PROFILE: my-profile | ||
FIRST_USER_EMAIL: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
#!/bin/bash | ||
|
||
SEARCH_KEY="PROJECT_NAME: " | ||
PROJECT=$(grep "$SEARCH_KEY" ../config/$STAGE.yml | sed -e "s/^$SEARCH_KEY//") | ||
export PROJECT=$(grep "$SEARCH_KEY" ../config/$STAGE.yml | sed -e "s/^$SEARCH_KEY//") | ||
|
||
SEARCH_KEY="UPLOAD_BUCKET: " | ||
UPLOAD_BUCKET=$(grep "$SEARCH_KEY" ../config/$STAGE.yml | sed -e "s/^$SEARCH_KEY//") | ||
export UPLOAD_BUCKET=$(grep "$SEARCH_KEY" ../config/$STAGE.yml | sed -e "s/^$SEARCH_KEY//") | ||
|
||
SEARCH_KEY="REGION: " | ||
REGION=$(grep "$SEARCH_KEY" ../config/$STAGE.yml | sed -e "s/^$SEARCH_KEY//") | ||
export REGION=$(grep "$SEARCH_KEY" ../config/$STAGE.yml | sed -e "s/^$SEARCH_KEY//") | ||
|
||
SEARCH_KEY="PROFILE: " | ||
PROFILE=$(grep "$SEARCH_KEY" ../config/$STAGE.yml | sed -e "s/^$SEARCH_KEY//") | ||
export PROFILE=$(grep "$SEARCH_KEY" ../config/$STAGE.yml | sed -e "s/^$SEARCH_KEY//") | ||
|
||
SEARCH_KEY="FIRST_USER_EMAIL: " | ||
export FIRST_USER_EMAIL=$(grep "$SEARCH_KEY" ../config/$STAGE.yml | sed -e "s/^$SEARCH_KEY//") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,12 +11,12 @@ NC='\033[0m' # No Color | |
if [ -z "$1" ] | ||
then | ||
echo -e "\nThis script will deploy the CMS.\n" | ||
echo -e "Usage: deploy.sh ${BLUE}<stage> <email>${NC}\n" | ||
echo -e "Example: deploy.sh prod [email protected]\n" | ||
echo -e "Usage: deploy.sh ${BLUE}<stage>${NC}\n" | ||
echo -e "Example: deploy.sh prod\n" | ||
exit 1 | ||
fi | ||
|
||
STAGE=$1 | ||
export STAGE=$1 | ||
CONFIG_FILE=./config/$STAGE.yml | ||
|
||
if [ ! -f $CONFIG_FILE ] | ||
|
@@ -25,26 +25,36 @@ if [ ! -f $CONFIG_FILE ] | |
exit 1 | ||
fi | ||
|
||
if [ -z "$2" ] | ||
then | ||
echo -e "\nMissing ${RED}email${NC}\n" | ||
exit 1 | ||
fi | ||
# Change to script dir | ||
cd "$(dirname "$0")" | ||
source ./config-to-env.sh | ||
|
||
# Export AWS Profile to use | ||
export AWS_PROFILE=$PROFILE | ||
export AWS_REGION=$REGION | ||
export ABU_STAGE=$STAGE | ||
|
||
# Change to root dir | ||
cd .. | ||
|
||
yarn workspace infra cdk bootstrap | ||
yarn workspace infra build | ||
yarn workspace infra deploy | ||
|
||
EMAIL=$2 | ||
exit 0 | ||
|
||
# Run setup | ||
./scripts/setup-stage.sh $STAGE $EMAIL | ||
# # Run setup | ||
# ./scripts/setup-stage.sh $STAGE | ||
|
||
# update lambda memory and timeout | ||
./scripts/update-lambda-edge.sh $STAGE | ||
# # update lambda memory and timeout | ||
# ./scripts/update-lambda-edge.sh $STAGE | ||
|
||
# Build API | ||
yarn build:api | ||
# # Build API | ||
# yarn build:api | ||
|
||
# Run deploy api | ||
yarn deploy:api $STAGE | ||
# # Run deploy api | ||
# yarn deploy:api $STAGE | ||
|
||
# Run deploy cms | ||
yarn deploy:cms $STAGE | ||
# # Run deploy cms | ||
# yarn deploy:cms $STAGE | ||
|