Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Compose file for creating a CI/CD stack using Rancher and Drone with and external MySql database and Nginx
version: '2'
services:
rancher-server:
image: rancher/server:stable
restart: unless-stopped
container_name: rancher-server
volumes_from:
- mysql
environment:
- CATTLE_DB_CATTLE_MYSQL_NAME=cattle
- CATTLE_DB_CATTLE_USERNAME=cattle
- CATTLE_DB_CATTLE_PASSWORD={$MYSQL_PASSWORD}
- CATTLE_DB_CATTLE_MYSQL_PORT=3306
- CATTLE_DB_CATTLE_MYSQL_HOST=mysql
links:
- mysql
depends_on:
- mysql
drone-server:
container_name: drone-server
image: drone/drone:0.8
ports:
- 8000:800
- 9000:9000
volumes:
- /var/lib/drone/:/var/lib/drone/
restart: unless-stopped
depends_on:
- mysql
environment:
- DRONE_HOST={$DRONE_HOST_URL}
- DRONE_OPEN=true
- DRONE_SECRET={$DRONE_SERVER_SECRET}
- DRONE_ADMIN={$DRONE_GITHUB_ADMIN}
- NO_PROXY=drone
- no_proxy=drone
- DRONE_GITHUB=true
- DRONE_GITHUB_CLIENT={$GITHUB_CLIENT_ID}
- DRONE_GITHUB_SECRET={$GITHUB_SECRET}
- DRONE_DATABASE_DRIVER=mysql
- DRONE_DATABASE_DATASOURCE=root:{$MYSQL_ROOT_PASSWORD}@tcp(mysql:3306)/drone?parseTime=true
drone-agent:
container_name: drone-agent
image: drone/agent:0.8
restart: unless-stopped
depends_on:
- drone-server
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- DRONE_SERVER=drone-server:9000
- DRONE_SECRET={$DRONE_SERVER_SECRET}
- DRONE_MAX_PROCS=3
- NO_PROXY=drone
- no_proxy=drone
mysql:
container_name: mysql
image: mysql:5.7.17
ports:
- 3308:3306
volumes:
- ./data/mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD={$MYSQL_ROOT_PASSWORD}
nginx-proxy:
container_name: nginx
image: nginx
ports:
- 80:80
- 443:443
restart: unless-stopped
volumes:
- /etc/nginx/conf.d:/etc/nginx/conf.d
- /etc/nginx/certs:/etc/nginx/certs
links:
- drone-server
- rancher-server
depends_on:
- drone-server
- rancher-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment