Installation Guide for Drone on Pop!_OS

Drone is a continuous integration and delivery platform that helps in automating the software development lifecycle. If you are using Pop!_OS as your operating system, this tutorial will give you step-by-step instructions to install Drone.

Prerequisites

Before installing Drone, we need the following tools installed on our system:

You can install Docker by following the instructions here. You can install Git and OpenSSL by running the following commands:

sudo apt update
sudo apt install git openssl

Install Drone

The installation of Drone involves the following steps:

  1. Create a database for Drone
  2. Generate Drone server and runner tokens
  3. Start the Drone server and runner

Step 1: Create a database for Drone

Drone stores its metadata in a database. We can use the PostgreSQL database for this purpose. You can install PostgreSQL by running the following command:

sudo apt install postgresql postgresql-client

After installing PostgreSQL, create a user and a database for Drone:

sudo -u postgres createuser drone --pwprompt
sudo -u postgres createdb drone

Make a note of the password that you set for the user drone.

Step 2: Generate Drone server and runner tokens

Drone uses tokens to authenticate between the server and runner. We will generate tokens for the server and runner using OpenSSL.

openssl rand -hex 16

You will get a random string of 32 characters. Set it as an environment variable:

export DRONE_RPC_SECRET=<your-random-string>

Generate the runner token:

openssl rand -hex 16

Set it as an environment variable:

export DRONE_RPC_SECRET=<your-runner-string>

Step 3: Start the Drone server and runner

Now we can start the Drone server and runner using Docker. Create a file docker-compose.yml with the following configuration:

version: '2'

services:
  drone-server:
    image: drone/drone:latest
    ports:
      - 80:80
      - 443:443
    volumes:
      - /var/lib/drone:/data
    restart: always
    environment:
      - DRONE_AGENTS_ENABLED=true
      - DRONE_RPC_SECRET=${DRONE_RPC_SECRET}
      - DRONE_SERVER_HOST=<your-server-hostname>
      - DRONE_SERVER_PROTO=http
      - DRONE_TLS_AUTOCERT=false
      - DRONE_USER_CREATE=username:<your-github-username>,admin:true
      - DRONE_GITHUB_CLIENT_ID=<your-client-id>
      - DRONE_GITHUB_CLIENT_SECRET=<your-client-secret>

  drone-runner:
    image: drone/drone-runner-docker:latest
    restart: always
    depends_on:
      - drone-server
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DRONE_RPC_SECRET=${DRONE_RPC_SECRET}
      - DRONE_RPC_HOST=<your-server-hostname>
      - DRONE_RPC_PROTO=http
      - DRONE_RUNNER_CAPACITY=2

Replace <your-server-hostname> with the hostname or IP address of your server. Replace <your-github-username>, <your-client-id>, and <your-client-secret> with your GitHub username, client ID, and client secret respectively.

Start the Drone services using Docker Compose:

docker-compose up -d

You can access the Drone web interface at http://your-server-hostname and log in using your GitHub account.

Conclusion

This tutorial has provided the steps to install Drone on Pop!_OS. You can now use Drone to automate your software development workflows.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!