Continuous Deployment With Helm Classic, Deis Workflow, and Wercker
When we finish, we'll have:
- A backend Redis cluster (for storage)
- Wercker for continuous deployment of your Docker image to Deis Workflow
Before we continue, you'll need a few things set up.
Firstly, you need a running Kubernetes cluster that is accessible remotely so Wercker can deploy new versions of your Docker image.
Next, you'll need Helm Classic installed. Helm Classic is the Kubernetes package manager developed by the Deis folks.
You can install Helm Classic by running:
Then you'll need to install Deis Workflow. Consult the Deis docs for that!
We're also going to use Docker Hub for hosting our Docker repository. So you'll need an account there.
And finally, head over to Wercker and set up an account.
Install Redis With Helm Classic
As a quick refresher, a chart in Helm Classic lingo is a packaged unit of Kubernetes software. For the purposes of this demo, I wrote a chart that sets up Redis for you.
Point Helm Classic at the demo repository by running:
Now install the chart I wrote for this demo that sets up Redis:
Create the Deis App
To work with Deis Workflow, we need to create a Deis app.
You can do that by running:
We're creating the app with
--no-remote because Deis only needs a Git remote when we’re using it for building Docker images. But we’re using Wercker for that.
Once that's done, the only thing we need to do is specify some environment variables so that our app knows how to contact the Redis cluster.
Run this command:
Now that's set up, we can can set up the code.
Set Up the Code
This bit's easy.
Fork my demo repo to your GitHub account.
Then, clone your fork locally:
$ git clone https://github.com/USERNAME/example-guestbook-wercker.git
Now, we can set up continuous deployment with Wercker so changes made to your fork will result in automatic deployments to your Deis Workflow.
Set Up Continuous Deployment
Log into your Docker Hub account and create a new repository. You can do that via the Create menu, then Create Repository, then call it something like
example-guestbook-wercker, or whatever you want.
Log in to your Wercker account and select Create, then Application. Connect Werker to your GitHub account and select your repository. When configuring access, select the default option: check out the code without using an SSH key.
Once the app is created, go to Settings, then Environment Variables, and create the following key-value pairs:
- DOCKER_USERNAME: Your Docker Hub or other hosted docker registry account name
- DOCKER_PASSWORD: Your Docker registry account password (you'll probably want to set this protected, which hides it from the UI)
- DOCKER_REPO: Your Docker Hub URL e.g.
- DEIS_CONTROLLER: Your Deis controller URL (see your
- DEIS_TOKEN: Your Deis user token (see your
- TAG: A tag for tagging your Docker image, e.g.
These environment variables will then be passed into the wercker.yml file before it is evaluated by Wercker.
Make some changes to your code. Then, push to GitHub.
Wercker will see this, and do the following:
- Build and tag your Docker image
- Push to your Docker registry
- Deploy your Docker image to Deis Workflow
There we have it.
Continuous deployment with Helm Classic, Deis Workflow, and Werker.
Stay tuned for more posts like this.