Spin up EC2 instance
- Get access to AWS
- Choose an EC2 instance type that will suit your needs. (We chose t2.xlarge.)
- Choose a security group that is suitable for the instance. This will dictate which ports (protocols) are open to the internet for inbound and outbound traffic. (I created one called
continuous-integration
that currently exposes ssh, http, and https to the internet.) - Choose the storage amount for the instance
- Make sure to download the PEM file and store it in 1password
SSH to EC2 instance
-
Use PEM to SSH to instance. (If you've just created this instance and the connection times out you probably need to add inbound/outbound SSH to security group.)
-
SSH to the instance using the instructions from AWS
ssh -i "your-file.pem" username@ec2-instance-public-dns
Configure GitHub runners
-
Install Docker: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html
sudo yum update -y
sudo amazon-linux-extras install docker
sudo service docker start
sudo usermod -a -G docker ec2-user
(will not take effect until next login)sudo systemctl enable docker
(required to restart docker when ec2 instance boots up)
-
sudo ./start-org-runner.sh <RUNNER_TOKEN>
(This script is in the ec2-user home dir)- GitHub org admins can get an org runner token.
- Repo admins can get a repo runner token
- Runner tokens expire after a short period of time (maybe an hour).
start-org-runner.sh
source
docker run -d --restart always --name github-runner-$(date +%s) \ -e RUNNER_SCOPE="org" \ -e ORG_NAME="akadenia" \ -e LABELS="aws" \ -e RUNNER_NAME_PREFIX="akadenia-aws" \ -e RUNNER_TOKEN="$1" \ -e RUNNER_WORKDIR="/tmp/github-runner-akadenia" \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /tmp/github-runner-akadenia:/tmp/github-runner-akadenia \ myoung34/github-runner:latest
-
sudo ./start-org-runner.sh <RUNNER_TOKEN>
(- GitHub org admins can get an org runner token.
- Repo admins can get a repo runner token
- Runner tokens expire after a short period of time (maybe an hour).
start-org-runner.sh
source
docker run -d --restart always --name github-runner-$(date +%s) \ -e RUNNER_SCOPE="org" \ -e ORG_NAME="akadenia" \ -e LABELS="aws" \ -e RUNNER_NAME_PREFIX="akadenia-aws" \ -e RUNNER_TOKEN="$1" \ -e RUNNER_WORKDIR="/tmp/github-runner-akadenia" \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /tmp/github-runner-akadenia:/tmp/github-runner-akadenia \ myoung34/github-runner:latest
-
sudo ./start-org-runner.sh <RUNNER_TOKEN>
(- GitHub org admins can get an org runner token.
- Repo admins can get a repo runner token
- Runner tokens expire after a short period of time (maybe an hour).
start-org-runner.sh
source
docker run -d --restart always --name github-runner-$(date +%s) \ -e RUNNER_SCOPE="org" \ -e ORG_NAME="akadenia" \ -e LABELS="aws" \ -e RUNNER_NAME_PREFIX="akadenia-aws" \ -e RUNNER_TOKEN="$1" \ -e RUNNER_WORKDIR="/tmp/github-runner-akadenia" \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /tmp/github-runner-akadenia:/tmp/github-runner-akadenia \ myoung34/github-runner:latest