-
-
Notifications
You must be signed in to change notification settings - Fork 35
Setup for Self Hosted Actions Runner to deploy the API
Create a user called krishna
or whatever you like.
adduser krishna
Give the user sudo permissions.
usermod -aG sudo krishna
Set Up a Basic Firewall
ufw app list
ufw allow OpenSSH
ufw enable
ufw status
Add the Docker repository to your Linux repository. Execute the following commands in a terminal window.
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Install Docker Community Edition.
sudo apt-get update
sudo apt-get install docker-ce
Add your user to the docker group to setup its permissions. Make sure to restart your machine after executing this command.
sudo usermod -a -G docker <username>
Test your Docker installation. Executing the following command will
automatically download the hello-world
Docker image if it does not exist and
run it.
docker run hello-world
Remove the hello-world
image once you're done.
docker image ls
docker rmi -f hello-world
Docker Compose helps you to run a network of several containers at once thanks to configuration files instead of providing all arguments in the command line interface. It makes it easier to manage your containers as command lines can become very long and unreadable due to the high number of arguments. Execute the following command in a terminal window.
sudo apt install docker-compose
-
Go to the Settings tab in the GitHub project and click on the Actions menu on the sidebar.
-
There, you'll notice the Runners tab under the Actions menu. Click on the Runners tab.
-
On the Runners page, click the Add runner button that will take you to the Add self-hosted runner page.
-
On the Add self-hosted runner page, choose the Operating System as Linux and Architecture type as X64, and follow the instructions mentioned on the page.
-
After downloading the runner package, go to the configure section and configure the runner.
-
After configuring the runner, do not run
./run.sh
. This will only the runner in transient mode. To make the runner a systemd service, run the commandsudo ./svc.sh install
This will create a systemd service so the runner will automatically run even after the VM restarts. -
After installing the runner, start the runner using the command
sudo ./svc.sh start
. You can check the status of the runner using the commandsudo ./svc.sh status
.