Skip to content

JSONish Configuration

aminjam edited this page Oct 8, 2014 · 6 revisions

#JSONish Configuration

The following code block will list all of the possible options in the hipops configuration. Required properties will have REQ prefix in the value.

{
  "id": "REQ_UNIQUE_IDENTIFIER_OF_STACK e.g. blogs",
  "description": "",
  "env": "REQ_UNIQUE_IDENTIDIER_OF_ENV e.g. prod,dev,stage",
  "user": "REQ_REMOTE_USER e.g. ubuntu",
  "dest": "REQ_BASE_DEST_PATH_FOR_DATA_PERSISTENCY e.g. /data",
  "apps": [{
    "name": "REQ_UNIQUE_NAME_FOR_APP e.g. backend-api",
    "type": "TYPE_OF_APP (DEFAULTS_TO=generic) this is for scoping your applications. If set to `generic`, it will a host-level app without the naming convention",
    //OPTIONAL REPOSITORY
    "repository":{
      "branch": "OPTIONAL_REPOSITORY_BRANCH (DEFAULTS_TO=master)",
      "sshUrl": "REQ_REPOSITORY_SSH_URL e.g. github.com/aminjam/hipops-SAMOMY-mysql.git",
      "sshKey": "OPTIONAL_PATH_TO_GIT_SSH_KEY (OVER_WRITTEN by `--git-key`) e.g./Users/ajamali/.ssh/id_rsa",
      "folder": "OPTIONAL_IF_DEPLOYING_CODE_IS_IN_A_SUBFOLDER e.g. dist/"
    },
    "cred": {
      "dbName": "OPTIONAL_DB_NAME",
      "username": "OPTIONAL_USERNAME e.g. `admin` username for mysql container",
      "password": "OPTIONAL_PASSWORD e.g. password for mysql container"
    },
    //OPTIONAL FILES TO COPY TO HOST
    "customizations": [{
      "src": "REQ 1.Relative Path 2.Absolute Path 3.http:// endpoint",
      "dest": "REQ 1.Absolute Path 2.If Only the filename, the default convention is used, and accessible by {{.App.Dest}} in playbook section",
      "mode": "OPTIONAL (DEFAULTS_TO:400) e.g. 744 for executable"
    }],
    "image": "DOCKER_IMAGE_TO_PULL e.g. aminjam/nodejs",
    "ports": [OPTIONAL_ARRAY_OF_NUMBERS]
  }],
  "playbooks": [{
    "inventory": "HOSTS_TAGS e.g. tag_NAME_BLOGS-EC2",
    "play":"OPTIONAL_NAME_OF_THE_PLAYBOOK.yml (DEFAULTS_TO=hipops.yml)"
    "actions": [{
      "image": "REQ_IF_NO_APPS e.g. progrium/ambassadord",
      "params": "--name backends -d progrium/ambassadord "
    }, {
      "image": "progrium/ambassadord",
      "params": "--name setup_ip --rm --privileged --net container:backends progrium/ambassadord --setup-iptables"
    }]
  }, {
    "inventory": "HOSTS_TAGS e.g. tag_NAME_BLOGS-EC2",
    "state": "OPTIONAL (DEFAULTS_TO=running) if set to `deploying` the container is redeployed every time the hipops is executed",
    "apps": ["ARRAY_OF_APPS e.g. {{index .Apps 0}},{{index .Apps 1}}"],
    "actions": [{
      "params": "-v {{.App.Dest}}:/home/app -p 27017:{{index .App.Ports 0}} -e SERVICE_NAME={{.App.Name}} -e BACKEND_{{index .App.Ports 0}}={{.App.Name}}.service.consul --link backends:backends -d {{.App.Image}} /run.sh"
    }]
  }]
}

###Notes

  • actions.params: You can chain a series of docker actions for groups of apps here. Let's say there were 2 apps in the array and 3 actions. hipops will run 3 actions for each of those apps in the array, for a total of 6 containers. Note that {{ ansible_* }} is reserved for all ansible configurations, like {{ ansible_hostname }} or {{ ansible_eth1.ipv4.address }}, so for a full list of possible values checkout ansible docs. Any other {{.App.*}} will get evaluated like a golang template for the app in scope, so for example {{.App.Name}} will refer to the name of the App from above in the format of ID-ENV-NAME. {{.App.Dest}} is a unique property that is available to you for data persistency of the containers.

Please see the scenarios section for more examples

Clone this wiki locally