Skip to content

Latest commit

 

History

History
102 lines (71 loc) · 7.47 KB

INSTALL.md

File metadata and controls

102 lines (71 loc) · 7.47 KB

GoCD Elastic agent plugin for Docker Swarm

Table of Contents

Requirements

  • GoCD server version v17.9.0 or above
  • Docker Swarm Cluster

Installation

  • Copy the file build/libs/docker-swarm-elastic-agents-VERSION.jar to the GoCD server under ${GO_SERVER_DIR}/plugins/external and restart the server.
  • The GO_SERVER_DIR is usually /var/lib/go-server on Linux and C:\Program Files\Go Server on Windows.

Configuration

Configure plugin settings

The plugin settings are used to provide global level configurations for the plugin. Configurations such as docker swarm cluster configuration and private registry settings are provided in plugin settings.

  1. Login to GoCD server as admin and navigate to Admin > Plugins

    Plugins

  2. Click on Settings icon of GoCD Elastic agent plugin for Docker Swarm to update plugin settings configuration.

    Configure plugin settings

    Field Name Mandatory Description
    Go server url Yes GoCD server url(https://YOUR_HOST_OR_IP_ADDRESS:8154/go). The docker elastic agent will use this URL to register itself with GoCD.
    The GoCD hostname or ip must resolve in your container. Don't use localhost or 127.0.0.1
    Environment variables No The environment variable for docker container
    Agent auto-register timeout Yes Agent auto-register timeout(in minutes). Plugin will kill the agent container if it fails to register within provided time limits
    Maximum docker containers Yes Maximum docker containers to run at any given point in time. Plugin will not create more container when running container count reached to specified limits
    Docker URI Yes Docker swarm cluster uri.
    If your Go Server is running on local machine then use(for mac and linux) — unix:///var/run/docker.sock
    Docker CA Certificate No Docker swarm cluster CA certificate
    Docker Client Key No Docker swarm cluster client key
    Docker Client Certificate No Docker swarm cluster client certificate
    Private Docker Registry Yes Optionally specify the private docker registry settings

Create an elastic profile

The Elastic Agent Profile is used to define the configuration of a docker container(GoCD docker agent). The profile is used to configure the docker image, set memory limits, provide docker command and environment variables etc...

  1. Login to GoCD server as admin and navigate to Admin > Elastic Agent Profiles

    Elastic Profiles

  2. Click on Add to create new elastic agent profile

    Create elastic profile

    Field Name Mandatory Description
    Id Yes Unique id for current profile
    Plugin id Yes Select GoCD Docker Swarm Elastic Agents for Plugin id
    Docker image Yes GoCD elastic agent docker image name. Pre build GoCD agent docker images are available here
    Memory soft limit Yes Soft memory limit. Container will start with memory specified here
    Maximum hard limit Yes Hard memory limit for container
    Docker Command No Commands that you want to execute on container start.
    Note: This will override the existing docker entry-point defined in docker image.
    Environment Variables No Environment variables for container. This will overrides the environment variables defined in plugin settings.(enter each per line)
    Secrets No Allows users bind a docker secret with container(enter each per line)
    Network attachments No Allows user to attach docker networks to container(enter each per line)
    Volume Mounts No Allows user to mount/bind volume to docker container(enter each per line)
    Host entries No This allows users to add host entries in /etc/hosts(enter each per line)
    Constraints No You can limit the set of nodes where a task can be scheduled by defining constraint expressions.
    Multiple constraints find nodes that satisfy every expression (AND match, enter each per line)

Configure job to use an elastic agent profile

  1. Click the gear icon on Pipeline

    Pipeline

  2. Click on Quick Edit button

    Quick edit

  3. Click on Stages

  4. Create/Edit a job

  5. Enter the unique id of an elastic profile in Job Settings

    Configure a job

  6. Save your changes