Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Deploy app on azure

Manueluz edited this page Feb 12, 2024 · 2 revisions

Deploy on Azure

Create virtual machine

Enter the azure homepage, go to virtual machines and hit the create button.

834e2eacc0ce1fa3bb6971e5d3d2d55f

Now lets configure the machine properly, this is very important as picking the wrong options here will result in your free credits disappearing. Choose the Standard B2s virtual machine as it is the cheapest one that will run properly.

ac9328d4ef230ec2f3a914d3a1ab47dc

Now choose the ubuntu server 20.04 image and leave all the other settings as given by default

68d0cc69ffeb90982516203fe788294f

Download the keypair, and store it safely (In case of loosing it you wont be able to connect to the machine)

850d30258ca2b38f2a883ad76e13c007

Configure virtual machine

Now lets connect to the machine to install the necessary dependencies (Since everything runs on top of docker we only need docker :D). Lets connect using the windows SSH client with the command

ssh -i mykey azureuser@ip

If you are not sure what is the ip of your machine head over to the azure portal, go to the virtual machine and the ip should be right there

595d5e054cb0d2909d9932bba6bb47c9

So lets connect to the machine

b41fe5760ad1ceb65f332142eee31f3c

First of all we have to update the machine

sudo apt update && sudo apt full-upgrade

Now that we have an updated machine the only remaining step is to install docker

sudo apt update && sudo apt 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 focal stable" && sudo apt update && sudo apt install docker-ce && sudo usermod -aG docker ${USER} && sudo curl -L "https://github.com/docker/compose/releases/download/1.28.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose && sudo systemctl status docker

After running the command we should see something like this

d792702457dd1eb593b63ba8af57b000

Configure github

Go to secrets actions link

And now we have to set the correct tokens for the deployment to work

DEPLOY_HOST -> The IP of your machine DEPLOY_KEY -> The key you used to connect over SSH DEPLOY_USER -> Your machine user (If you didnt change anything it should be azureuser)