Setting up Drone CI/CD

CI/CD pipelines is a must for rapid prototyping and development of applications. Be it frontend or backend.

One of the open source tool for CI/CD is the one called Drone

Setup of this tool is extremely simple.

Requirements

  • docker installation on your system

Just ssh into your server and run the following command

docker run \
  --volume=/var/run/docker.sock:/var/run/docker.sock \
  --volume=/var/lib/drone:/data \
  --env=DRONE_RUNNER_CAPACITY=10 \
  --env=DRONE_SERVER_HOST=drone.example.com \
  --env=DRONE_SERVER_PROTO=https \
  --env=DRONE_TLS_AUTOCERT=true \
  --publish=80:80 \
  --publish=443:443 \
  --restart=always \
  --detach=true \
  --name=drone \
  --env=DRONE_BITBUCKET_CLIENT_ID=${BITBUCKET_KEY} \
  --env=DRONE_BITBUCKET_CLIENT_SECRET=${DRONE_BITBUCKET_CLIENT_SECRET} \
  --env=DRONE_USER_FILTER=user1,user2,user3 \
  --env=DRONE_USER_CREATE=username:user1,admin:true \
  drone/drone:1

NOTES

  • --volume=/var/lib/drone:/data : to persist to data to our local filesystem
  • --env=DRONESERVERHOST=drone.example.com --env=DRONESERVERPROTO=https env=DRONETLSAUTOCERT=true --publish=80:80 --publish=443:443: required for exposing it to the internet and issuing https certificates. You can ignore all these options if you don't need the functionality.
  • --env=DRONEBITBUCKETCLIENTID=${BITBUCKETKEY} --env=DRONEBITBUCKETCLIENTSECRET=${DRONEBITBUCKETCLIENTSECRET}: To link with bitbucket installation
  • --env=DRONEUSERFILTER=user1,user2,user3 --env=DRONEUSERCREATE=username:user1,admin:true: Default user creation and filtering since drone installation is open to everyone by default