Deploying node, react apps to ionos cloud

From Logic Wiki
Revision as of 21:39, 12 May 2024 by AliIybar (Talk | contribs)

Jump to: navigation, search


Plan

  • install node / npm
  • install nginx to cloud
  • create site in nginx
  • manually deploy typescript node app after build
  • install let's encrypt
  • Test node app in SSL
  • Create github action to deploy site from main branch
  • Create github action to deploy site to Azure WebApps from develop branch
  • Decide where to keep database
  • test deployment end to end
  • repat steps for the react app

Action

Installing node / npm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

restart the terminal and to install

nvm install 22

Install Nginx

sudo apt update
sudo apt install nginx
sudo systemctl start nginx

Install PM2

sudo npm install -g pm2
pm2 startup systemd

Change Owner of a folder

sudo chown -R username path 

Create Self-Hosted Runners of Github

cd /var/www/api.logicmade.co.uk
mkdir live
cd live
sudo -s

This command below is a runner cmd in github/repo/settings/action/runner and select OS

curl -o actions-runner-linux-x64-2.316.1.tar.gz -L https://github.com/actions/runner/releases/download/v2.316.1/actions-runner-linux-x64-2.316.1.tar.gz

to run the next command in github you may see permission problems and to fix them run commands below

tar xzf ./actions-runner-linux-x64-2.316.1.tar.gz
$ sudo -s
# chmod o+w .
# exit

Github command next

 ./config.sh --url https://github.com/Aliiybar/logicmade_api --token ABKE7DQYNVTH3NWQYOP6BPTGIEZJK

fill the tags

Create a site in Nginx

Install let's encrypt

https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-20-04