Setting up github runner
Prerequisites
- Ensure that you have created a user
github-runner
with a proper password. - The VM is configured for running Tensorflow in GPU
Setting up github runner in VM
- Login as
github-runner
user. - Make sure the host name matches the watchtower VM name as most runners are not set properly. Use
sudo hostnamectl set-hostname <VM name>
- If existing github runner is configured please remove the directory. This is most likely inside
/home/devon/action-runner
. - Make sure you are inside
github-runner
home directory. - Go to Add new self hosted runner
- Run the following commands as shown in
Download
section:
mkdir actions-runner && cd actions-runner
curl -o actions-runner-linux-x64-2.317.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.317.0/actions-runner-linux-x64-2.317.0.tar.gz
tar xzf ./actions-runner-linux-x64-2.317.0.tar.gz
Configure
section, copy the ./config.sh --url <URL> --token <token>
to start the github runner configuration.
6. When prompted for runner group press enter for default group.
NOTE: need to confirm with Nitin what the correct group is. 7. When prompted for what the work directory is (default
_work
), set it to/mnt/_work
.
Setting up permissions for /mnt
for github-runner
user
cd /etc/systemd/system/
- Enter
touch mount-permissions.service
- Open the above service file with any text editor and enter the following:
[Unit]
Description=Set permissions for /mnt/ drive for github-runner
After=local-fs.target
[Service]
Type=oneshot
ExecStart=/bin/chown github-runner:github-runner /mnt
ExecStart=/bin/chmod u+rwx /mnt
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
- After that
sudo systemctl daemon-reload
sudo systemctl enable mount-permissions.service
sudo systemctl start mount-permissions.service
- Now go back to
cd /home/github-runner/actions-runner
- Run
sudo ./svc.sh install
sudo ./svc.sh start
- Github Action Runners are setup. Test by running an action, for the specific VM.
(Optional) Stop old instances of actions-runner in devon user
cd /home/devon/actions-runner
sudo ./svc.sh stop
sudo ./svc.sh uninstall
cd .. && rm -rf actions-runner
- You might need to go back to
cd /home/github-runner/actions-runner
and thensudo ./svc.sh start
.
Setup DVC config
We can cache DVC using the /mnt/var/
dir.
sudo mkdir /etc/xdg/dvc/
sudo vim /etc/xdg/dvc/config
- Enter the following
[cache]
dir = /mnt/var/shared/dvc-cache
shared = group
[core]
site_cache_dir = /mnt/var/tmp/dvc
Migrating /home
With /mnt
configured, you need not have an external SSD to save costs.
sudo mkdir /home-new
- Copy necessary users
AbiAdmin
,EPAM_user
,github-runner
only from/home
to/home-new
usingsudo cp -R -p /home/<user> /home-new/
. sudo nano /etc/fstab
- Comment out or remove the entry
/dev/mapper/data_vg-lv_data /home ext4 defaults 0 0
sudo reboot
- After logging back in
sudo cp -R -p /home-new/* /home
to copy all the files back sudo rm -rf home-new
- Restart actions-runner service
cd /home/github-runner/actions-runner
and thensudo ./svc.sh install && sudo ./svc.sh start
.