Get a list of all Stacks

get

/api/v2/stacks/

Returns a list of all stacks defined in the Container service database. This includes the pre-packaged stacks and any stacks created since the service instance was created.

For each stack, the list includes the properties of the stack, including the service_id of the stack and details about the services deployed to the stack.

Request

There are no request parameters for this operation.

Security
Back to Top

Response

Supported Media Types

200 Response

200 Response
Body ()
Root Schema : schema
Type: array
Show Source
Nested Schema : items
Type: object
Show Source
Nested Schema : stacks
Type: array
Show Source
Nested Schema : items
Type: object
Show Source

Default Response

Error Payload
Body ()
Root Schema : schema
Type: array
Show Source
Back to Top

Examples

The following example shows how to retrieve details about all the stacks in your Oracle Container Cloud Service environment. To perform this action, you submit a GET request on the REST resource using cURL. For more information about cURL, see Use cURL.

Note: The command in this example uses the URL structure https://rest_server_url/resource-path, where rest_server_url is the manager node for the Oracle Cloud Container instance. See Send Requests for the appropriate URL structure to use for Oracle Public Cloud.

cURL Command Syntax

curl -sk 
     -X "GET" 
     -H "Authorization: Bearer b39f09c71c297f1d" 
     "https://rest_server_url/api/v2/stacks/"

Example of Response Body

{
  "stacks": [
    {
      "service_id": "Redis-Cluster",
      "service_name": "Redis Cluster",
      "subtype": "stack",
      "content": "# This Redis master/slave stack depends on the user tagging the master\n# host with 'master' and other non-master hosts with 'slave'\n#\n# TODO: put password 'mypass' somewhere else instead of this yaml\n#\n# TODO: use DNS instead of mapped env file\n#   dig @127.0.0.1 -p 8600 {{.ServiceID}}-{{.DeploymentID}}.service.stack. SRV|awk '/^;/{next}/ IN .* A /{print $NF}'\n#   # DNS via dig was not used because the container image did not have dnstools installed\nversion: \"2\"\nservices:\n  redis-master:\n    image: \"redis:3.2.1-alpine\"\n    ports:\n     - \"6379:6379/tcp\"\n    environment:\n     - \"OCCS_PHASE_ID=0\"\n     - \"occs:scheduler=random\"\n     - \"occs:availability=per-tag\"\n     - \"occs:availability_context=master\"\n     - \"OCCS_HEALTHCHECK_REDIS=tcp://:6379/?timeout=10s$interval=30s\"\n     - \"CMD_INFO=redis-cli -p 6379 -a mypass info replication\"\n     - \"SETUP_MASTER=requirepass mypass\"\n     - \"occs:description=This is a clustered Redis master-slave stack. This stack depends on the user tagging the master host with 'master' and slaves as 'slave'. Because this service has a static host-bound port, only one deployment can be done per host without getting port conflicts. This example is provided as-is for educational purposes and should not be used in production.\"\n    command: sh -c \"echo $SETUP_MASTER >/tmp/redis.conf; redis-server /tmp/redis.conf\"\n\n  redis-slave:\n    image: \"redis:3.2.1-alpine\"\n    ports:\n     - \"6379:6379/tcp\"\n    environment:\n     - \"OCCS_PHASE_ID=1\"\n     - \"occs:scheduler=random\"\n     - \"occs:availability=per-tag\"\n     - \"occs:availability_context=slave\"\n     - \"occs:description=Because this service has a static host-bound port, only one deployment can be done per host without getting port conflicts. This example is provided as-is for educational purposes and should not be used in production.\"\n     - \"OCCS_HEALTHCHECK_REDIS=tcp://:6379/?timeout=10s&interval=30s\"\n     - \"CMD_INFO=redis-cli -p 6379 -a mypass info replication\"\n     - 'SETUP_SLAVE=slaveof $(echo {{ proxy \"redis-master:6379\" }} | tr \":\" \" \" )'\n     - \"SETUP_PASS=masterauth mypass\"\n     - \"SETUP=(eval echo $SETUP_SLAVE; echo $SETUP_PASS)>/tmp/redis.conf\"\n    command: sh -c \"eval $SETUP; cat /tmp/redis.conf; redis-server /tmp/redis.conf\"\n"
    },
    {
      "service_id": "Wordpress-multihost-Stack",
      "service_name": "Wordpress multihost Stack",
      "subtype": "stack",
      "content": "# https://hub.docker.com/_/wordpress/\n# Example docker-compose.yml for wordpress:\n# Run docker-compose up, wait for it to initialize completely,\n#   and visit http://localhost:8088 or http://host-ip:8088.\nversion: \"2\"\nservices:\n  wordpress:\n    image: \"wordpress:4.5.2\"\n    ports:\n      - \"80/tcp\"\n    environment:\n      - OCCS_PHASE_ID=1\n      - WORDPRESS_DB_HOST={{ proxy \"db:3306\" }}\n      - WORDPRESS_DB_PASSWORD=example\n      - MYSQL_ROOT_PASSWORD=example\n      - \"OCCS_HEALTHCHECK_WORDPRESS_HTTP=http://:80/?timeout=10s&interval=30s\"\n      - \"occs:description=This is a simple wordpress stack that can be deployed to multiple hosts or multiple times on the same host. To find the deployed port, click into the container page for this service and located the Host Ports field. Then, on the Service Discovery page, use the host port to find the IP address of the host this service is deployed to. This example is provided as-is for educational purposes and should not be used in production.\"\n  db:  # ensure db sort position is before wordpress\n    image: \"mariadb:10.1.14\"\n    ports:\n      - 3306\n    environment:\n      - OCCS_PHASE_ID=0\n      - MYSQL_ROOT_PASSWORD=example\n      - \"OCCS_HEALTHCHECK_MYSQL=tcp://:3306/?timeout=10s&interval=30s\"\n"
    },
    {
      "service_id": "Wordpress-singlehost-Stack",
      "service_name": "Wordpress singlehost Stack",
      "subtype": "stack",
      "content": "# https://hub.docker.com/_/wordpress/\n# Example docker-compose.yml for wordpress:\n# Run docker-compose up, wait for it to initialize completely,\n#   and visit http://localhost:8080 or http://host-ip:8080.\nversion: \"2\"\nservices:\n  wordpress:\n    image: \"wordpress:4.5.2\"\n    environment:\n      - \"OCCS_HEALTHCHECK_WORDPRESS_TCP=tcp://:8080/?timeout=10s&interval=30s\"\n      - \"OCCS_HEALTHCHECK_WORDPRESS_HTTP=http://:8080/?timeout=10s&interval=30s\"\n      - \"OCCS_HEALTHCHECK_WORDPRESS_POSTS=http://:8080/wp-json/posts/?timeout=10s&interval=30s\"\n      - \"occs:description=This is a simple wordpress stack that shows an example of docker links on a single host. Visit port 8080 on the host running this stack to view the running example. Because this service has a static host-bound port, only one deployment can be done per host without getting port conflicts. This example is provided as-is for educational purposes and should not be used in production.\"\n    links:\n      - \"db:mysql\"\n    ports:\n      - \"8080:80\"\n  db:\n    image: \"mariadb:10.1.14\"\n    environment:\n      - MYSQL_ROOT_PASSWORD=letmein\n      - \"OCCS_HEALTHCHECK_MYSQL=tcp://:3306/?timeout=10s&interval=30s\"\n"
    }
  ]
}
Back to Top