Skip to content

Instantly share code, notes, and snippets.

@teocci
Created December 22, 2022 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teocci/3e952456d2e91330d38bee992842ca0f to your computer and use it in GitHub Desktop.
Save teocci/3e952456d2e91330d38bee992842ca0f to your computer and use it in GitHub Desktop.

Setup system.d service

sudo nano /lib/systemd/system/kogas-api.service

Add the service code below.

[Unit]
Description=Kogas JAVA API

[Service]
Environment=PORT=3000
Environment=GO_ENV=production
Type=simple
Restart=always
RestartSec=5s
WorkingDirectory=/opt/prod
ExecStart=/bin/java -Xms128m -Xmx256m -jar /path/to/your/file.jar

[Install]
WantedBy=multi-user.target

Start the service and check status

sudo service kogas-api start
sudo service kogas-api status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment