Operations

Preface

All operations via Commissaire are done via REST. REST calls are the prefered way to integrate with Commissaire. While any HTTP client can be used to directly interface with the REST server, many operators will feel more comfortable using commctl.

curl

Every call requires a username and password to be passed via HTTP Basic Auth. With curl this looks like:

curl ... -u "USERNAME:PASSWORD" ...

The proper headers must also be passed. Since all of the REST communication is done via JSON the Content-Type must be set to application/json.

curl ... -H "Content-Type: application/json" ...

Lastly, the type of operation must be specified. For example, PUT must be used when creating while GET must be used for retrieving.

curl ... -XPUT ...

Bootstrapping

Bootstrapping happens when a new host is added to commissaire via the Host endpoint.

curl -u "a:a" -XPUT -H "Content-Type: application/json" http://localhost:8000/api/v0/host/192.168.1.100 -d '{"host": "192.168.1.100", "cluster": "datacenter1", "remote_user": "root", "ssh_priv_key": "dGVzdAo="}'
...

It’s important to remember ssh_priv_key must be base64 encoded without newlines. On many systems this can be done via that base64 command and using the -w0 switch.

$ cat path/to/key | base64 -w0 > encoded_key

For specifics on the endpoint see Host

Note

commissaire can help automate the bootstrapping of new hosts using cloud-init for early initialization. See Cloud-Init Integration.

Cluster Operations with curl

Note

Operators will probably want to use commctl

These operations are done across all hosts associated with a cluster.

Restart

Restarting a cluster is done by creating a new restart record for a specific cluster.

curl -u "a:a" -XPUT -H "Content-Type: application/json" http://localhost:8000/api/v0/cluster/datacenter1/restart
...

To check on a restart record, a REST GET call on the same endpoint will show the current status.

curl -u "a:a" -XGET -H "Content-Type: application/json" http://localhost:8000/api/v0/cluster/datacenter1/restart
...

For specifics on the restart endpoint see Cluster Operations: Restart

Upgrade

Upgrading a cluster is done by creating a new upgrade record for a specific cluster.

curl -u "a:a" -XPUT -H "Content-Type: application/json" http://localhost:8000/api/v0/cluster/datacenter1/upgrade
...

To check on an upgrade record, a REST GET call on the same endpoint will show the current status.

curl -u "a:a" -XGET -H "Content-Type: application/json" http://localhost:8000/api/v0/cluster/datacenter1/upgrade
...

For specifics on the upgrade endpoint see Cluster Operations: Upgrade

Deploy

Deploying to a cluster is done by creating a new deploy record for a specific cluster.

curl -u "a:a" -XPUT -H "Content-Type: application/json" --data='{"version": "7.2.1"}' http://localhost:8000/api/v0/cluster/datacenter1/deploy
...

To check on a deploy record, a REST GET call on the same endpoint will show the current status.

curl -u "a:a" -XGET -H "Content-Type: application/json" http://localhost:8000/api/v0/cluster/datacenter1/deploy
...

For specifics on the deploy endpoint see Cluster Operations: Deploy