}}

Customizing your install

Stable Updated: March 30, 2017

About customizing your installation parameters

The Jenkins for DC/OS package accepts a range of configuration parameters at install.

By default, Jenkins for DC/OS uses a /tmp directory on the local host to store its configuration and build data. At a minimum, you should change this before going into production. We recommend setting up a shared file system. Alternatively, you can pin to an agent.

We also expect that you’ll want to customize the default Docker container to add your own dependencies.

Using the CLI

About using the CLI

You can perform a custom installation from either the web interface or the CLI.

Creating a JSON file

  1. Create a new file.

    Tip: You might want to choose a pattern like <package-name>-config.json.

    nano jenkins-config.json
    
  2. Use the information in the configuration reference below to build your JSON. This example creates a new Jenkins for DC/OS service named jenkins-myteam and uses the NFS share located at /mnt/nfs/jenkins-data.
    {
        "service": {
            "name": "jenkins-myteam"
        },
        "storage": {
            "host-volume": "/mnt/nfs/jenkins_data"
        }
    }
    

    Tip: The value of host-volume is the base path to a share on a NFS server or other distributed filesystem. The actual path on-disk for this example is /mnt/nfs/jenkins_data/jenkins-myteam.

  3. From the CLI, pass the custom options file.
    dcos package install jenkins --options=jenkins-config.json
    

Configuration reference

Networking configuration properties

Property Type Description Default Value
virtual-host string The virtual host address to configure for integration with Marathon-LB. No default.
https-redirect boolean Indicates whether Marathon-LB should redirect HTTP traffic to HTTPS. This requires ‘virtual-host’ to be set. False
root-url string The web address of the Jenkins installation (e.g. http://jenkins.example.com). This is used by Jenkins to refer to itself when creating links in emails, chat notifications, etc. No default.
known-hosts string A space-separated list of hosts used to populate the SSH known hosts file on the Jenkins master. github.com

Storage configuration properties

Property Type Description Default Value
host-volume string The location of a volume on the host that is used for persisting Jenkins configuration and build data. The final location is derived from this value plus the name set in name (e.g. /mnt/host_volume/jenkins). Note that this path must be the same on all DC/OS agents. /tmp
pinned-hostname string An optional DC/OS agent hostname to run this Jenkins instance on (e.g. 10.0.0.1). No default.

Service configuration properties

Property Type Description Default Value
cpus number CPU shares to allocate to each Jenkins master. 1.0
name string The name of the service to display in the DC/OS dashboard. jenkins
mem number Memory (in MB) to allocate to each Jenkins master. 2048.0

Advanced configuration properties

Property Type Description Default Value
mesos-master string URL of this cluster’s Mesos master. zk://leader.mesos:2181/mesos
docker-credentials-uri string An optional URI to be fetched and extracted that contains Docker credentials (e.g. file:///etc/docker/docker.tar.gz). No default.
docker-image string The Docker image to use for the Jenkins service. By default, this package will use the Jenkins image in the Mesosphere organization on Docker Hub, which you must be authenticated against. Otherwise, specify the host, image, and tag for the Jenkins image on your private Docker Registry. No default.
jvm-opts string Optional arguments to pass to the JVM. -Xms1024m -Xmx1024m
role string The accepted resource roles (e.g. slave_public). By default, this will deploy to any agents with the * role. *

Examples

Create a new instance pinned to a single host

You can also specify an optional pinned-hostname constraint. This is useful if you don’t have NFS available and need to pin Jenkins to a specific node:

{
    "service": {
        "name": "jenkins-pinned"
    },
    "storage": {
        "host-volume": "/var/jepnkins_data",
        "pinned-hostname": "10.0.0.100"
    }
}

Modify known hosts

With the known-hosts option you can specify a space-separated list of hostnames to retrieve the SSH public keys from. This list will be populated on the Jenkins master when the bootstrap script runs (at container launch time). You must manually ensure that the SSH known hosts list is populated in any Jenkins agent containers. This is discussed further in Customizing your Docker container and you can see an example in the dcos-jenkins-dind-agent repo.

{
    "service": {
        "name": "jenkins-private-git"
    },
    "storage": {
        "host-volume": "/mnt/nfs/jenkins_data"
    },
    "networking": {
        "known-hosts": "github.com git.apache.org git.example.com"
    }
}