要在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了。