Boiler-plate starting project for W4156. Teams can optionally use this project to get started and add to it in parallel to lectures.
Project contains:
- Python flask server
- Docker support to run locally
- Support to run dynamodb locally (in a docker)
- Integration with AWS to run a docker continuous deployment pipeline
The AWS continuous delivery pipeline is based on the reference architecture
- Git CLI
- python 3.6
- AWS CLI (pip install awscli)
- Docker
- PyCharm NOTE - make sure to get the professional using edu email
- Proto.io (TODO instructions given on piazza)
- Slack Set up a chat for the team to communicate
- VirtualEnv
- Postman Optional - is a tool to help test
- Spotify Optional!
- If you do not have it already each member of the team needs to create a github account
- If your team chooses to use the boilerplate python, flask, docker as a starting point then one member of the team should fork the boilerplate (this project)
- Add your team members add collaborators to the project
TODO
You can of course develop directly out of the IDE. Once you are starting to prepare to deploy you should run in containers locally.
A set of convenience scripts have been provided to start and stop
- Pull the local docker dynamo image (this downloads dynamodb to be able to run locally)
./bin/docker_dynamo.sh pull
- Start the dynamo instance
./bin/docker_dynamo.sh start
It should say something like below. Dynamo database is now running locally
Checking if container for dynamo is running .....
Container was not running
Removing previous container for dynamo
ec8d64dd4897
Starting Container ....
810141dbec4fa37d4697aa4f8faaef6244d5e192267058949b90ab93822b65db
Follow the below to configure deploying on AWS
-
Get an AWS education account (instructions on piazza)
-
Configure your aws CLI
aws configure
- Create an access
aws iam create-group --group-name Admins
aws iam create-user --user-name teammember1
aws iam create-user --user-name teammember2
aws iam create-user --user-name teammember3
aws iam create-user --user-name teammember4
- Create a policy called Admin and grant it administrator rights
aws iam attach-group-policy --group-name Admins --policy-arn arn:aws:iam::aws:policy/AdministratorAccess
- Give admin priviledges to each of your team members
aws iam add-user-to-group --user-name teammember1 --group-name Admins
aws iam add-user-to-group --user-name teammember2 --group-name Admins
aws iam add-user-to-group --user-name teammember3 --group-name Admins
aws iam add-user-to-group --user-name teammember4 --group-name Admins
- Create a new password initial password for each team member
aws iam create-login-profile --user-name teammember1 --password <<a password>> --password-reset-required
aws iam create-login-profile --user-name teammember2 --password <<a password>> --password-reset-required
aws iam create-login-profile --user-name teammember3 --password <<a password>> --password-reset-required
aws iam create-login-profile --user-name teammember4 --password <<a password>> --password-reset-required
- Create an alias for your account (this allows a logical/vanity name on various URLS)
aws iam create-account-alias --account-alias <<TEAM NAME>>
- Each team member must now log in and change their password
https://<<TEAM NAME>>>.signin.aws.amazon.com/console/
- Log into Github and create a github access token
- Enable the 'repo' scope and the 4 settings within
- One member of the team must now execute
aws cloudformation create-stack --stack-name w4156-cd-pipeline --template-body file://templates/ecs-cicd-refarch.yaml --parameters ParameterKey=GitHubUser,ParameterValue=<<GITHUB USERNAME>> ParameterKey=GitHubRepo,ParameterValue=<<YOUR GITHUB PROJECT>> ParameterKey=GitHubBranch,ParameterValue=master ParameterKey=GitHubToken,ParameterValue=<<GITHUB ACCESS KEY>> --capabilities CAPABILITY_IAM
If there is a need to customize the cloud formation documents then you will need to create your own AWS S3 bucket
aws s3api create-bucket --bucket w4156-cf-bucket --region us-east-1 --acl public-read
aws s3 cp templates/ s3://w4156-cf-bucket/ --recursive --include "*.yaml"
Following the AWS setup instructions any commit to github will trigger the CD pipeline