deis / example-guestbook-wercker

A simple PHP app for Deis Workflow, with back-end and wercker integration

Home Page:https://deis.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 Redis slaves
  • Integration with Wercker for Continuous Deployment of your App's docker image

The web frontend interacts with the Redis master API via JavaScript calls.

Prerequisites

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

  1. We add the remote repo to Helm Classic:
$ helmc up
$ helmc repo add demo-charts https://github.com/deis/demo-charts
$ helmc up
  1. We install our back-end chart
$ helmc fetch demo-charts/redis-guestbook
$ helmc install redis-guestbook

Front-end install with deis cli

  1. 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

  1. 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

  1. Fork the repo https://github.com/deis/example-guestbook-wercker.git to your Gihub account

  2. Clone the repo:

$ git clone https://github.com/your_github_account/example-guestbook-wercker.git
  1. Create a new Wercker App and connect to your App's Github repo

  2. 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

  1. 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

About

A simple PHP app for Deis Workflow, with back-end and wercker integration

https://deis.com

License:MIT License


Languages

Language:JavaScript 34.3%Language:PHP 33.1%Language:HTML 32.7%