diff --git a/.env.example b/.env.example index 0be60ad2..55bf672f 100644 --- a/.env.example +++ b/.env.example @@ -8,7 +8,7 @@ CORS_PATTERN=/** CORS_ALLOWED_ORIGINS=* CORS_ALLOWED_METHODS=GET,POST,PUT,PATCH,DELETE,OPTIONS CORS_ALLOWED_HEADERS=* -CORS_ALLOW_CREDENTIALS=true +CORS_ALLOW_CREDENTIALS=false KEYCLOAK_HOST=http://localhost:8090 KEYCLOAK_REALM=heroes @@ -26,11 +26,9 @@ MAX_FILE_SIZE=2048MB MAX_REQUEST_SIZE=100MB LOG_PATH=log -ROOT_LOG_LEVEL=trace ROOT_LOG_LEVEL_CONSOLE=info ROOT_LOG_LEVEL_FILE=info ROOT_LOG_LEVEL_JSON=info -CALLV2_LOG_LEVEL=trace CALLV2_LOG_LEVEL_CONSOLE=debug CALLV2_LOG_LEVEL_FILE=debug CALLV2_LOG_LEVEL_JSON=debug \ No newline at end of file diff --git a/.gitignore b/.gitignore index e8fb0dbb..2868c3c3 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,4 @@ bin .env *.log -*.log.json \ No newline at end of file +*log.json \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 6aaad901..29943d2b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,19 +6,17 @@ COPY . . RUN ./gradlew clean bootJar --no-daemon -FROM eclipse-temurin:21.0.7_6-jdk-alpine +FROM eclipse-temurin:21.0.7_6-jre-alpine COPY --from=builder /usr/app/build/libs/application.jar /opt/app/application.jar -ENV STORAGE_LOCATION=/srv/drive/storage +RUN mkdir -p /var/log/drive-api +RUN mkdir -p /srv/drive/storage -RUN mkdir -p $STORAGE_LOCATION RUN addgroup -S app && adduser -S app -G app -RUN chown -R app:app /srv/drive/storage/ -USER app:app - +RUN chown -R app:app /srv/drive/storage +RUN chown -R app:app /var/log/drive-api - -EXPOSE 80 +USER app:app CMD ["sh", "-c", "java -jar /opt/app/application.jar"] \ No newline at end of file diff --git a/infrastructure/src/main/resources/application-env.yml b/infrastructure/src/main/resources/application-env.yml index 1ad58a86..8d6937b4 100644 --- a/infrastructure/src/main/resources/application-env.yml +++ b/infrastructure/src/main/resources/application-env.yml @@ -24,7 +24,7 @@ postgres: db: ddl-auto: ${DB_DDL_AUTO} -reuqest-timeout: ${REQUEST_TIMEOUT} +request-timeout: ${REQUEST_TIMEOUT} storage: max-file-size: ${MAX_FILE_SIZE} diff --git a/infrastructure/src/main/resources/application.yml b/infrastructure/src/main/resources/application.yml index e933fa4f..2d954a2b 100644 --- a/infrastructure/src/main/resources/application.yml +++ b/infrastructure/src/main/resources/application.yml @@ -10,10 +10,10 @@ server: spring: profiles: - active: ${SPRING_PROFILES_ACTIVE:prd} + active: ${SPRING_PROFILES_ACTIVE:env} mvc: async: - request-timeout: ${reuqest-timeout:30000} + request-timeout: ${request-timeout:30000} servlet: multipart: enabled: true diff --git a/infrastructure/src/main/resources/log4j2-spring.xml b/infrastructure/src/main/resources/log4j2-spring.xml index eecde3e7..5af400bd 100644 --- a/infrastructure/src/main/resources/log4j2-spring.xml +++ b/infrastructure/src/main/resources/log4j2-spring.xml @@ -1,37 +1,35 @@ - ${env:ROOT_LOG_LEVEL:-info} - ${env:ROOT_LOG_LEVEL_CONSOLE:-info} - ${env:ROOT_LOG_LEVEL_FILE:-info} - ${env:ROOT_LOG_LEVEL_JSON:-info} + ${env:ROOT_LOG_LEVEL_CONSOLE:-info} + ${env:ROOT_LOG_LEVEL_FILE:-off} + ${env:ROOT_LOG_LEVEL_JSON:-off} - ${env:CALLV2_LOG_LEVEL:-info} - ${env:CALLV2_LOG_LEVEL_CONSOLE:-info} - ${env:CALLV2_LOG_LEVEL_FILE:-info} - ${env:CALLV2_LOG_LEVEL_JSON:-info} - - ${env:LOG_PATH:-log} - %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %X{traceId} %-5level %logger{36}.%M(%F:%L) - %msg%n + ${env:CALLV2_LOG_LEVEL_CONSOLE:-info} + ${env:CALLV2_LOG_LEVEL_FILE:-off} + ${env:CALLV2_LOG_LEVEL_JSON:-off} + + ${env:LOG_PATH:-/var/log/drive-api} + %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %X{traceId} %-5level %logger{36}.%M(%F:%L) - %msg%n - + - + fileName="${logPath}/log.log" + filePattern="${logPath}/log-%d{yyyy-MM-dd}.log.gz"> + + fileName="${logPath}/log.json" + filePattern="${logPath}/log-%d{yyyy-MM-dd}.log.json.gz"> - + - - - - + - - -