This example describes how to set up a sample microservices app for continuous deployment, with Weave Cloud Deploy. All that Deploy needs to know is the repo that contains your manifests.

Before You Begin

  • Setup hosts
  • Install a Kubernetes Cluster
  • Download and fork the demo app Sock Shop

Setup Hosts and Stand up a Kubernetes Cluster

You can follow these instructions to set up three hosts in Digital Ocean and use kubeadm to quickly stand up a Kubernetes cluster:

Once you have a Kubernetes cluster running, return and continue on with this example.

Forking the Sock Shop

You will need a GitHub account for this step.

Before you can modify the Socks Shop, fork the following repository to your own account:

To fork the GitHub repository click Fork from the top right hand corner. The repository will appear in your own GitHub account.

Launching and Configuring Deploy

1. Launch all three Weave Cloud agents. Follow the setup steps in the Weave Cloud UI, or use the command line as below:

TOKEN=[weave cloud token]
GIT_URL=[your git repo URL]
GIT_PATH=deploy/kubernetes/manifests
kubectl apply -n kube-system -f \
  "https://cloud.weave.works/k8s.yaml?t=$TOKEN&git-url=$GIT_URL&git-path=$GIT_PATH&k8s-version=$(kubectl version | base64 | tr -d '\n')"

Where,

  • [weave cloud token] is the token you obtained from the instance settings page in Weave Cloud;
  • [your git repo URL] is the clone URL of the microservice-demo repo you cloned earlier, i.e., git@github.com:<YOUR_GITHUB_USERNAME>/microservices-demo.
  • The path, and the kubectl line, can be copied verbatim.

2. Check Weave Cloud to ensure that the Deploy agent is running as a pod. To simplify this, search for ‘flux’:

3. Ensure you have a deploy key in the Github repo that you specified above.

Weave Cloud needs this access in order to write changes back to the repo.

Important! When pushing the keys to your repo, ensure that it is enabled to write.

Click on the gear icon and select the Deploy configuration. Check that the git repo URL and path are what you expect from above. Then either click the button to have Weave Cloud install a deploy key, or copy the key shown and create a deploy key through Github’s settings.

If you clicked the button, you can check that the keys are properly in Github by going to the forked microservices-demo repo and by clicking on Settings and then Deploy Keys to ensure that the fingerprint matches, and the key has read/write enabled. Enabling write access ensures that Weave Cloud has push access to your repository. Weave Cloud should have done this for you.

4. You should now see a view of the Sock Shop services in Deploy.

Now that Deploy can read the git repo, it will synchronize the cluster with the manifests within. This will bring the Sock Shop application up. By clicking the Deploy tab, you can see the services that make up the application.

The app should also appear in Explore where you will see Pods view on the top of the screen. Select the Pods view and then enable the sock-shop filter from the left-hand corner:

Display the Sock Shop in a Browser

Find the NodePort by to launch in the Sock Shop in the browser by running:

kubectl describe svc front-end -n sock-shop

Display the Sock Shop in the browser using <master-node-IP>:<NodePort>.

Further Reading