This sample project demonstrates how to automate deployments of a Docker image to a Container orchestration platform like Kubernetes, GKE, Amazon ECS, etc using Shippable's managed jobs. If you have simple deployments that do not have a bunch of custom requirements, managed jobs are the best way to start deploying Docker containers. If you need custom handling, such as running a script as part of the deployment, or automatic rollbacks, you should do custom deployments using the runSh
job, where you can use the cloud-native CLIs/SDKs or other popular tools to script the deployments yourself.
You can find a tutorial that explains how to run this sample at http://docs.shippable.com/deploy/continuous-delivery-single-container-docker-application/
You can do a quick test run of this project by following the instructions below. Please note that these instructions will deploy our sample application to a container orchestration service of your choice.
-
Clone this repository to your account
-
The sample assumes you have a cluster where the application can be deployed. Create an integration for the cloud where your cluster is located:
- GKE: gCloudKey
- Kubernetes: Kubernetes
- Amazon ECS: AWS IAM or AWS keys
-
In shippable.yml, replace values for
sourceName
andregion
in thecluster
resource. Also replace the value forintegration
with the name of the integration you created in the earlier step.
- name: cd_docker_platform_cluster
type: cluster
integration: "drship_gcp"
versionTemplate:
sourceName : "cd_docker_platform_ship_cluster" # replace with your cluster name
region: "us-central-1f" # replace with your region
namespace: "shippable" # replace with your namespace
-
Commit your changes to shippable.yml.
-
Follow instructions to Add your assembly line to Shippable
-
In your Single Pane of Glass view, right click on the manifest job cd_docker_platform_manifest and click on the Play icon to run the job. This will create your service definition and automatically trigger the deploy job, which deploys your application to your cluster.
-
If you want to automate how the Docker image is pushed to Docker Hub, please read our tutorial Build and Push an image to Docker Hub. Please note that you will need to make the following changes to this sample once you have that workflow set up:
- In the cd_docker_platform_manifest job, replace the
IN
image resource cd_docker_platform_image with node_app_img_dh, which is defined in the "Build and Push an image to Docker Hub" tutorial to create a continuous workflow from that tutorial to this. - Remove the
image
resource cd_docker_platform_image from this sample
- In the cd_docker_platform_manifest job, replace the
-
Advanced scenarios such as scaling number of instances, customizing container options, etc are explained in the docs:
- Multi-container deployments
- Multi-stage deployments
- Gated deployments
- Specifying deployment methods
- Customizing container options
- Setting environment variables inside deployed container
- Scaling service instances
- Specifying the version to deploy
- Rolling back deployments
- Sending notifications upon deployments
- Customizing deployed service names
- Pausing deployments
- Deleting a deployed service
If you're new to Shippable and need an overview of how everything works, please start here: