From 6ada5287d737b7d3a3a7bd6fd0b28ce159ed36ed Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Sat, 30 Sep 2023 00:04:41 +0200 Subject: [PATCH 1/7] 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 -- 2.39.5 From 4bcda53b49ae0441159a5563c7078e8e91c9bec2 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Sat, 30 Sep 2023 00:12:34 +0200 Subject: [PATCH 2/7] Add a restart policy --- application/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/start.sh b/application/start.sh index 5933f51..ea2632c 100644 --- a/application/start.sh +++ b/application/start.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker run -p 8090:8080 -d --rm launcher_json \ No newline at end of file +docker run -p 8090:8080 --restart unless-stopped -d --rm launcher_json \ No newline at end of file -- 2.39.5 From 845aa8da1025bd0b6e9741e352a1f83ea61dd6bf Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Sat, 30 Sep 2023 00:15:48 +0200 Subject: [PATCH 3/7] Moved start.sh command to systemd service --- application/launcher_json.service | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/application/launcher_json.service b/application/launcher_json.service index 15417cf..ca8e265 100644 --- a/application/launcher_json.service +++ b/application/launcher_json.service @@ -6,14 +6,10 @@ Description=Launcher_json 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 +ExecStart=/usr/bin/docker run -p 8090:8080 --restart unless-stopped -d --rm launcher_json # Policy -SuccessExitStatus=0 -TimeoutStopSec=10 -Restart=on-failure -RestartSec=5 +Type=oneshot [Install] WantedBy=multi-user.target -- 2.39.5 From 81fda9f23cf3577909707c1607288f80cc45708e Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Sat, 30 Sep 2023 00:18:24 +0200 Subject: [PATCH 4/7] Fix conflicting options --- application/launcher_json.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/launcher_json.service b/application/launcher_json.service index ca8e265..0353a13 100644 --- a/application/launcher_json.service +++ b/application/launcher_json.service @@ -7,7 +7,7 @@ Description=Launcher_json Service User=www-data # Workspace directory # Path to Reposilite executable/script and its configuration. -ExecStart=/usr/bin/docker run -p 8090:8080 --restart unless-stopped -d --rm launcher_json +ExecStart=/usr/bin/docker run -p 8090:8080 --restart unless-stopped -d launcher_json # Policy Type=oneshot -- 2.39.5 From 269f2e2dbe6371d21a4ee1ded1bb4cb7593c61d5 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Sat, 30 Sep 2023 00:19:08 +0200 Subject: [PATCH 5/7] Remove start.sh --- application/start.sh | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 application/start.sh diff --git a/application/start.sh b/application/start.sh deleted file mode 100644 index ea2632c..0000000 --- a/application/start.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -docker run -p 8090:8080 --restart unless-stopped -d --rm launcher_json \ No newline at end of file -- 2.39.5 From 5dff6a66538cbce384f54faa16de523378ae7e3c Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Sat, 30 Sep 2023 16:25:44 +0200 Subject: [PATCH 6/7] Fix systemd service and updated README --- README.md | 7 +++++-- application/launcher_json.service | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 063cd6f..abd3390 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,11 @@ 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: ` +The repository contain a systemd service file launcher_json.service to place in `/etc/systemd/system` folder, then create the `launcher` user: + +`adduser launcher --disabled-password --disabled-login --no-create-home` and `usermod -a -G docker launcher` + +Then activate the service using: `systemctl enable --now launcher_json` diff --git a/application/launcher_json.service b/application/launcher_json.service index 0353a13..ee5d434 100644 --- a/application/launcher_json.service +++ b/application/launcher_json.service @@ -3,8 +3,8 @@ Description=Launcher_json Service [Service] -# Non-root user -User=www-data +# Non-root user, create a new user first and it to docker group +User=launcher # Workspace directory # Path to Reposilite executable/script and its configuration. ExecStart=/usr/bin/docker run -p 8090:8080 --restart unless-stopped -d launcher_json -- 2.39.5 From 8c4ebc0412bcefc821246f784fe5a1dd04f15330 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Mon, 2 Oct 2023 16:56:56 +0200 Subject: [PATCH 7/7] Updated testing modpack --- launcher.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/launcher.json b/launcher.json index b3dbf66..eb8954b 100644 --- a/launcher.json +++ b/launcher.json @@ -2,16 +2,16 @@ "chapters": [ { "title": "Testing 1.19.3", - "description": "Animals - 29092023", + "description": "Animals - 02102023", "minecraftVersion": "1.19.3", "type": "snapshot", "customVersion": "fabric-loader-0.14.22-1.19.3", "modspack": { "mods": [ - "https://www.dropbox.com/scl/fi/oa8zdftqkp2qjrs5ba9fm/29092023.zip?rlkey=82a807t9bc5mpes6noypb36m0&dl=1" + "https://www.dropbox.com/scl/fi/varyttpbg8tkwtqfq7172/02102023.zip?rlkey=ud4u4yezctbsnpv4g8rf40v7o&dl=1" ], "sha1sum": [ - "04446885775A370E1A5AF2D9FD0A3DCEC0BAB91E" + "C32E603329977BA094692C020F066E029996979A" ] }, "java": { -- 2.39.5