This guide gets you up and running with a running SLIC Starter environment as quickly as possible.
This setup is faster than the full, domain-based, multi-account setup because:
- No domains and certificates are provisioned. These steps require approval and DNS propagation time
- Everything is deployed to a single AWS account - CI/CD, staging and production.
- Node v8 should be installed locally. A later version should also be perfectly acceptable. NPM v6 or later is recommended because it supports relative path modules better. (Like
test-common
, included as a relative dependency bye2e-tests
andintegration-tests
) - The Serverless Framework v1.51 or later should be installed:
npm install serverless@1.51 -g
You should work within your own clone/fork of the repository so you can freely commit and push changes.
- Fork the repository on GitHub
- Clone the forked repository
You should run npm install
for all packages. Run the ./util/install-packages.sh
script to do this. The minimum requirement here is to run npm install
in the cicd
folder. Everything else is only really required for local development later.
Set up CodeBuild GitHub access. There are a couple of ways to do this. The most reliable in our experience is with the AWS CLI. All methods are covered in the guide from AWS, available here.
- Generate a skeleton for the CodeBuild CLI:
aws codebuild import-source-credentials --generate-cli-skeleton > /tmp/skeleton.json
- Create a GitHub personal access token. Go to GitHub -> Settings -> Developer Settings -> Personal access tokens -> Select 'repo'.
- Paste the token into
token
in/tmp/skeleton.json
- Change
serverType
toGITHUB
- Change
authType
toPERSONAL_ACCESS_TOKEN
- Delete
username
- Run
aws codebuild import-source-credentials --cli-input-json file:///tmp/skeleton.json
- Copy
slic-config.json.sample
toslic-config.json
. - Edit it to specify the target AWS account ID for all accounts.
- Remove
nsDomain
- Specify a new value for
siteBucketPrefix
. - Change repository owner and name.
If you wish, this step can be defered until you have problems with deployment and tests failing due to missing configuration.
- Create an account on mailosaur.com and grab the API key and server ID. Mailosaur is used for testing that emails have been sent by the system during automated integration tests. If you want to configure logz.io for centralized logging, do the same there.
- Run
cp util/ssm-params-template.json /tmp/ssm-params.json
- Edit
/tmp/ssm-params.json
and fill out all parameters for the system. You can enter your Mailosaur and logz.io keys here. - The code secret for the sharing service should be a randomly-generated secret. This is used to sign and verify invitation codes.
- The 'from-address' used by the email service specifies the 'From:' address for sent emails. More on this in the SES section below.
- When you have entered all required parameters, run
util/create-ssm-params.js /tmp/ssm-params.json
SLIC Starter uses SES to send and receive emails. If you want SES to be able to do that, you need to verify the sender and recipient's email address. You can also request a Sending Limit Increase through SES. This will allow SES to send emails to any recipient, including the randomly-generated Mailosaur email addresses used by the automated tests.
cd cicd/cross-account
sls deploy
Ensure that AWS credentials are configured in your environment before running the deploy commands below.
cd BASEDIR/cicd
npm run build
npm run cdk -- bootstrap
npm run deploy
Your CI/CD pipeline is now deployed. You can verify this in the CodePipeline dashboard.
Make a commit to your repository. You can watch the CodePipeline job run. It will fail the first few times as services have inter-dependencies that will be resolved after repeated retries of failed stages. Once you have your first deployment working, this will no longer be the case.
The deployed front-end application is now running and deployed. It is automatically configured to talk to the backend's APIs and Cognito user pool. To get the generated CloudFront name for the application, you can check the valu eof /stg/frontend/url
in the Parameter Store. There is a handy script to print out all your (non-secret) parameters from SSM.
Go to the CloudFront address to load and use the deployed staging SLIC Lists application!
Start making changes and transform SLIC Starter into your own application.
Let us know how you get on in the GitHub issues! We would love to hear from you and see any contributions you have to SLIC Starter.
npm install -g fuge