Runners #
Add swap to runners #
#!/bin/bash
# Create 16GB swap file
echo "Creating 16G swap file at /swapfile..."
sudo fallocate -l 16G /swapfile || sudo dd if=/dev/zero of=/swapfile bs=1G count=16 status=progress
# Set correct permissions
echo "Setting permissions..."
sudo chmod 600 /swapfile
# Format the file as swap
echo "Setting up swap area..."
sudo mkswap /swapfile
# Enable the swap
echo "Enabling swap..."
sudo swapon /swapfile
# Make it permanent in /etc/fstab
if ! grep -q '/swapfile' /etc/fstab; then
echo "Adding to /etc/fstab..."
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
else
echo "/swapfile already exists in /etc/fstab"
fi
# Show active swap
echo "Swap status:"
swapon --show
GitHub Actions Runner Setup #
Create instance using latest Ubuntu AMI
Choose an x86 instance
Add ECR-EC2 instance profile. This is required for Session Manager.
Do not add a keypair.
Use default VPC
Install Docker:
https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
#!/bin/sh
apt update && apt install -y golang-go make awscli graphviz
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
exec bash
nvm install 16
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
Install Actions runner
mkdir actions-runner && cd actions-runner
curl -o actions-runner-linux-x64-2.311.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.311.0/actions-runner-linux-x64-2.311.0.tar.gz
echo "29fc8cf2dab4c195bb147384e7e2c94cfd4d4022c793b346a6175435265aa278 actions-runner-linux-x64-2.311.0.tar.gz" | shasum -a 256 -c
tar xzf ./actions-runner-linux-x64-2.311.0.tar.gz
RUNNER_ALLOW_RUNASROOT=1 ./config.sh --unattended --url https://github.com/funnelstory --token TOKEN
./svc.sh install root
./svc.sh start
Install jq:
sudo apt-get install jq
Install Cypress dependencies:
From: https://docs.cypress.io/guides/getting-started/installing-cypress#Linux-Prerequisites
sudo apt-get install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb
Connecting to an instance #
Use Session Manager to connect.
Once connected, you can drop into a root bash via sudo -i.
Maintenance cron #
This is currently added to cron by hand (crontab -e):
0 0 * * * docker system prune -af --volumes