version: '2'
catalog:
  name: GoCD
  version: 17.3.0-rancher1
  minimum_rancher_version: v1.5.0
  questions:
    - variable: "DEPLOY_SERVER"
      description: "Deploy GoCD server"
      label: "Deploy GoCD server"
      required: true
      type: enum
      default: "true"
      options:
        - "true"
        - "false"
    - variable: "DEPLOY_AGENT"
      description: "Deploy GoCD agent"
      label: "Deploy GoCD agent"
      required: true
      type: enum
      default: "true"
      options:
        - "true"
        - "false"
    - variable: "GOCD_AGENT_SCALE"
      description: "Number of GoCD agent"
      label: "GoCD Agents"
      required: true
      default: 1
      type: "string"
    - variable: "GOCD_AGENT_KEY"
      description: "Key to use for auto registration agent"
      label: "Agent key"
      required: true
      type: "password"
    - variable: "GOCD_SERVER_MEMORY"
      description: "Max memory allowed to GoCD server"
      label: "Max memory for server"
      type: "string"
      required: true
      default: "1024m"
    - variable: "GOCD_AGENT_MEMORY"
      description: "Max memory allowed to GoCD agent"
      label: "Max memory for agent"
      type: "string"
      required: true
      default: "2048m"
    - variable: "GOCD_AGENT_RESOURCE"
      description: "Resource name associated for agent"
      label: "Resource name"
      type: "string"
      required: true
      default: "docker"
    - variable: "GOCD_USER"
      description: "Login to connect on GoCD"
      label: "Login"
      type: "string"
      required: true
      default: "admin"
    - variable: "GOCD_PASSWORD"
      description: "Password to connect on GoCD"
      label: "Password"
      type: "password"
      required: true
    - variable: "GOCD_AGENT_PACKAGE"
      description: "Install GoCD extra plugins"
      label: "Install extra plugins"
      required: true
      type: enum
      default: "true"
      options:
        - "true"
        - "false"
    - variable: "VOLUME_DRIVER_SERVER"
      description: "Docker driver to store volume or base path for GoCD server"
      label: "Volume drver / Path for server"
      type: "string"
      required: true
      default: "local"
    - variable: "VOLUME_DRIVER_AGENT"
      description: "Docker driver to store volume or base path for GoCD agent"
      label: "Volume drver / Path for agent"
      type: "string"
      required: true
      default: "local"
    - variable: "DEPLOY_LB"
      description: "Deploy Loadbalancer"
      label: "Deploy Loadbalancer"
      required: true
      type: enum
      default: "true"
      options:
        - "true"
        - "false"
    - variable: "PUBLISH_PORT"
      description: "Set port if you want publish external port for GoCD server or Loadbalancer"
      label: "Publish port"
      required: false
      type: "string"
      default: "8153"
    - variable: "GOCD_SERVER_URL"
      description: "The server URL use by agent to auto register. Don't touch if you deploy server and agent"
      label: "Server URL"
      required: true
      type: "string"
      default: "https://gocd-server:8154/go"
    - variable: "CONFD_BACKEND"
      description: "The confd backend to grab config"
      label: "Confd backend"
      required: true
      default: "env"
      type: "string"
    - variable: "CONFD_NODES"
      description: "The confd nodes"
      label: "Confd nodes"
      required: false
      type: "string"
    - variable: "CONFD_PREFIX"
      description: "The confd prefix"
      label: "Confd prefix"
      required: true
      default: "/gocd"
      type: "string"
      
services:
  gocd-agent:
    scale: ${GOCD_AGENT_SCALE}
    retain_ip: true
  gocd-server:
    scale: 1
    retain_ip: false
    health_check:
      port: 8153
      interval: 5000
      unhealthy_threshold: 3
      request_line: ''
      healthy_threshold: 2
      response_timeout: 5000
  lb:
    scale: 1
    start_on_create: true
    lb_config:
      certs: []
      port_rules:
      - priority: 1
        protocol: http
        service: gocd-server
        source_port: 8153
        target_port: 8153
    health_check:
      response_timeout: 2000
      healthy_threshold: 2
      port: 42
      unhealthy_threshold: 3
      interval: 2000