##Circle CI
Continuous Integration and Continuous Deployment (CI/CD) on CircleCI allows us to easily run tests and deploy when making commits or accepting pull requests in Github.
When a change happens in Github, it triggers the start of a build on CircleCI. CircleCI then loads latest commit and checks a configuration file(circle.yml) in the root directory of the repository which indicates how the deployment should be handled by the build machine. If a build fails the tests it is not deployed.
###CircleCI Environment Variables
AWS_REGION: us-east-1
Since our Elastic Beanstalk application lives in us-east-1.
###Our CircleCI Configuration File Explained (circle.yml):
Build Machine:
Our build machine configuration is set up with PHP 5.4.5 and Python 2.7.6.
Dependencies:
Installed:
- Amazon Web Services command-line interface(awscli)
- Amazon Web Services Elastic Beanstalk command-line interface(awsebcli) These are needed to make sure that necessary AWS resources exist and to deploy to Elastic Beanstalk.
Tests:
As of now we have a dummy test that always passes, but that should be modified to actually run tests needed for a security and confidence in our deployments.
Deployment:
If the staging production or production branches pass the tests then deployment of application begins.
For staging deployment the steps are as follows:
- Ensure RDS with DB data is up (deployment/rds-wait.sh)
- Package up the application for deployment (deployment/build-zip.sh)
- Deploy using the AWS Elastic Beanstalk CLI to marketplace-staging(eb ebdeploy).
Incomplete
For productions the steps are as follows:
- Ensure RDS is running
- Package up the application for deployment
- Deploy to new clone environment of production with new build
- Swap CNAME with production environment and let legacy production environment on til DNS propagates.
For production, we want to have updates with no downtime. Need to include an EB SWAP when deploying machines to production to assume the same CNAME as the running production environment.