Deploying your First Application

Running your services on a newly-installed Paz cluster

Paz can only run services that have been defined in the Service Directory; so the first step to deploying your new service is to do just that. Once a service is declared, it can be deployed by the scheduler, usually via your CI system and the Docker Hub.

We're going to add a contrived service called "demo-api", which is a simple "Hello World!" website.

This assumes that you've set up a CoreOS Paz Vagrant/VirtualBox cluster.

Adding a Service to the Service Directory

Adding new services is described here.

Create a service named "demo-api", give it any description, Docker repository lukebond/demo-api, number of units 3. Don't specify any ports or environment variables.

Deploying your New Service from the Paz UI

In the Services tab there is a button to deploy your new service. Click that button and it should appear in the dashboard.

Manually Deploying Your New Service

Services can also be deployed via an HTTP post, and the Scheduler has two endpoints for ths, one expects Docker Hub webhooks and the other is for manual deployment. You may prefer to use the latter for manual deployments with something like cURL.

🚧

Important

Have you set up your /etc/hosts for Paz? See the note towards the end of this documentation for information on how to do this.

Manually trigger the deployment using curl:

$ curl -i -d '{"serviceName": "demo-api", "dockerRepository": "lukebond/demo-api", "pushedAt": 0}' -H 'Content-Type: application/json' paz-scheduler/hooks/deploy
HTTP/1.1 200 OK
...

You can now go to the Paz dashboard and the service should soon appear (it may take a moment to pull the image down from the Docker Hub).

You should see three green demo-api units running in the Paz web UI dashboard.

Accessing Your New Service

In order to access your new service from outside the cluster we need to modify our /etc/hosts file. This is because all incoming requests to the cluster go through HAProxy and HAProxy will route requests by HTTP host header. Therefore incoming requests need to include the service name.

Add the following line to your /etc/hosts file:

172.17.9.101 demo-api.paz