From d4d16d1bd55dc2e5918d191e183cf4f82e545b7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrub=C3=BD?= Date: Mon, 11 Dec 2023 11:27:56 +0100 Subject: [PATCH] partialy working --- Dockerfile | 23 +++++++++++++++++++++ docker-compose.yaml | 6 ++++++ services/bytebin/bytebin-service.conf | 7 +++++++ services/bytebin/config.json | 7 +++++++ services/luckpermsweb/config.json | 7 +++++++ services/nginx/nginx-service.conf | 5 +++++ services/nginx/nginx.conf | 29 +++++++++++++++++++++++++++ supervisord.conf | 18 +++++++++++++++++ 8 files changed, 102 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yaml create mode 100644 services/bytebin/bytebin-service.conf create mode 100644 services/bytebin/config.json create mode 100644 services/luckpermsweb/config.json create mode 100644 services/nginx/nginx-service.conf create mode 100644 services/nginx/nginx.conf create mode 100644 supervisord.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cab23f8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM alpine:3.16 + +# configure supervisord +RUN apk add --update supervisor openjdk17-jdk parallel nginx nodejs npm git && rm -rf /tmp/* /var/cache/apk/* +ADD supervisord.conf /etc/ + +#configure bytebin +RUN mkdir /opt/bytebin +ADD https://ci.lucko.me/job/bytebin/lastSuccessfulBuild/artifact/target/bytebin.jar /opt/bytebin +ADD services/bytebin/config.json /opt/bytebin/config.json +ADD services/bytebin/bytebin-service.conf /etc/supervisor/conf.d/bytebin-service.conf + +#configure nginx +ADD services/nginx/nginx-service.conf /etc/supervisor/conf.d/nginx-service.conf +ADD services/nginx/nginx.conf /etc/nginx/http.d/web.conf + + +RUN git clone --recursive https://github.com/lucko/LuckPermsWeb.git /opt/LuckPermsWeb && rm -rf /opt/LuckPermsWeb/config.json +ADD services/luckpermsweb/config.json /opt/LuckPermsWeb/config.json +RUN mkdir -p /opt/web && cd /opt/LuckPermsWeb && npm install && npm run build && cp -r dist/* /opt/web && rm -rf /opt/LuckPermsWeb + + +ENTRYPOINT ["supervisord", "--nodaemon", "--configuration", "/etc/supervisord.conf"] diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..53a34f0 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,6 @@ + +services: + lpweb: + build: . + ports: + - "8080:8080" diff --git a/services/bytebin/bytebin-service.conf b/services/bytebin/bytebin-service.conf new file mode 100644 index 0000000..bd132e8 --- /dev/null +++ b/services/bytebin/bytebin-service.conf @@ -0,0 +1,7 @@ +[program:bytebin] +command=/usr/bin/java -jar bytebin.jar +directory=/opt/bytebin +autostart=true +autorestart=true +stderr_logfile=/var/log/bytebin.err.log +stdout_logfile=/var/log/bytebin.out.log \ No newline at end of file diff --git a/services/bytebin/config.json b/services/bytebin/config.json new file mode 100644 index 0000000..50512ee --- /dev/null +++ b/services/bytebin/config.json @@ -0,0 +1,7 @@ +{ + "host": "127.0.0.1", + "port": 8085, + "keyLength": 10, + "lifetimeMinutes": 10080, + "maxContentLengthMb": 10 + } \ No newline at end of file diff --git a/services/luckpermsweb/config.json b/services/luckpermsweb/config.json new file mode 100644 index 0000000..b25fbc5 --- /dev/null +++ b/services/luckpermsweb/config.json @@ -0,0 +1,7 @@ +{ + "bytebin_url": "../bytebin/", + "bytesocks_host": "usersockets.luckperms.net", + "base": "/", + "selfHosted": true, + "api_url": "https://metadata.luckperms.net" + } \ No newline at end of file diff --git a/services/nginx/nginx-service.conf b/services/nginx/nginx-service.conf new file mode 100644 index 0000000..fabb9c0 --- /dev/null +++ b/services/nginx/nginx-service.conf @@ -0,0 +1,5 @@ +[program:nginx] +command=/usr/sbin/nginx -g "daemon off;" +autostart=true +autorestart=true +startretries=5 \ No newline at end of file diff --git a/services/nginx/nginx.conf b/services/nginx/nginx.conf new file mode 100644 index 0000000..6b7ece6 --- /dev/null +++ b/services/nginx/nginx.conf @@ -0,0 +1,29 @@ +server { + listen 0.0.0.0:8080; + server_name default_server; + + client_max_body_size 0; + + root /opt/web; + index index.html; + try_files $uri $uri/ /index.html; + + + location = /bytebin { + return 302 /luckperms/bytebin/; + } + + location /bytebin/ { + client_max_body_size 30M; + client_body_timeout 60s; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_redirect http:// https://; + + proxy_pass http://127.0.0.1:8085/; + } + +} \ No newline at end of file diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 0000000..d8f750e --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,18 @@ +[supervisord] +nodaemon=true + + +[program:logging] +command=parallel --tagstring "{}:" --line-buffer tail -f {} ::: /var/log/bytebin.out.log /var/log/nginx/access.log /var/log/nginx/error.log +user=root +directory=/root/ +priority=40 +startsecs=10 +autostart=true +autorestart=true +stdout_logfile=/dev/fd/1 +stdout_logfile_maxbytes=0 +redirect_stderr=true + +[include] +files = /etc/supervisor/conf.d/*.conf