Getting started with open-source Drone CI

Alex Barashkov
Apr 12, 2019 · 4 min read
Image for post
Image for post
  • Yaml-based configuration
  • Multi pipelines and complex build step logic support
  • Docker based
  • Free
  • Github, Gitlab, Bitbucket support

Get the Host

For the purposes of this test, we use an AWS EC2 free tier instance, but you can use whatever you want. To use our approach, follow these steps:

  • Add your SSH pub key to Key Pairs section on the EC2 page (to access your — instance via SSH);
  • Create a new Ubuntu 18.04 free tier instance on AWS;
  • Allow 80 and 443 ports for the Security Group of your instance; if it’s a fresh account, use launch-wizard-1, or find it in description of your EC2 instance.

Install Docker

You only need Docker to start using Drone. Just follow the instructions here. Check that you installed everything right by running “docker -v”.

root@ip-172-31-23-205:~# docker -v
Docker version 18.09.3, build 774a1f4

Create an OAuth Application

We use Github for examples, but you can also run it on Gitlab, Bitbucket, Gitea, and Gogs. More information here.

  • Click “new oAuth app”.
  • Fill out the form, as per the example below.
Image for post
Image for post

Install Drone

This is very simple, just use the following:

docker pull drone/drone:1
--volume=/var/run/docker.sock:/var/run/docker.sock \
--volume=/var/lib/drone:/data \
--env=DRONE_GITHUB_SERVER=https://github.com \
--env=DRONE_GITHUB_CLIENT_ID=652d1he1a62b6336bf0 \
--env=DRONE_GITHUB_CLIENT_SECRET=c8990176a4bfywe55ekj8c3cf6d0ffccb8e3a213e \
--env=DRONE_RUNNER_CAPACITY=2 \
--env=DRONE_SERVER_HOST=drone1.pixelpoint.io \
--env=DRONE_SERVER_PROTO=https \
--env=DRONE_TLS_AUTOCERT=true \
--env=DRONE_USER_FILTER=lnikell \
--env=DRONE_USER_CREATE=username:lnikell,admin:true \
--publish=80:80 \
--publish=443:443 \
--restart=always \
--detach=true \
--name=drone \
drone/drone:1
Image for post
Image for post

Define Your Pipeline

Once you have your Drone CI instance ready, it’s time to activate the repository and create your pipeline. First, find the repository using the search bar and activate it.

Image for post
Image for post
Image for post
Image for post
kind: pipeline
name: default
steps:
- name: frontend
image: node
commands:
- npm ci
- npm run test:unit
Image for post
Image for post
  • Deploying to Kubernetes
  • Pushing images to a Docker registry
  • Running database or other service instances required for tests
  • Running multiple pipelines and using multiplatforms
Image for post
Image for post

Pixel Point

Web design and development. Fair price, great quality.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store