This project is the accompanying source code to the blog article locate here: https://aws.amazon.com/blogs/opensource/continuous-delivery-server-side-swift-aws/. Please check that article out - it goes over the project goals and setup instructions in much greater depth.
- Create a new S3 bucket that will store your packaged cloudformation templates, or find an existing one to use. The user running the scripts should have read/write access to this bucket, and it should be in the same account as where you want the resources to be provisioned.
- Update package.json with the name of the bucket. The scripts should have the CF_BUCKET environment variable set to the name of the bucket.
- Optionally, update
create-stack.json
and update the tags applied to the resources, or the name of the cloudformation stack. - Run
npm run-scripts create
- Wait for the script to finish. You can view the status either by looking at the AWS console in the Cloudformation section or by running
aws cloudformation wait stack-create-complete
- Create the docker image. Navigate to
ECR
within the AWS console, click oncodebuild/swift
and follow the instructions inView push commands
from within thecodebuild-image
folder. - Copy the contents of the
app
folder to another directory:cp -r ./app ../swift-codebuild-app
. - Change to the newly copied directory and initialize a git repository:
cd ../swift-codebuild-app && git init
- Navigate to the
CodeCommit
AWS console, then locate the repository created by the Cloudformation script (it should start with the stack name that you used). Click on that repository and follow the instructions to initialize the repository with the contents ofswift-codebuild-app
. - Navigate to CodePipeline. Click on the pipeline whose name starts with the Cloudformation stack name. After a few seconds it should pick up the change in the CodeCommit repository and launch. After 10-15 minutes it should complete all three stages: Source, Build, and Release.
- Navigate to the EC2 AWS console, then click on the sidebar to find the
Load Balancer
section. First click on the load balancer whose name starts withswift-EC2
. Copy the DNS name and paste it into a browser window. Confirm that it reponds with "It works!" - Navigate to the EC2 AWS console, then click on the sidebar to find the
Load Balancer
section. First click on the load balancer whose name starts withswift-ECS
. Copy the DNS name and paste it into a browser window. Confirm that it reponds with "It works!" - Update the
swift-codebuild-app
repository. EditSources/App/routes.swift
and modifyreturn "It works!"
to readreturn "It works! With an update!"
. Commit those changes and push them to the CodeCommit repository. - Wait for the pipeline to update and confirm that the two load balancers update with the correct message.
This library is licensed under the MIT-0 License. See the LICENSE file.