Enable action runner as service and remove tmux dep.
# This script can be used to create a Github Action Runner on an openSUSE or SLE
# distro. It installs all the needed dependencies to run the acceptance tests
-# and sets up docker and the runner itself.
+# and sets up docker and the runner as a service itself.
set -e
@@ -12,11 +12,13 @@ if [ -z "$GITHUB_RUNNER_TOKEN" ]; then
fi
# Install needed packages
+sudo zypper --gpg-auto-import-keys ref
if [ $(cat /etc/os-release | grep SLES) ]; then
- echo -e "\x1B[31m In order to install tmux, you need to register with SUSE Package Hub"
- sudo zypper --gpg-auto-import-keys ref && sudo zypper --non-interactive in -y make gcc docker git-core libicu tmux wget
+ rpms="make gcc docker git-core libicu wget"
+ sudo zypper --non-interactive in -y $rpms
else
- sudo zypper --gpg-auto-import-keys ref && sudo zypper --non-interactive in -y make gcc docker git libicu tmux wget
+ rpms="make gcc docker git libicu wget"
+ sudo zypper --non-interactive in -y $rpms
fi
# Enable docker service
@@ -32,7 +34,7 @@ chmod +x kubectl
sudo mv kubectl /usr/bin
# Setup github worker
-mkdir actions-runner && cd actions-runner
+mkdir -p actions-runner && cd actions-runner
curl -o actions-runner-linux-x64-2.278.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.278.0/actions-runner-linux-x64-2.278.0.tar.gz
tar xzf ./actions-runner-linux-x64-2.278.0.tar.gz
@@ -40,6 +42,10 @@ tar xzf ./actions-runner-linux-x64-2.278.0.tar.gz
sed -i 's/Runner.Listener configure/Runner.Listener configure --unattended/' config.sh
./config.sh --url https://github.com/epinio/epinio --token $GITHUB_RUNNER_TOKEN
-echo "Your worker will be ready to be used after you re-login (to be able to call 'docker' as non root)"
-echo "After login run:"
-echo "tmux new-session -d -s runner 'cd actions-runner && ./run.sh'"
+# Configure and enable Service
+sudo ./svc.sh install
+sudo sed -i '/^\[Service\]/a RestartSec=5s' /etc/systemd/system/actions.runner.epinio-epinio.`hostname`.service
+sudo sed -i '/^\[Service\]/a Restart=always' /etc/systemd/system/actions.runner.epinio-epinio.`hostname`.service
+sudo systemctl daemon-reload
+sudo systemctl enable actions.runner.epinio-epinio.`hostname`.service
+sudo systemctl start actions.runner.epinio-epinio.`hostname`.service
