AWS EC2 deployment - express node js prisma typescript

Описание к видео AWS EC2 deployment - express node js prisma typescript

AWS EC2 deployment
- MYSQL
- PRISMA
-NODE EXPRESS
- TYPESCRIPT

GUIDE below 3 steps to run the app


1. when install nvm use this commands
- curl o https://raw.githubusercontent.com/nvm... | bash
- export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
- note: install the node version base on the version you use in the node application - nvm install 18.19.1

2.look at this link for guide but only select the command that is usefull to you i only get the command her for install mysql server
- https://www.sammeechward.com/deployin...
when setting up the mysql cred use this
- ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'secret';
GRANT GRANT OPTION ON . TO 'root'@'localhost';




3.install pm2 to run your node application in the background
- npm install -g pm2
- note the "sample-api" is the name of the file of the project - [pm2 start npm --name "sample-api" -- run start]
- pm2 startup
- after the above command "pm2 startup" copy the command something like this [sudo env PATH=$PATH:/home/ubuntu/.nvm/versions/node/v18.19.1/bin /home/ubuntu/.nvm/versions/node/v18.19.1/lib/node_modules/pm2/bin/pm2 startup systemd -u ubuntu --hp /home/ubuntu]
- pm2 save

after setting up the need configurations
- run the prisma command to migrate
- npx prisma generate
- npx prisma migrate dev

install caddy for reverse proxy
you dont need to put port in the security group docs below
https://caddyserver.com/docs

-end nice :3

Комментарии

Информация по комментариям в разработке