Skip to content

Latest commit

 

History

History
91 lines (72 loc) · 2.33 KB

README.md

File metadata and controls

91 lines (72 loc) · 2.33 KB

Tomlin.no API

Backend API for homepage (https://tomlin.no) and possible other projects.

Website GitHub last commit GitHub code size in bytes GitHub repo size in bytes GitHub licence

API, Spring, Spring Boot, REST, Kotlin, Gradle, OkHttp, Nginx, MySQL

Build and Run

./gradlew build

java -jar build/libs/tomlin-api-1.0.0.jar --spring.profiles.active=prod

JVM Options

-Dspring.profiles.active=prod

Upgrade dependencies

./gradlew dependencyUpdates

Services

Move files under service directory to /etc/systemd/system/

sudo mv tomlin-api* /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable tomlin-api && sudo systemctl start tomlin-api

Restart service on file change

sudo systemctl enable tomlin-api-watcher && sudo systemctl start tomlin-api-watcher
sudo systemctl enable tomlin-api-watcher.path && sudo systemctl start tomlin-api-watcher.path

Certbot

sudo apt install certbot python-certbot-nginx
sudo certbot --nginx
sudo certbot renew [--dry-run]

Nginx

sudo nano /etc/nginx/sites-available/default
sudo nginx -t
sudo systemctl restart nginx

Proxy configuration:

location / {
    proxy_pass http://localhost:8081/;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Port $server_port;
}

Database

sudo apt install mariadb-server
mysql_secure_installation
mysql -u root -p

GCE

sudo apt update
sudo apt uprgade

sudo apt install openjdk-17-jdk

sudo apt install mariadb-server
sudo mariadb-secure-installation
mysql -u root -p
mysql -u root -p database_name < backup.sql

sudo apt install nginx

chmod +x tomlin-api-1.0.0.jar