Skip to content

Creating new templates

Sergei Pogrebnyak edited this page Apr 30, 2018 · 10 revisions

Getting started

Create a new branch git checkout -b sag-mytemplate

Create new folder for the new template mkdir templates/sag-mytemplate && cd templates/sag-mytemplate

Create new template.yaml file with the initial minimal content

alias: sag-mytemplate
description: My template

environments:
  default:

layers:
  runtime:
    productRepo: ${repo.product}            # default repository to install products from
    fixRepo:     ${repo.fix}                # default repository to install fixes from

provision:
  default:
    runtime: ${nodes} # apply to selected nodes

Authoring the template.yaml

Add the docker-compose.yml file that meets your requirements. The minimal content:

version: "3.2"

networks: 
  default:
    external:
      name: sagdevopstemplates_default

services:
  node: # empty managed node to provision to for dev/test
    image: ${DOCKER_REGISTRY_URL}/${ORG}/commandcentral-node:${TAG}
    environment:
      - CC_AUTO_REGISTER=0

  provision: # perform provision and smoke test
    image: ${DOCKER_REGISTRY_URL}/${ORG}/commandcentral-client:${TAG}
    volumes: 
      - ./:/src/
    environment: 
      - CC_SERVER
      - CC_WAIT=1200
      - CC_CHECK_EVERY=10
    depends_on:
      - node # starts an empty node
    command: > 
      bash -c '
      echo "Register the node and wait until ready ..." &&
      sagcc add landscape nodes alias=um url="${COMPOSE_PROJECT_NAME}_node_1" -e OK --wait-for-cc &&
      sagcc list landscape nodes um -e ONLINE &&
      echo "Apply the template ..." &&
      sagcc exec templates composite apply sag-um-server -e DONE --sync-job -i env.properties nodes=um repo.product=products repo.fix=fixes &&
      echo "Start the instance ..." &&
      sagcc exec lifecycle start um Universal-Messaging-default -e DONE --sync-job &&
      echo "Check managed container status ..." &&
      sagcc list monitoring state um Universal-Messaging-default -e ONLINE
      '

Run provisioning service:

docker-compose run --rm provision
Clone this wiki locally