VPS Detail and Amazon Linux also we can use VPS.
Amazon Linux also we can use VPS
------------------------------------------------------
1 Domain name server Mapping
If we get IP from godaddy then we need to ampp ip fromgodaddy
prakash replace ip address
2 VPS purchase from hostinger
providing indipendent virtual machine on hostinger
NGINX need to install and need to write script in nginx
JAVA node JS MySQL
3 NGINX provide things like
proxy api mapping request
SSL certificate provide by VPS and configure in nginx with proxy
to hit url from frontend to backend url with SSL proxy.
nginx script use to navigate request and route to proper urls
4 MyApp.service
this service is use to resatrt automatically by using command like java --jar
this service have some configurations like given
-------------4 MyApp.service-----------
sudo nano /etc/systemd/system/myapp.service
---------------------
[Unit]
Description=Spring Boot API Service # Providing description about application
After=network.target
[Service]
User=myappuser #User define spring profile you can give any name
Group=myappuser #Group define spring profile you can give any name
WorkingDirectory=/opt/myapp/backend/target #decide th epath where you want to store jar file
# Set environment file here
EnvironmentFile=/opt/myapp/.env #This will decide which enviornment dynamically render by using given path
ExecStart=/usr/bin/java -jar /opt/myapp/backend/target/AgriPowerStore-0.0.1-SNAPSHOT.jar #To run jar file automatically
SuccessExitStatus=143
Restart=always
RestartSec=10
StandardOutput=file:/opt/myapp/logs/myapp.log #to maintain logs with deploeyement time
StandardError=file:/opt/myapp/logs/myapp-error.log #to maintain logs with deploeyement time
[Install]
WantedBy=multi-user.target
4.1 .env # this file should be hidden for security purpose
root@srv673022:~# cat /opt/myapp/.env
DB_URL=jdbc:mysql://147.93.19.167:3306/agripower #this path will render dynamiccaly in dev-yml file
DB_USER=prakash
DB_PASS=AgriPower@123
SPRING_PROFILES_ACTIVE=dev #This file decide which yml read at runtime /deploy time.
---------
4.2 datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ${DB_URL}
username: ${DB_USER}
password: ${DB_PASS}
---------------------------------------------------------------
Deployemnet process of backend on VPS server with help of putty and WinSCP
--sudo lsof -i :8443
--sudo kill -9 3869547
--java -jar AgriPowerStore-0.0.1-SNAPSHOT
--opt/myapp/logs
--opt/myapp/backend/target/AgriPowerStore-0.0.1-SNAPSHOT.jar
--var/www/myapp/dist/frontend/dist/frontend/browser
----------------------NGINX Configuration-----------------------------------------
--cat /etc/nginx/sites-available/default
--nano /etc/nginx/sites-available/default
--sudo systemctl reload nginx
--sudo systemctl restart nginx
--https://prakash.agripower.store/swagger-ui/index.html#/
Comments
Post a Comment