Skip to content

Instantly share code, notes, and snippets.

@philwinder
Last active May 23, 2018 11:01
Show Gist options
  • Save philwinder/7373bbadecf56e87137f to your computer and use it in GitHub Desktop.
Save philwinder/7373bbadecf56e87137f to your computer and use it in GitHub Desktop.
Script to install Drone on an Amazon EC2 instance
#!/bin/bash
# First create a new EC2 ubuntu instance on the free tier.
# Ensure that port 22 (SSH) and 80 (HTTP) are open to the public.
# SSH into machine. Run these commands.
echo “Verify that docker is installed, if not install ”
command -v docker >/dev/null 2>&1 || { echo >&2 "docker isn’t installed. Installing"; wget -qO- https://get.docker.com/ | sh; }
wget downloads.drone.io/master/drone.deb
sudo dpkg -i drone.deb
# Stop service. Services default to starting when installed.
sudo stop drone
# These two are base images. all Drone images are built on top of these.
# Unfortunately you must download them to perform any builds. If you don't want to build, you don't need them
# These are BIG (~3GB)
sudo docker pull bradrydzewski/ubuntu
sudo docker pull bradrydzewski/base
# Java and jdk images
# These are the images specified in the repo toml file.
sudo docker pull bradrydzewski/java:oraclejdk8 # image: oraclejdk8
sudo docker pull bradrydzewski/go:1.4 # image: go1.4
# Now edit the /etc/drone/drone.toml and enable the github settings. Add your client id and secret. Available from here:
# https://github.com/settings/developers
# You may need to create a new application.
# Github part of the toml file should look like this (note that orgs is commented out - we're not using organizations yet):
# [github]
# client="XXXXXCLIENTXXXXXX"
# secret="XXXXXSECRETXXXXXXXXXXX"
# #orgs=[]
# #open=false
# Now restart drone
# sudo start drone
# Finally, go the gui (the Amazon AWS IP address) and click the button to connect to github. Then activate an example repo.
# The settings for the repo are:
# Homepage URL: http://AWS_IP_ADDRESS:80/
# Authorization callback URL: http://AWS_IP_ADDRESS:80/api/auth/github.com
# Logs can be found at (there is not much there):
# sudo tail -f /var/log/upstart/drone.log
@roryc89
Copy link

roryc89 commented May 23, 2018

In case of error: write /var/lib/docker/tmp/GetImageBlob973657525: no space left on device

Try:

sudo service docker stop

sudo rm -rf /var/lib/docker

sudo dockerd --storage-opt dm.basesize=30G

sudo service docker start

and rerun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment