ubuntu

如何在Ubuntu 20.04上安装和配置Drone

小云
120
2023-10-14 11:24:31
栏目: 智能运维

要在Ubuntu 20.04上安装和配置Drone,您可以按照以下步骤进行操作:

  1. 安装Docker:
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
  1. 安装和配置Drone:
sudo mkdir /var/lib/drone
sudo chown -R 1000:1000 /var/lib/drone
sudo docker run \
--volume=/var/lib/drone:/data \
--env=DRONE_AGENTS_ENABLED=true \
--env=DRONE_GITHUB_SERVER=https://github.com \
--env=DRONE_GITHUB_CLIENT_ID=<YOUR_GITHUB_CLIENT_ID> \
--env=DRONE_GITHUB_CLIENT_SECRET=<YOUR_GITHUB_CLIENT_SECRET> \
--env=DRONE_RPC_SECRET=<YOUR_RPC_SECRET> \
--publish=8080:80 \
--publish=443:443 \
--restart=always \
--detach=true \
--name=drone \
drone/drone:2

请替换<YOUR_GITHUB_CLIENT_ID><YOUR_GITHUB_CLIENT_SECRET><YOUR_RPC_SECRET>为您的GitHub应用程序的客户端ID,客户端密钥和随机的RPC密钥。

  1. 配置反向代理:
sudo nano /etc/nginx/sites-available/default
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_pass http://localhost:8080;
}
sudo systemctl restart nginx

现在,您应该能够通过在浏览器中访问http://localhost来访问和使用Drone了。

0
看了该问题的人还看了