Guestbook Example with Wercker integration
This example shows how to build a simple, multi-tier web application using Helm Classic, Deis Workflow and Wercker for Continuous Deployment
The example consists of:
- A web frontend which is installed as a Deis Workflow
- And a back-end Redis
master
(for storage) with a replicated set of Redisslaves
- Integration with Wercker for Continuous Deployment of your App's docker image
The web frontend interacts with the Redis master
API via JavaScript calls.
This example requires a running Kubernetes cluster and you have installed Helm Classic, Deis Workflow and you have an account with Wercker.
Backend install with Helm Classic
- We add the remote repo to Helm Classic:
$ helmc up
$ helmc repo add demo-charts https://github.com/deis/demo-charts
$ helmc up
- We install our back-end chart
$ helmc fetch demo-charts/redis-guestbook
$ helmc install redis-guestbook
- Create guestbook App:
$ deis create guestbook --no-remote
Note: We are creating the App with --no-remote
, as later one we are going to use docker image built by Wercker
- Set
env vars
so the App knows where to connect to redis cluster:
$ deis config:set GET_HOSTS_FROM=env REDIS_MASTER_SERVICE_HOST=redis-master.default REDIS_SLAVE_SERVICE_HOST=redis-slave.default -a guestbook
Set Continuous Deployment with Wercker
-
Fork the repo
https://github.com/deis/example-guestbook-wercker.git
to your Gihub account -
Clone the repo:
$ git clone https://github.com/your_github_account/example-guestbook-wercker.git
-
Create a new Wercker App and connect to your App's Github repo
-
Under App's Settings->Environment variables create the values below:
DOCKER_USERNAME: dockerhub or other hosted docker registry account name
DOCKER_PASSWORD: your docker registry account password
DOCKER_REPO: your docker repository e.g. your_docker_hub_user_name/wercker-demo-app
DEIS_CONTROLLER: Deis Workflow controller URL e.g. http://deis.example.com
DEIS_TOKEN: your Deis Workflow user token, which you can get from ~/.deis/client.json file
The Environment variables
above will be used by Wercker App you have created reading pipeline steps from the wercker.yml in your App's repository
- Make changes to your code, push to Github and Wercker will do the following:
- build the docker image
- tag it
- push to your docker registry repository
- pull the new docker image on your remote Deis Workflow
With this example App you have learned how to set the multi-tier web application up using Helm Classic and Deis Workflow and then with Wercker's help to deploy your App to Deis Workflow