sudo apt update
sudo apt install postgresql postgresql-contrib
\password postgres #PostgreSQL user의 비밀번호 변경
sudo -u postgres psql
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
...
sudo apt update
sudo apt install openjdk-17-jdk
위치: /etc/systemd/system
참조: systemd 서비스 등록
logistics.service 파일 생성
[Unit]
Description=Logistics Service
After=network.target
[Service]
User={유저이름}
ExecStart=/bin/java -jar /home/../latest/logistics.jar --spring.profiles.active=test
SuccessExitStatus=143
TimeoutStopSec=10
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Fat-jar 생성과정을 통해 fat-jar파일을 생성하고 테스트 서버로 복사해왔다
3개의 디렉토리를 사용해 jar 파일들을 관리하였다
- toupdate: jar file to upload
- latest: running jar
- version: oldest version jar
#!/bin/bash
sudo systemctl stop logistics
rm /home/../latest/logistics.jar
mv /home/../latest/*.jar /home/../versions/
mv /home/../toupdate/*.jar /home/../latest/
ln -s /home/../latest/*.jar /home/../latest/logistics.jar
sudo systemctl start logistics
sudo journalctl -u logistics -f