Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
topics:docker-install-gitlab-ci-runner [2017/04/09 16:09]
orzfly created
topics:docker-install-gitlab-ci-runner [2017/04/09 17:09] (current)
orzfly
Line 10: Line 10:
 EXAMPLE # find at https://git.EXAMPLE.com/admin/runners EXAMPLE # find at https://git.EXAMPLE.com/admin/runners
 Please enter the gitlab-ci description for this runner: Please enter the gitlab-ci description for this runner:
-[EXAMPLE00000]: digitalocean-auto-nyc3+[EXAMPLE00000]: EXAMPLE-digitalocean-auto-nyc3
 Please enter the gitlab-ci tags for this runner (comma separated): Please enter the gitlab-ci tags for this runner (comma separated):
-digitalocean,digitalocean-nyc3,linux+EXAMPLE,digitalocean,digitalocean-nyc3,linux
 Whether to run untagged builds [true/false]: Whether to run untagged builds [true/false]:
 [false]: true [false]: true
Line 22: Line 22:
 Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded! Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
 </code> </code>
-  - Create ''/srv/gitlab-ci-runner/digitalocean-auto-nyc3/config/config.toml''<code toml /srv/gitlab-ci-runner/digitalocean-auto-nyc3/config/config.toml>+  - Create ''/srv/gitlab-ci-runner/EXAMPLE/config/config.toml'' 
 +    * DigitalOcean: <code toml /srv/gitlab-ci-runner/digitalocean-auto-nyc3/config/config.toml>
 concurrent = 5 concurrent = 5
  
Line 30: Line 31:
   token = "FIND_AT https://git.EXAMPLE.com/admin/runners/EXAMPLE"   token = "FIND_AT https://git.EXAMPLE.com/admin/runners/EXAMPLE"
   executor = "docker+machine"   executor = "docker+machine"
 +  environment = ["DOCKER_AUTH_CONFIG={...}"]
   [runners.docker]   [runners.docker]
     image = "ubuntu:xenial"     image = "ubuntu:xenial"
Line 51: Line 53:
     ]     ]
 </code> </code>
 +      * List all images: <code shell-session>$ curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer EXAMPLE_YOUR_TOKEN" "https://api.digitalocean.com/v2/images?page=1&per_page=1000&type=application"</code>
 +    * AWS EC2: <code toml /srv/gitlab-ci-runner/auto-aws-us-west-1/config/config.toml>
 +concurrent = 5
 +
 +[[runners]]
 +  name = "auto-aws-us-west-1"
 +  url = "https://git.EXAMPLE.com/ci"
 +  token = "FIND_AT https://git.EXAMPLE.com/admin/runners/EXAMPLE"
 +  executor = "docker+machine"
 +  environment = ["DOCKER_AUTH_CONFIG={...}"]
 +  [runners.docker]
 +    image = "ubuntu:xenial"
 +    tls_verify = false
 +    privileged = true
 +    disable_cache = true
 +  [runners.cache]
 +    Insecure = false
 +  [runners.machine]
 +    IdleCount = 0
 +    IdleTime = 1200
 +    MachineDriver = "amazonec2"
 +    MachineName = "orzgit-%s"
 +    MachineOptions = [
 +      "amazonec2-access-key=EXAMPLE",
 +      "amazonec2-secret-key=EXAMPLE",
 +      "amazonec2-region=us-west-1",
 +      "amazonec2-ami=ami-615cb725",
 +      "amazonec2-ssh-user=ubuntu",
 +      "amazonec2-instance-type=t2.medium"
 +    ]
 +</code>
 +      * AWS AMI is only available per region! https://cloud-images.ubuntu.com/releases/14.04/release-20150603/
   - Save systemd configuration<code ini /etc/systemd/system/gitlab-ci-runner@.service>   - Save systemd configuration<code ini /etc/systemd/system/gitlab-ci-runner@.service>
 [Unit] [Unit]
Line 81: Line 115:
 # systemctl start gitlab-ci-runner@digitalocean-auto-nyc3.service # systemctl start gitlab-ci-runner@digitalocean-auto-nyc3.service
 </code> </code>
 +
 +===== Notes =====
 +  * Version
 +    * https://gitlab.com/gitlab-org/gitlab-ci-multi-runner#runner-and-gitlab-ceee-compatibility
 +    * Runner v9.0+ requires GitLab v9.0
 +    * Runner v1.11.x supports GitLab v8.16.x ~ v9.5.x
 +  * Private Docker Registry? Add ''DOCKER_AUTH_CONFIG''
 +    * https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/configuration/advanced-configuration.md#using-a-private-container-registry
 +  * Self-signed SSL?
 +    * https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/configuration/tls-self-signed.md
 +    * Mount your certificate file at ''/etc/gitlab-runner/certs/git.EXAMPLE.com.crt'' with Docker volume
 +  * Do NOT stop runners if it has started any VMs! Just wait until all VMs terminated. If you do...
 +    - Terminate all machines on your own at DigitalOcean/AWS/YourCloud...
 +    - Remove all folders in ''/srv/gitlab-ci-runner/EXAMPLE/home/.docker/machine/machines/''
  
 ===== See Alsos ===== ===== See Alsos =====
   * https://hub.docker.com/r/gitlab/gitlab-runner/tags/   * https://hub.docker.com/r/gitlab/gitlab-runner/tags/
 +  * https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/install/docker.md
 +  * https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/install/autoscaling.md
 +  * https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/configuration/advanced-configuration.md
 +  * https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/configuration/autoscale.md
 +  * https://docs.docker.com/machine/drivers/
 +  * https://github.com/janeczku/docker-machine-vultr
  
-{{tag>docker-install gitlab}}+{{tag>docker-install gitlab gitlab-ci}}