Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: release v5.17.0 #2249

Merged
merged 23 commits into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
600df97
chore(deps-dev): bump core-js from 3.14.0 to 3.15.0 (#2225)
dependabot[bot] Jun 22, 2021
52470f0
chore(deps-dev): bump @typescript-eslint/parser from 4.27.0 to 4.28.0…
dependabot[bot] Jun 22, 2021
77933c6
Merge pull request #2230 from opengovsg/release-v5.16.0
mantariksh Jun 22, 2021
6512a84
refactor(email-submission): encapsulate parsedResponses (#2206)
yong-jie Jun 22, 2021
4a91084
refactor: convert CsvMergedHeadersGenerator to typescript (#2080)
chowyiyin Jun 22, 2021
89af07f
feat(feature-manager): remove sms from feature manager (#2218)
mantariksh Jun 22, 2021
e6b163c
feat(feature-manager): remove spcp-myinfo from feature manager (#2222)
mantariksh Jun 22, 2021
aee42ee
refactor(feature-manager): delete remaining unused code (#2223)
mantariksh Jun 22, 2021
8d545d6
fix(deps): bump aws-sdk from 2.931.0 to 2.932.0 (#2237)
dependabot[bot] Jun 22, 2021
3228708
chore(deps-dev): bump @babel/preset-env from 7.14.5 to 7.14.7 (#2238)
dependabot[bot] Jun 22, 2021
6f63ca5
fix(deps): bump nocache from 3.0.0 to 3.0.1 (#2236)
dependabot[bot] Jun 23, 2021
9fc8c9e
feat(config): support env var config via dotenv
LoneRifle Jun 15, 2021
ac27242
build(ci): create .env files in EB with Param Store
LoneRifle Jun 23, 2021
b32a3fb
chore(deps-dev): bump @typescript-eslint/eslint-plugin (#2239)
dependabot[bot] Jun 23, 2021
d147ecc
test: fix flaky form feedback test (#2241)
mantariksh Jun 23, 2021
f22e59c
docs(script): add script to sync (has)AllowedEmailDomains (#2234)
karrui Jun 23, 2021
f8e8125
refactor(env): drive SSM name prefix by env var
LoneRifle Jun 23, 2021
b744da5
chore(deps-dev): bump core-js from 3.15.0 to 3.15.1 (#2243)
dependabot[bot] Jun 23, 2021
e41b690
chore(deps-dev): bump @types/node from 14.17.3 to 14.17.4 (#2245)
dependabot[bot] Jun 23, 2021
ef7d79f
docs(deploy): add information concerning SSM params
LoneRifle Jun 24, 2021
6df9a1c
Merge pull request #2194 from opengovsg/feat/config/dotenv
LoneRifle Jun 24, 2021
5237a0b
refactor: revert "refactor(email-submission): encapsulate parsedRespo…
mantariksh Jun 24, 2021
c01e980
chore: bump version to v5.17.0
karrui Jun 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
**/.elasticbeanstalk
**/node_modules
**/public/lib
**/.env
.eslintrc.json
.prettierrc.json
.travis.yml
41 changes: 41 additions & 0 deletions .ebextensions/env-file-creation.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Creates an .env file from AWS SSM Parameter Store

commands:
01-create-env:
command: "/tmp/create-env.sh"

files:
"/tmp/create-env.sh":
mode: "000755"
content : |
#!/bin/bash
# Reach into the undocumented container config
AWS_REGION='`{"Ref": "AWS::Region"}`'
ENV_NAME=$(/opt/elasticbeanstalk/bin/get-config environment -k SSM_PREFIX)
TARGET_DIR=/etc/formsg

echo "Checking if ${TARGET_DIR} exists..."
if [ ! -d ${TARGET_DIR} ]; then
echo "Creating directory ${TARGET_DIR} ..."
mkdir -p ${TARGET_DIR}
if [ $? -ne 0 ]; then
echo 'ERROR: Directory creation failed!'
exit 1
fi
else
echo "Directory ${TARGET_DIR} already exists!"
fi
echo "Creating config for ${ENV_NAME} in ${AWS_REGION}"
aws ssm get-parameter --name "${ENV_NAME}-general" --with-decryption --region $AWS_REGION | jq -r '.Parameter.Value' > $TARGET_DIR/.env
aws ssm get-parameter --name "${ENV_NAME}-captcha" --with-decryption --region $AWS_REGION | jq -r '.Parameter.Value' >> $TARGET_DIR/.env
aws ssm get-parameter --name "${ENV_NAME}-ga" --with-decryption --region $AWS_REGION | jq -r '.Parameter.Value' >> $TARGET_DIR/.env
aws ssm get-parameter --name "${ENV_NAME}-intranet" --with-decryption --region $AWS_REGION | jq -r '.Parameter.Value' >> $TARGET_DIR/.env
aws ssm get-parameter --name "${ENV_NAME}-sentry" --with-decryption --region $AWS_REGION | jq -r '.Parameter.Value' >> $TARGET_DIR/.env
aws ssm get-parameter --name "${ENV_NAME}-sms" --with-decryption --region $AWS_REGION | jq -r '.Parameter.Value' >> $TARGET_DIR/.env
aws ssm get-parameter --name "${ENV_NAME}-ndi" --with-decryption --region $AWS_REGION | jq -r '.Parameter.Value' >> $TARGET_DIR/.env
aws ssm get-parameter --name "${ENV_NAME}-verified-fields" --with-decryption --region $AWS_REGION | jq -r '.Parameter.Value' >> $TARGET_DIR/.env
aws ssm get-parameter --name "${ENV_NAME}-webhook-verified-content" --with-decryption --region $AWS_REGION | jq -r '.Parameter.Value' >> $TARGET_DIR/.env

packages:
yum:
jq: []
74 changes: 51 additions & 23 deletions CHANGELOG.md

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion Dockerrun.aws.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
{
"HostDirectory": "/certs",
"ContainerDirectory": "/certs"
},
{
"HostDirectory": "/etc/formsg/.env",
"ContainerDirectory": "/opt/formsg/.env"
}
]
}
}
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ FormSG requires some environment variables in order to function.
More information about the required environment variables can be seen in
[DEPLOYMENT_SETUP.md](/docs/DEPLOYMENT_SETUP.md).

The docker-compose file declares some blank environment variables that are secret and cannot be committed into
the repository. See below instructions to get them injected into the container.

We provide a [`.template-env`](./.template-env) file with the secrets blanked out. You can copy and
paste the variables described into a self-created `.env` file, replacing the
required values with your own.
Expand Down
56 changes: 29 additions & 27 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ services:
- SEND_AUTH_OTP_RATE_LIMIT=60
- SES_PORT=25
- SES_HOST=maildev
- MYINFO_CLIENT_CONFIG=dev
- MYINFO_FORMSG_KEY_PATH=./node_modules/@opengovsg/mockpass/static/certs/key.pem
- MYINFO_CERT_PATH=./node_modules/@opengovsg/mockpass/static/certs/spcp.crt
- MYINFO_CLIENT_ID=mockClientId
- MYINFO_CLIENT_SECRET=mockClientSecret
- WEBHOOK_SQS_URL=http://localhost:4566/000000000000/local-webhooks-sqs-main
- INTRANET_IP_LIST_PATH
- SENTRY_CONFIG_URL=https://[email protected]/123456
Expand All @@ -55,32 +50,39 @@ services:
# Keep in sync with the development key in
# https://github.com/opengovsg/formsg-javascript-sdk/blob/develop/src/resource/signing-keys.ts
- SIGNING_SECRET_KEY=HDBXpu+2/gu10bLHpy8HjpN89xbA6boH9GwibPGJA8BOXmB+zOUpxCP33/S5p8vBWlPokC7gLR0ca8urVwfMUQ==
- TWILIO_ACCOUNT_SID
- TWILIO_API_KEY
- TWILIO_API_SECRET
- TWILIO_MESSAGING_SERVICE_SID
# Mock Twilio credentials. SMSes do not work in dev environment.
- TWILIO_ACCOUNT_SID=ACmockTwilioAccountSid
- TWILIO_API_KEY=mockTwilioApiKey
- TWILIO_API_SECRET=mockTwilioApiSecret
- TWILIO_MESSAGING_SERVICE_SID=mockTwilioMsgSrvcSid
# Use mockpass key pairs and endpoints
- SP_FORMSG_KEY_PATH=./node_modules/@opengovsg/mockpass/static/certs/key.pem
- SP_FORMSG_CERT_PATH=./node_modules/@opengovsg/mockpass/static/certs/server.crt
- SP_IDP_CERT_PATH=./node_modules/@opengovsg/mockpass/static/certs/spcp.crt
- SINGPASS_IDP_LOGIN_URL=http://localhost:5156/singpass/logininitial
- SINGPASS_IDP_ENDPOINT=http://localhost:5156/singpass/soap
- SINGPASS_ESRVC_ID=spEsrvcId
- SINGPASS_PARTNER_ENTITY_ID=https://localhost:5000/singpass
- SINGPASS_IDP_ID=https://saml-internet.singpass.gov.sg/FIM/sps/SingpassIDPFed/saml20
- CP_FORMSG_KEY_PATH=./node_modules/@opengovsg/mockpass/static/certs/key.pem
- CP_FORMSG_CERT_PATH=./node_modules/@opengovsg/mockpass/static/certs/server.crt
- CP_IDP_CERT_PATH=./node_modules/@opengovsg/mockpass/static/certs/spcp.crt
- CORPPASS_IDP_LOGIN_URL=http://localhost:5156/corppass/logininitial
- CORPPASS_IDP_ENDPOINT=http://localhost:5156/corppass/soap
- CORPPASS_PARTNER_ENTITY_ID=https://localhost:5000/corppass
- CORPPASS_ESRVC_ID=cpEsrvcId
- CORPPASS_IDP_ID=https://saml.corppass.gov.sg/FIM/sps/CorpIDPFed/saml20
- IS_SP_MAINTENANCE
- IS_CP_MAINTENANCE
- MYINFO_CLIENT_CONFIG=dev
- MYINFO_FORMSG_KEY_PATH=./node_modules/@opengovsg/mockpass/static/certs/key.pem
- MYINFO_CERT_PATH=./node_modules/@opengovsg/mockpass/static/certs/spcp.crt
- MYINFO_CLIENT_ID=mockClientId
- MYINFO_CLIENT_SECRET=mockClientSecret
- SES_PASS
- SES_USER
- OTP_LIFE_SPAN
- AWS_REGION
- SP_FORMSG_KEY_PATH
- SP_FORMSG_CERT_PATH
- SP_IDP_CERT_PATH
- SINGPASS_IDP_LOGIN_URL
- SINGPASS_IDP_ENDPOINT
- SINGPASS_ESRVC_ID
- SINGPASS_PARTNER_ENTITY_ID
- SINGPASS_IDP_ID
- CP_FORMSG_KEY_PATH
- CP_FORMSG_CERT_PATH
- CP_IDP_CERT_PATH
- CORPPASS_IDP_LOGIN_URL
- CORPPASS_IDP_ENDPOINT
- CORPPASS_PARTNER_ENTITY_ID
- CORPPASS_ESRVC_ID
- CORPPASS_IDP_ID
- IS_SP_MAINTENANCE
- IS_CP_MAINTENANCE

mockpass:
build: https://github.com/opengovsg/mockpass.git
Expand Down
15 changes: 15 additions & 0 deletions docs/DEPLOYMENT_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Infrastructure
- AWS Elastic Beanstalk / EC2 for hosting and deployment
- AWS Elastic File System for mounting files (i.e. SingPass/MyInfo private keys into the `/certs` directory)
- AWS S3 for image and logo hosting, attachments for Storage Mode forms
- AWS Service Manager - Parameter Store, for holding environment variable configuration

DevOps

Expand Down Expand Up @@ -104,8 +105,22 @@ The following env variables are set in Travis:

## Environment Variables

These are configured by creating groups of environment variables formatted like `.env` files in the Parameter
Store of AWS Service Manager. These groups have names formatted as `<environment>-<category>`.

The environment for each group is user-defined, and should be specified in the Elastic Beanstalk configuration
as the environment variable `SSM_PREFIX`.

The list of categories can be inferred by looking at the file `.ebextensions/env-file-creation.config`.

### Core Features

#### AWS Service Manager

| Variable | Description |
| :------------------ | ---------------------------------------------------------------------------------------------------------------- |
| `SSM_PREFIX` | String prefix (typically the environment name) for AWS SSM parameter names to create a .env file for FormSG. |

#### App Config

| Variable | Description |
Expand Down
Loading