要在Ubuntu 20.04上安装和配置Drone,您可以按照以下步骤进行操作:
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
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密钥。
sudo nano /etc/nginx/sites-available/default
server
块中添加以下配置以使NGINX代理Drone服务器: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了。