Skip to content

Instantly share code, notes, and snippets.

@codycraven
Created December 28, 2017 16:54
Show Gist options
  • Save codycraven/617f1f151c4cbcd2a529d2abf10f4655 to your computer and use it in GitHub Desktop.
Save codycraven/617f1f151c4cbcd2a529d2abf10f4655 to your computer and use it in GitHub Desktop.
#!/bin/bash
# This upgrade assumes you are working from a Drone 0.7 instance configured
# like: https://gist.github.com/codycraven/c28ba26a720121c5eee845822511c4f0
# Get sudo
sudo echo
# Pull in Drone images we'll be using.
docker pull drone/drone:0.8.2
docker pull drone/agent:0.8.2
# Update agent environment config to change wss://DOMAIN/ws/broker to
# DOMAIN:9000.
sed -i 's#DRONE_SERVER=wss://\(.*\)/ws/broker#DRONE_SERVER=\1:9000#' /etc/drone/agent.env
# Update Drone compose configuration to add port 9000.
sudo tee /etc/drone/docker-compose.yml > /dev/null <<EOT
version: '3'
services:
drone-server:
image: drone/drone:0.8.2
ports:
- 127.0.0.1:8000:8000
- 9000:9000
volumes:
- /var/lib/drone:/var/lib/drone
restart: always
env_file:
- /etc/drone/server.env
drone-agent:
image: drone/agent:0.8.2
command: agent
depends_on:
- drone-server
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: always
env_file:
- /etc/drone/agent.env
EOT
# Open port 9000.
sudo ufw allow 9000
# Restart services
#
# We probably don't need to restart caddy, but at least we'll know if we have
# errors.
sudo systemctl restart caddy
sudo systemctl status caddy
sleep 5
sudo systemctl restart drone
sudo systemctl status drone
sleep 5
# Remove unneeded Drone 0.7 image.
docker image rm drone/drone:0.7
echo "Upgrade to Drone 0.8.2 complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment