Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

target/gelvedere

Repository files navigation

Deprecation Warning

As of May 2021, this project has been deprecated and is now archived in favor of using vela

gelvedere

license release watch star

Cli to deploy a Jenkins master within Docker Swarm

How It Works

gelvedere provides a CLI for creating a Jenkins master within Docker swarm. Currently there are 2 types of input files required.

  • admin.json - contains information specific to deploying the master within docker swarm
  • user.json - contains information specific to Jenkins ACL configuration

More background information can be found at our blog post here

Getting Started

A sample command to run gelvedere:

gelvedere --user-config /jenkins/user-configs/test.json --admin-config /jenkins/admin-configs/test.json --domain acme.com

Input files

A sample user.json file:

{
  "name": "example",
  "admins": "target*Jenkins",
  "members": ""
}

A sample admin.json file:

{
  "ghe_key": "1234",
  "ghe_secret": "56789",
  "port": "50000",
  "admin_ssh_pubkey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDVr+0LAocyLbzzvQEdwjU8o+w0IYpR4R0uf2mswNYz6utcUVqHp5VXFog6YL4gYf0Q7naorLGh/zbROGHmBGAUngUbvy1vAnyiiBEjLPhW5k6iLy9f3N2lZyDQJ/VZYeRzfSeOPyEfd13MOjR8kB0zrodFa5j3fIToUrPmLytAVWplbF002jjJOTjwhFaknbdcVTzQ1LxhaOCaVjbEQyuFB3e8mB15kGEJOllnq4Un1HnG6wOcSx8IwP/E1JcmChfM3pPY2PIpYRqYaT4SYKGua+qke90aPNFl/k3j3J3yl2ZKGno/tJjj50sbTDgNz46uTLuLI2Eb6ETeI3d2Jy0Z [email protected]",
  "size": "small",
  "image": "target/jenkins-docker-master:2.73.1-1"
}

Information on generating the values for the user.json and admin.json file can be found here

Storage

gelvedere makes the assumption that you are using local storage for each master, but you can override the storage path with a environment variable or cli argument.

The below example will create a docker swarm service with a mount source of /jenkins/stores and a target of /var/jenkins_home.

gelvedere --user-config /jenkins/user-configs/stores.json --admin-config /jenkins/admin-configs/stores.json --mount-path /jenkins/stores

Custom Environment Variables

By default gelvedere adds the following environment variables to the Docker swarm service:

  • JENKINS_ACL_MEMBERS_admin
  • JENKINS_ACL_MEMBERS_developer
  • JENKINS_URL
  • GHE_KEY
  • GHE_SECRET
  • ADMIN_SSH_PUBKEY
  • JENKINS_SLAVE_AGENT_PORT
  • JAVA_OPTS

More information on the above configuration options can be found here

You can add additional variables by setting the following configuration in the admin.json input file.

{
    "env_variables": {
        "<variable name>": "<variable value>",
        "<variable name>": "<variable value>"
    }
}

Custom docker logging

By default gelvedere does not create Docker swarm services with logging drivers, but you can override that behavior by adding contents into the admin.json file.

The below example sends logs in the gelf format

  "log_config": {
    "driver": "gelf",
    "gelf-address": "udp://gelf.example.com:12201",
    "tag": "custom-tag"
  }

CLI Installation

Install on Linux

curl -L https://github.com/target/gelvedere/releases/download/v0.1.2/gelvedere-linux-amd64.tgz | tar zx

sudo install -t /usr/local/bin gelvedere

Install on macOS

curl -L https://github.com/target/gelvedere/releases/download/v0.1.2/gelvedere-darwin-amd64.tgz | tar zx

sudo cp gelvedere /usr/local/bin/