Last post Ubuntu Server Setup, I talked about the basic setup for an Ubuntu server. In this post, I will share some details about the setup for saltynote server.
Database
1. Create a new database, and a database user
Login database from terminal with mysql -u root -p
, and execute follow command lines:
1 | CREATE DATABASE saltynote; |
Note: You can find more details about how to enable remote access from this post. While here, I only enable it with local access, as I for security reason, it is not required for current stage.
Spring Boot Service
The service is implemented with Spring Boot. So it can be run with a standalone jar file as a Systemd service. You can find more official information from this link.
Create a new user
For security, I will create a specific user to run the service. This post will be very helpful for this step.
1 | # Create a new user, and create its home dir |
Create Service Folder & Service Setup
1 | mkdir -p /home/saltynote/service |
Upload the jar file to /home/saltynote/service
folder, and create application.properties
inside that folder, which can be used to set some sensitive information. e.g. database connection info.
1 | # Make saltynote is the owner of service.jar |
Systemd Setup
Create note.service
in /etc/systemd/system
dir, and populate note.service
as below:
1 | [Unit] |
We can enable this service to auto start when system restarts by:
1 | systemctl enable note.service |
If everything goes well, the service should start now. Open http://YOUR-SERVER-IP:8888, you should see a welcome message in JSON format.
1 | # You can check that the service is running with saltynote user. |
NginX and HTTPS
// TODO
TO BE DONE