What is Drone?
Drone is a self-service continuous delivery platform which can be used for CICD pipelines, devopsy stuff which is really awesome.
With Configuration as Code, Pipelines are configured with a simple, easy‑to‑read file that you commit to your git repository such as github, gitlab, gogs, gitea etc.
Each Pipeline step is executed inside an isolated Docker container that is automatically downloaded at runtime, if not found in cache.
Show me pipelines!
A pipeline can look as easy as:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
Open for Testing!
I have enabled public access, so please go ahead and launch your cicd pipelines on my drone setup as I want to test the stability of it:
What are we doing?
We will deploy a drone server which is responsible for the actual server and 2 drone agents which will receive instructions from the server whenever steps need to be executed. Steps run on agents.
Deploy the Servers
I’m using VULTR to deploy 3 nodes on coreos, 1 drone server and 2 drone agents as seen below:
Documentation: https://docs.drone.io/installation/github/multi-machine/ https://github.com/settings/developers
We will use Github for version control and to delegate auth, therefore we need to register a new application on Github.
Register New Application on Github at https://github.com/settings/developer :
Get your Drone-Server Host Endpoint, and update the fields:
You will receive a Github Client ID, Secret which we will need later, which will look like this:
1 2 3 4 |
|
Generate the shared secret which will be used on the server and agent:
1 2 |
|
Create the Startup Script for Drone Server, which will just be a docker container running in detached mode. Note that you should use your own domain at SERVER_HOST
and if you want to issue an certificate automatically keep DRONE_TLS_AUTOCERT
to true.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
Create the startup script for the drone agent, note that this script needs to be placed on the agent nodes:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
Logon to the server node and start the drone server:
1
|
|
Login to the agent nodes and start the agents:
1
|
|
The server should show that it’s listening on port 80 and 443:
1 2 3 |
|
Access Drone
Access your Drone instance on port 80 eg. http://drone.yourdomain.com you should be automatically redirected to port 443, which should direct you to a login page, which will look like this:
Login with your github account and allow drone some time to sync your repositories:
Add drone config to your repository:
Clone this repository: https://github.com/ruanbekker/drone-ci-testing which will contain the .drone.yml
config which drone gets its instructions from.
Select a repository to activate, (drone-ci-testing in this case) head over to settings:
Adding secret:
Add more secrets:
Your build list should be empty:
Trigger a Build
Edit any of the files in the clone repository and you should see your build running:
When your build has completed:
You can also find out where the step ran:
Run a couple of tests:
Get notified via slack:
Debugging
If your build fails, its most likely that you need the slack_webhook
secret. You can remove the slack step which shouldhelp you get going with drone.
More on Drone
Have a look at this document for more examples or have a look at their documentation as well as their extensive list of plugins and their setup documentation to become familiar with their configuration.