Drone is a Continuous Integration and Continuous Deployment (CI/CD) platform that enables developers to automate software testing and deployment processes. In this tutorial, we will show you how to install Drone on macOS.
Open a terminal window and run the following command to install the Drone CLI:
brew install drone-cli
The drone-cli
is a command-line interface that allows you to interact with Drone and manage your builds.
Create a .drone.yml
file in your project root directory to define your workflow. This file contains instructions for building, testing and deploying your application. Here is an example configuration file:
kind: pipeline
name: default
steps:
- name: build
image: node:12
commands:
- npm install
- npm run build
- name: test
image: node:12
commands:
- npm test
- name: deploy
image: plugins/ssh
settings:
host: example.com
username: deploy
password:
from_secret: ssh_password
port: 22
target: /home/deploy/app
source: dist/
This configuration file defines three steps:
build
step builds the project using the node:12
image.test
step runs the project's tests using the node:12
image.deploy
step deploys the project using the plugins/ssh
image.You can customize the pipeline steps according to your project's requirements.
To execute your pipeline, you need to have a Docker Runner. A Docker Runner is a lightweight container that runs your pipeline on your local machine or a remote server.
Run the following command to install the Docker Runner:
docker run -d \
-v /var/run/docker.sock:/var/run/docker.sock \
-e DRONE_RPC_PROTO=https \
-e DRONE_RPC_HOST=drone.example.com \
-e DRONE_RPC_SECRET=${DRONE_RPC_SECRET} \
-e DRONE_RUNNER_CAPACITY=2 \
-e DRONE_RUNNER_NAME=${HOSTNAME} \
--restart always \
--name runner \
drone/drone-runner-docker:1
Here, replace the values of DRONE_RPC_HOST
and DRONE_RPC_SECRET
with your own values. The DRONE_RUNNER_CAPACITY
specifies the number of pipelines that can run concurrently and the DRONE_RUNNER_NAME
specifies the name of the runner.
You can run multiple runners on different machines or use Drone's managed runner to scale your pipelines.
To connect Drone to your Git repository, you need to create a Drone App on your Git provider and obtain an access token. Follow the instructions for your Git provider to create a Drone App and obtain an access token.
Here are the steps for connecting Drone to a GitHub repository:
Run the following command to tell Drone to watch your repository:
drone repo add <username>/<repository>
Here, replace <username>
and <repository>
with your own values.
Run the following command to start the Drone Server:
docker run -d \
--volume=/var/run/docker.sock:/var/run/docker.sock \
--env=DRONE_GITHUB_SERVER=https://github.com \
--env=DRONE_GITHUB_CLIENT_ID=<github_client_id> \
--env=DRONE_GITHUB_CLIENT_SECRET=<github_client_secret> \
--env=DRONE_RPC_SECRET=${DRONE_RPC_SECRET} \
--env=DRONE_SERVER_HOST=drone.example.com \
--env=DRONE_SERVER_PROTO=https \
--restart always \
--publish=80:80 \
--publish=443:443 \
--name=drone \
drone/drone:1
Here, replace <github_client_id>
and <github_client_secret>
with the values of your GitHub App. The DRONE_SERVER_HOST
specifies the domain name or IP address of your Drone instance.
By default, the Drone Server listens on ports 80 and 443. You can change the ports and use HTTP or HTTPS depending on your requirements.
Open a web browser and go to https://drone.example.com
(replace drone.example.com
with your own domain name). You should see the Drone UI and your repository listed there.
Congratulations! You have successfully installed Drone on macOS and connected it to your Git repository. Now, you can create and manage pipelines to build, test and deploy your applications. We hope this tutorial was helpful. For more information, visit the official Drone documentation.
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!