Setting up github runner

Prerequisites

  1. Ensure that you have created a user github-runner with a proper password.
  2. The VM is configured for running Tensorflow in GPU

Setting up github runner in VM

  1. Login as github-runner user.
  2. Make sure the host name matches the watchtower VM name as most runners are not set properly. Use sudo hostnamectl set-hostname <VM name>
  3. If existing github runner is configured please remove the directory. This is most likely inside /home/devon/action-runner.
  4. Make sure you are inside github-runner home directory.
  5. Go to Add new self hosted runner
  6. 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
5. Inside the 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

  1. cd /etc/systemd/system/
  2. Enter touch mount-permissions.service
  3. 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
  1. After that
  2. sudo systemctl daemon-reload
  3. sudo systemctl enable mount-permissions.service
  4. sudo systemctl start mount-permissions.service
  5. Now go back to cd /home/github-runner/actions-runner
  6. Run
  7. sudo ./svc.sh install
  8. sudo ./svc.sh start
  9. Github Action Runners are setup. Test by running an action, for the specific VM.

(Optional) Stop old instances of actions-runner in devon user

  1. cd /home/devon/actions-runner
  2. sudo ./svc.sh stop
  3. sudo ./svc.sh uninstall
  4. cd .. && rm -rf actions-runner
  5. You might need to go back to cd /home/github-runner/actions-runner and then sudo ./svc.sh start.

Setup DVC config

We can cache DVC using the /mnt/var/ dir.

  1. sudo mkdir /etc/xdg/dvc/
  2. sudo vim /etc/xdg/dvc/config
  3. 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.

  1. sudo mkdir /home-new
  2. Copy necessary users AbiAdmin, EPAM_user, github-runner only from /home to /home-new using sudo cp -R -p /home/<user> /home-new/.
  3. sudo nano /etc/fstab
  4. Comment out or remove the entry /dev/mapper/data_vg-lv_data /home ext4 defaults 0 0
  5. sudo reboot
  6. After logging back in sudo cp -R -p /home-new/* /home to copy all the files back
  7. sudo rm -rf home-new
  8. Restart actions-runner service cd /home/github-runner/actions-runner and then sudo ./svc.sh install && sudo ./svc.sh start.