properly persist upload dir

Signed-off-by: MiniDigger <admin@minidigger.me>
This commit is contained in:
MiniDigger 2020-10-30 14:50:25 +01:00
parent 483c59ecdb
commit b86ccf0edf
4 changed files with 13 additions and 3 deletions

View File

@ -21,6 +21,8 @@ services:
- "traefik.http.routers.hangar.tls.certresolver=default" - "traefik.http.routers.hangar.tls.certresolver=default"
- "traefik.http.routers.hangar.tls.domains[0].main=minidigger.me" - "traefik.http.routers.hangar.tls.domains[0].main=minidigger.me"
- "traefik.http.routers.hangar.tls.domains[0].sans=*.minidigger.me" - "traefik.http.routers.hangar.tls.domains[0].sans=*.minidigger.me"
volumes:
- hangar_data:/hangar/uploads
networks: networks:
- web - web
db: db:
@ -98,4 +100,4 @@ networks:
volumes: volumes:
db_data: db_data:
uploads: hangar_data:

View File

@ -2,8 +2,10 @@ FROM openjdk:16-jdk-alpine
LABEL maintainer="Yannick Lamprecht <yannicklamprecht@live.de>" LABEL maintainer="Yannick Lamprecht <yannicklamprecht@live.de>"
ADD target/hangar-*.jar app.jar WORKDIR hangar
ADD docker/deployment/hangar/application.yml application.yml
ADD target/hangar-*.jar /hangar/app.jar
ADD docker/deployment/hangar/application.yml /hangar/application.yml
ENV TERM xterm-256color ENV TERM xterm-256color

View File

@ -16,6 +16,7 @@ hangar:
use-webpack: false use-webpack: false
auth-url: "https://hangar-auth.minidigger.me" auth-url: "https://hangar-auth.minidigger.me"
base-url: "https://hangar.minidigger.me" base-url: "https://hangar.minidigger.me"
plugin-upload-dir: "/hangar/uploads"
sso: sso:
secret: "changeme" secret: "changeme"

View File

@ -2,6 +2,8 @@ package io.papermc.hangar.service.pluginupload;
import io.papermc.hangar.config.hangar.HangarConfig; import io.papermc.hangar.config.hangar.HangarConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -14,6 +16,8 @@ import java.util.stream.Stream;
@Component @Component
public class ProjectFiles { public class ProjectFiles {
private static final Logger logger = LoggerFactory.getLogger(ProjectFiles.class);
private final Path pluginsDir; private final Path pluginsDir;
private final Path tmpDir; private final Path tmpDir;
@ -22,6 +26,7 @@ public class ProjectFiles {
Path uploadsDir = Path.of(hangarConfig.getPluginUploadDir()); Path uploadsDir = Path.of(hangarConfig.getPluginUploadDir());
pluginsDir = uploadsDir.resolve("plugins"); pluginsDir = uploadsDir.resolve("plugins");
tmpDir = uploadsDir.resolve("tmp"); tmpDir = uploadsDir.resolve("tmp");
logger.info("Init work dir {} ", uploadsDir);
} }
public Path getProjectDir(String owner, String name) { public Path getProjectDir(String owner, String name) {