Skip to content

Commit

Permalink
Merge pull request #28 from CiscoCloud/fix/readme-urls
Browse files Browse the repository at this point in the history
readme: make curl commands consistent
  • Loading branch information
ryane committed Jan 11, 2016
2 parents b9c1e76 + c7fdb03 commit 0fbfa73
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ Mantl API leverages the [Mesosphere DCOS package repository](https://github.com/

## Mantl API on Mantl Clusters

As of the [0.5 release](https://github.com/CiscoCloud/microservices-infrastructure/releases/tag/0.5.0), Mantl API is installed by default on Mantl clusters. It is available on control nodes at the `/api` endpoint and, by default, is behind SSL and basic authentication. For example, you could get a list of packages by running a command like the following on a default Mantl install:
As of the [0.5 release](https://github.com/CiscoCloud/microservices-infrastructure/releases/tag/0.5.0), Mantl API is installed by default on Mantl clusters. It is deployed via Marathon and will be running on one of the worker nodes. Mantl automatically discovers the Mantl API instance and puts it behind Nginx on all control nodes at the `/api` endpoint. By default, it is secured with SSL and basic authentication. As an example, on a default Mantl install, you can retrieve the list of available packages by running a command like the following:


```shell
curl -k -u admin:mantlpw https://mantl-control-01/api/1/packages
```

You just need to update the command with the correct host name and credentials for your cluster. All of the examples in this document will assume you are working with Mantl API on a Mantl cluster and will use urls underneath `/api`.

## Building

```shell
Expand Down Expand Up @@ -214,12 +216,14 @@ The following attributes can be specified for each source:

## Usage

The following example curl commands assume a default Mantl API installation (with a control node called `mantl-control-01`) on a Mantl cluster with SSL and authentication turned off. You will need to adjust the commands to work with valid URLs and credentials for your cluster.

### Installing a Package

It is a single API call to install a package. In the example below, we are going to run [Cassandra](http://cassandra.apache.org) on our Mantl cluster.

```shell
curl -X POST -d "{\"name\": \"cassandra\"}" http://mantl-worker-003:4001/1/packages
curl -X POST -d "{\"name\": \"cassandra\"}" http://mantl-control-01/api/1/packages
```

You will need to replace `mantl-worker-003` and `4001` with the host and port where Mantl API is running. You can use the Marathon API or UI to find this. You'll also need to make sure that the port is accessible to the machine where you are calling the API from. Adjust the security groups or firewall rules for your platform accordingly.
Expand All @@ -231,7 +235,7 @@ After about 5 minutes, you should have Cassandra up and running on your Mantl cl
Uninstalling is just as easy. Run the command below to uninstall Cassandra:

```shell
curl -X DELETE http://mantl-worker-003.jossware.org:4001/1/packages/cassandra
curl -X DELETE http://mantl-control-01/api/1/packages/cassandra
```

After a moment, Cassandra will have been removed from your cluster. This will also remove the [Zookeeper](https://zookeeper.apache.org) state for the Cassandra framework. In the future, we will add more flexibility in being able to control what is uninstalled.
Expand All @@ -251,7 +255,7 @@ After a moment, Cassandra will have been removed from your cluster. This will al
`GET /health`: returns `OK`

```shell
curl http://mantl-worker-003:4001/health
curl http://mantl-control-01/api/health
```

```
Expand All @@ -263,7 +267,7 @@ OK
`GET /1/packages`: returns a JSON representation of packages available to install.

```shell
curl http://mantl-control-01:4001/1/packages | jq .
curl http://mantl-control-01/api/1/packages | jq .
```

```json
Expand Down Expand Up @@ -321,7 +325,7 @@ curl http://mantl-control-01:4001/1/packages | jq .
`GET /1/packages/<package>`: returns a JSON representation of a package.

```shell
curl http://mantl-worker-001:4001/1/packages/cassandra | jq .
curl http://mantl-control-01/api/1/packages/cassandra | jq .
```

```json
Expand Down Expand Up @@ -357,7 +361,7 @@ curl http://mantl-worker-001:4001/1/packages/cassandra | jq .
`POST /1/packages`: post a JSON representation of a package to install.

```shell
curl -X POST -d "{\"name\": \"cassandra\"}" http://mantl-worker-001:4001/1/packages | jq .
curl -X POST -d "{\"name\": \"cassandra\"}" http://mantl-control-01/api/1/packages | jq .
```

```json
Expand Down Expand Up @@ -464,7 +468,7 @@ curl -X POST -d "{\"name\": \"cassandra\"}" http://mantl-worker-001:4001/1/packa
`DELETE /1/packages/<package>`: post a JSON representation of package specific uninstall options.

```shell
curl -X DELETE -d "{\"name\": \"cassandra\"}" http://mantl-worker-001:4001/1/packages/cassandra
curl -X DELETE -d "{\"name\": \"cassandra\"}" http://mantl-control-01/api/1/packages/cassandra
```

## License
Expand Down

0 comments on commit 0fbfa73

Please sign in to comment.