7daytheory / new-portfolio-2024

Creating a new portfolio for deployement on live web server.
1 stars 0 forks source link

setting-up-node-server #159

Closed 7daytheory closed 2 weeks ago

7daytheory commented 1 month ago

Installed VPM server, connected via SSH

7daytheory commented 1 month ago

Used Putty to sign in to server, installed node


curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
7daytheory commented 1 month ago

Load NVM


export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # loads nvm bash_completion
7daytheory commented 1 month ago

Install NVM and Node :


nvm install node  # installs latest Node.js version
nvm use node      # use installed node
7daytheory commented 1 month ago

Install PM2 - You can just use node but PM2 has some good features like auto-restart if server goes down :


npm install pm2@latest -g  # Installs PM2 globally
7daytheory commented 1 month ago

Start Application :


pm2 start index.js --name "app name"  # I used index.js but it might be server.js or app.js - and insert your app name from package
7daytheory commented 1 month ago

Test Endpoint :


curl http://localhost:3000/resume

If it comes back with  the correct message everything is working - I had an error so I removed everything except a basic messsage. Everything works now so will slowly be adding everything back
7daytheory commented 1 month ago

Set up auto-start and save current list of processes


pm2 startup

```bash
pm2 save
7daytheory commented 1 month ago

NEXT : Check Server Configuration - I can connect to the server via SSH but not via URL

7daytheory commented 1 month ago

Update Nginx configuration

7daytheory commented 2 weeks ago

No point paying for a VSH server when you're barely using it