Support Online
Skip to main content

Drone CI/CD Setup

What Will You Learn in This Guide?

In this guide, you will learn how to install the Drone CI/CD platform on Ubuntu 20.04.
You will integrate GitHub, add Docker runner, and run a secure pipeline with SSL.

Technical Summary

Subject: Drone CI/CD installation on Ubuntu 20.04
Problem: Need for lightweight and container-based CI/CD
Solution: Drone server + Docker runner architecture
Steps: OAuth → Drone configuration → Runner → YAML pipeline


Preliminary Preparations

The following is required before continuing:

  • Ubuntu 20.04 server with at least 1 GB RAM
  • A domain name directed to the server IP
  • Docker installation on the server
  • A GitHub account

Note: drone.ornek.com is used as the example domain name.


Creating a GitHub OAuth App

Drone uses OAuth for authentication with GitHub.

On GitHub, go to Settings → Developer settings → OAuth Apps.
Create a new application.

Store the generated Client ID and Client Secret values.


Creating the Drone Configuration

Generate secret key for server and runner communication.

openssl rand -hex 16
  • This command generates the Drone RPC key.


cat << 'EOF' | sudo tee /etc/drone
DRONE_SERVER_HOST=drone.ornek.com
DRONE_SERVER_PROTO=https
DRONE_GITHUB_CLIENT_ID=github_client_id
DRONE_GITHUB_CLIENT_SECRET=github_client_secret
DRONE_RPC_SECRET=rpc_secret
DRONE_USER_CREATE=username:github_kullanici_adi,admin:true
DRONE_TLS_AUTOCERT=true
EOF
  • This configuration prepares the Drone server with HTTPS.

Starting Drone Server with Docker

  1. Download the drone image.

docker pull drone/drone:1

  1. Create a persistent data area.

docker volume create drone-data

  1. Start the drone server.

docker run --name=drone --detach --restart=always \
--env-file=/etc/drone \
--volume=drone-data:/data \
--publish=80:80 \
--publish=443:443 \
drone/drone:1
  • This command runs the Drone server in the background.

  1. Open ports on the firewall.

sudo ufw allow 80
sudo ufw allow 443
sudo ufw reload

Docker Runner Installation

  1. The drone runs jobs through the runner.

docker pull drone/drone-runner-docker:1


docker run --name drone-runner --detach --restart=always \
--volume=/var/run/docker.sock:/var/run/docker.sock \
-e DRONE_RPC_PROTO=https \
-e DRONE_RPC_HOST=drone.ornek.com \
-e DRONE_RPC_SECRET=rpc_secret \
-e DRONE_RUNNER_CAPACITY=2 \
-e DRONE_RUNNER_NAME=$&#123;HOSTNAME&#125; \
drone/drone-runner-docker:1
  • This build starts the Docker-based runner.

Creating the First Pipeline

  1. Create a new repository on GitHub.

  2. Add the .drone.yml file to the repository.


kind: pipeline
type: docker
name: test-pipeline

steps:
- name: hello
image: alpine
commands:
- echo "Drone kurulumu basarili"
  • The pipeline runs automatically when the file is committed.

Frequently Asked Questions (FAQ)

1. Why Drone instead of Jenkins? Drone is lighter and completely container-oriented.

2. Is the drone free? Yes. The open source version is sufficient for most uses.

3. How to determine runner capacity? Adjust the number of concurrent jobs based on your CPU and RAM capacity.

4. Where are the logs stored? By default, they are kept in the database. S3 compatible storage is recommended for heavy use.


Result

With this guide, you have installed the Drone CI/CD infrastructure on Ubuntu 20.04. You now have a fast and secure automation process for your GitHub projects.

You can make your CI/CD processes scalable by using this structure in the GenixNode infrastructure.