Today, we are proud to announce our integration of Solano CI with Amazon EC2 Container Registry (ECR). With Amazon ECR and Solano CI, you can now reliably build, test, and deploy your Docker workflow without operating your own container repositories or scaling your infrastructure. Amazon ECR is a fully-managed, secure, and highly-available Docker container registry that makes it easy for developers to store, manage, and deploy Docker container images. In addition to the simplified workflow, you can configure policies to manage permissions and control access to your images using AWS Identity and Access Management (IAM). There is no easier way to gain fine-grain permission control over your Docker images today.
We decided to create an example repository to demonstrate integrating Amazon ECR and Amazon EC2 Container Service (ECS) with Solano CI. Each commit to the repository will trigger a build, and when all of the tests pass, the new Docker image will be pushed to Amazon ECR and Amazon ECS will start a new container. The step-by-step process we used:
Prepare your local system
- Since Amazon ECR is a new service, we had to install a new version of the AWS Command Line Interface to enable the
- Set the environment variables for the
1234export AWS_ACCESS_KEY_ID=<value>export AWS_SECRET_ACCESS_KEY=<value>export AWS_DEFAULT_REGION=<value>export AWS_ACCOUNT_ID=<value>
Setup Amazon ECR and ECS
For Amazon ECR enabled accounts, the Amazon ECS first run wizard allows creating the private Docker image repository in a few easy steps:
Set the repository name:
Upon creation of the Amazon ECR registry, run the provided commands. The
aws ecr get-login command will output a
docker login command to run, but this can be done in one step by running it in a subshell:
$(aws ecr get-login --region $AWS_DEFAULT_REGION)
After setting up Amazon ECR, the wizard continues with the standard Amazon ECS setup steps.
On the task definition step, clicking the Advanced button allows us to set our own entry point and ensure the command field is empty.
Configure the service:
Configure the cluster:
Review the settings and Launch!
Setup Solano CI
After AWS has launched the container, we set Solano CI to automatically build and test on each
git push. When all of the tests pass, the new Docker image is pushed to Amazon ECR and Amazon ECS launches a new container from the image.
Inform Solano CI of the repository:
user@host:/repo/root$ solano suite
Now that the repository has been registered with Solano CI, we went into the repositories settings by clicking the gear icon for the repository on the Solano CI dashboard:
On the CI Setup tab of Solano CI’s repository settings page we used the values to link the GitHub repository. The values under #2 are set in GitHub’s Tddium service hook. The value under #3 is Solano CI’s repository public key and is added as a GitHub deploy key.
To set the auth credentials necessary for connecting to AWS, the
solano config:add command is the recommended way to set sensitive environment variables:
user@host:/repo/root$ solano config:add repo AWS_ACCESS_KEY_ID <value>
user@host:/repo/root$ solano config:add repo AWS_SECRET_ACCESS_KEY <value>
user@host:/repo/root$ solano config:add repo AWS_DEFAULT_REGION <value>
user@host:/repo/root$ solano config:add repo AWS_ACCOUNT_ID <value>
Now the example repository will trigger a build and deploy to both Amazon ECR and ECS upon passing builds. In particular there are a couple of files that we recommend taking a look at:
scripts/solano-worker_setup.sh: Starts the docker container and prepares the test database.
With Amazon ECR and ECS alongside Solano CI: May green builds be with you!