From 6ada5287d737b7d3a3a7bd6fd0b28ce159ed36ed Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Sat, 30 Sep 2023 00:04:41 +0200 Subject: [PATCH] Adding systemd service --- README.md | 30 ++++++++++++++++++++++++++++++ application/launcher_json.service | 19 +++++++++++++++++++ application/start.sh | 3 +++ 3 files changed, 52 insertions(+) create mode 100644 README.md create mode 100644 application/launcher_json.service create mode 100644 application/start.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..063cd6f --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# Launcher_json + +Location of the launcher json needed for the launcher + +Contains the file itself and an application which retrieve the latest version of the file on the master branch at each request + +## The application + +The application retrieve the latest version of the file on the git server at each user request + +### Building the app + +To build the app, simply type in yout terminal: + +`docker build -t launcher_json .` + +To run it, type: + +`docker run -p PORT:8080 -d --rm --name launcher_json` + +Replace `PORT` by the value you want to expose your app + +### Systemd service + +The repository contain a start.sh file to place in `/opt/launcher_json` folder, then place the launcher_json.service in `/etc/systemd/system` folder +and activate it using: ` + +`systemctl enable --now launcher_json` + +Remember to build the application first ! \ No newline at end of file diff --git a/application/launcher_json.service b/application/launcher_json.service new file mode 100644 index 0000000..15417cf --- /dev/null +++ b/application/launcher_json.service @@ -0,0 +1,19 @@ +# systemd service, to start the app at the launch of the system and restart it if it crash +[Unit] +Description=Launcher_json Service + +[Service] +# Non-root user +User=www-data +# Workspace directory +WorkingDirectory=/opt/launcher_json +# Path to Reposilite executable/script and its configuration. +ExecStart=/opt/launcher_json/start.sh +# Policy +SuccessExitStatus=0 +TimeoutStopSec=10 +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target diff --git a/application/start.sh b/application/start.sh new file mode 100644 index 0000000..5933f51 --- /dev/null +++ b/application/start.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker run -p 8090:8080 -d --rm launcher_json \ No newline at end of file