Skip to content

Instantly share code, notes, and snippets.

@jteso
Last active November 10, 2015 23:34
Show Gist options
  • Save jteso/89bfcd83b36813838e65 to your computer and use it in GitHub Desktop.
Save jteso/89bfcd83b36813838e65 to your computer and use it in GitHub Desktop.
Tanfile concepts

Concept 1: Provision and Deploy with Docker Compose

The following tanfile will provision and deploy a multi-tiered application via docker-compose. It implicitly copies via ssh the file docker-compose.yml from current directory into a new provisioned GCE micro instance.

<gce-vm name="test-vm" size="f1-micro" image="container-vm" zone="au-syd-1">
    <docker-compose></docker-compose>
</gce-vm>

Concept 2: Provision and Deploy with Docker Only

<gce-vm name="test-vm" size="f1-micro" image="container-vm" zone="au-syd-1">
    <docker-run build="." name="web" port="{'8000':'8000'}" image="webapp-nginx" command="nginx start"></docker-run>
</gce-vm>

Concept 3: Clusters, Pods, Containers ...

(a) Single Container Pod

<gce-cluster name="tan_cluster" zone="au1-standard">
    <gce-pod name="web_pod" image="nginx"></gce-pod>
</gce-cluster>

(b) Multi Container Pod

<gce-cluster name="test_cluster" zone="au1-standard">
    <gce-pod name="test_app_pod" file="./podConfigFile.json"></gce-pod>
</gce-cluster>

or explicitly indicate the Pod configuration file:

<gce-cluster name="test_cluster" zone="au1-standard">
    <gce-pod name="test_app_pod">
        <gce-pod-configfile json="
            {
              "kind": "Pod",
              "apiVersion": "v1",
              "metadata": {
                "name": "redis_django",
                "labels": {
                  "app": "webapp"
                }
              },
              "spec": {
                "containers": [
                  {
                    "name": "key-value-store",
                    "image": "redis",
                    "ports": [
                      {
                        "containerPort": 6379,
                      }
                    ]
                  },
                  {
                    "name": "frontend",
                    "image": "django",
                    "ports": [
                      {
                        "containerPort": 8000,
                      }
                    ]
                  }
                ]
              }}"></gce-pod-configfile>
        
    </gce-pod>
</gce-cluster>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment