Skip to content

Instantly share code, notes, and snippets.

@learncodeacademy
Created June 28, 2017 16:28
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save learncodeacademy/7ef627854b476883d4730957b4e1f973 to your computer and use it in GitHub Desktop.
Save learncodeacademy/7ef627854b476883d4730957b4e1f973 to your computer and use it in GitHub Desktop.
Rancher Drone CD Pipeline Setup
pipeline:
slack:
image: plugins/slack
webhook: <your slack webhook url>
channel: deployments
username: drone
template: "<{{build.link}}|Deployment #{{build.number}} started> on <http://github.com/{{repo.owner}}/{{repo.name}}/tree/{{build.branch}}|{{repo.name}}:{{build.branch}}> by {{build.author}}"
when:
branch: [ master, staging ]
build:
image: <your base image, say node:6.10.0>
commands:
- yarn install
- yarn test
environment:
- SOME_ENV_VAR=some-value
ecr:
image: plugins/ecr
access_key: ${AWS_ACCESS_KEY_ID}
secret_key: ${AWS_SECRET_ACCESS_KEY}
repo: <your repo name>
dockerfile: Dockerfile
storage_path: /drone/docker
rancher:
image: peloton/drone-rancher
url: <your rancher url>
access_key: ${RANCHER_ACCESS_KEY}
secret_key: ${RANCHER_SECRET_KEY}
service: core/platform
docker_image: <image to pull>
confirm: true
timeout: 240
slack:
image: plugins/slack
webhook: <your slack webhook>
channel: deployments
username: drone
when:
branch: [ master, staging ]
status: [ success, failure ]
version: '2'
services:
drone-server:
image: drone/drone:0.5
environment:
DRONE_GITHUB: 'true'
DRONE_GITHUB_CLIENT: <github client>
DRONE_GITHUB_SECRET: <github secret>
DRONE_OPEN: 'true'
DRONE_ORGS: myGithubOrg
DRONE_SECRET: <make up a secret!>
DRONE_GITHUB_PRIVATE_MODE: 'true'
DRONE_ADMIN: someuser,someotheruser,
DRONE_DATABASE_DRIVER: mysql
DRONE_DATABASE_DATASOURCE: user:password@tcp(databaseurl:3306)/drone?parseTime=true
volumes:
- /drone:/var/lib/drone/
ports:
- 80:8000/tcp
labels:
io.rancher.scheduler.affinity:host_label: drone=server
drone-agent:
image: drone/drone:0.5
environment:
DRONE_SECRET: <make up a secret!>
DRONE_SERVER: ws://drone-server:8000/ws/broker
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command:
- agent
labels:
io.rancher.scheduler.affinity:host_label_ne: drone=server
io.rancher.scheduler.global: 'true'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment