mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-13 16:40:01 +00:00
Release 2.4.0 (#870)
* chore: bump version to v2.4.0-preview * Bump actions/cache from 4 to 5 (#865) Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/cache dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Increase maximum DB connection pool size (#876) Increase DB connection timeout * Disable length limit for DB field PLUGIN_CONFIG.value (#875) * Bump actions/cache from 4 to 5 (#871) Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/cache dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/download-artifact from 7 to 8 (#882) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 7 to 8. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v7...v8) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: '8' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/upload-artifact from 6 to 7 (#881) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6 to 7. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/cache from 4 to 5 (#878) Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/cache dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Dont perform scans if no metadata plugins are enabled (#877) * Dont perform scans if no metadata plugins are enabled * Fix tests * Add PluginServiceTest.kt * Fix Sonar finding * Fix malformed external links (#886) * Fix external links being treated as internal * chore: bump version to v856-malformed-external-links-preview * Update JVM in Dockerfile to Java 25 * Revert incorrect version update * Allow loading .jar plugins in development mode (#885) * Allow loading .jar plugins in development mode * Remove unnecessary mock * Fix unit test * Add unit tests * Fix/879 add info and reset to config options (#887) * Fix gog.sh script * Add "description" property to ConfigProperties.kt Add InfoPopup.tsx and ResetToDefaultButton.tsx in UI * Bump actions/download-artifact from 7 to 8 (#891) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 7 to 8. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v7...v8) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: '8' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/cache from 4 to 5 (#890) Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/cache dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/upload-artifact from 6 to 7 (#889) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6 to 7. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Improve memory usage and performance (#888) mprove memory usage and performance by: * Using AOT cache * Using tuned JAVA_OPTIONS * Session timeout * Jetty threadpool * DB batch size * DB pool size * Library scanning * Make scan-concurrency configurable * Log retention * Off-load image processing to disk instead of RAM * Fix bug in PluginState * Update dependency version for ksp * Fix race condition preventing plugins from starting * Show remaining time (estimation) for library scans * Add unit test for plugin loading bugfix * Add unit tests for ImageService calculateBlurHash * Make username claim configurable (#895) Add fallbacks to resolve username * Fix sonar issues (#894) * Add custom "/sonar" command to GH copilot * Add Sonar plugin integration * Fix issues reported by Sonar * Ignore Sonar warning about AES/ECB * Add unit tests for GameyfinPluginManager * Add unit tests for GameService * Add more unit tests for GameService * Improve library card layout (#896) * Fix title not being centered * Add buttons to scan all libraries * Disable AVX for AOT cache training * Improve AOT cache training * Fix tests * Change output type of Docker Build CI action * Increase MAX_WAIT of aot-training to 5min * Optimize Docker CI pipeline * Add Sonar badges to README.md * Add custom metrics (downloads & scans) * Optimize DB connection & add cache for images * Adjusted logging on startup * * Show message on start page when no libraries/games are available * Disable "Scan" buttons when no metadata plugin is enabled * Fix thread pinning causing deadlocks * Pre-populate image cache at startup * Show "Loading" spinner while loading * Optimize static file serving (images) * Switch back to Tomcat (from Jetty) --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
+49
-13
@@ -1,19 +1,52 @@
|
||||
# syntax=docker/dockerfile:1.4
|
||||
|
||||
FROM eclipse-temurin:21-jre-alpine as builder
|
||||
WORKDIR /opt/gameyfin
|
||||
ARG JAR_FILE=./app/build/libs/app.jar
|
||||
# ── Stage 1: extract layers & collect plugins ────────────────────────────
|
||||
FROM eclipse-temurin:25-jre-alpine AS extractor
|
||||
|
||||
WORKDIR /builder
|
||||
|
||||
ARG JAR_FILE=./app/build/libs/app-*.jar
|
||||
COPY ${JAR_FILE} application.jar
|
||||
RUN java -Djarmode=tools -jar application.jar extract --layers --launcher --destination extracted
|
||||
|
||||
# Extract using layered layout for optimal Docker layer caching
|
||||
RUN java -Djarmode=tools -jar application.jar extract --layers --destination extracted
|
||||
|
||||
# Pre-collect plugin JARs so final stage can copy them in a single layer
|
||||
COPY --link ./plugins/ /tmp/plugins/
|
||||
RUN mkdir -p /opt/gameyfin/plugins \
|
||||
&& find /tmp/plugins -type f -path "*/build/libs/*.jar" -exec cp {} /opt/gameyfin/plugins/ \; \
|
||||
RUN mkdir -p /builder/plugins \
|
||||
&& find /tmp/plugins -type f -path "*/build/libs/*.jar" -exec cp {} /builder/plugins/ \; \
|
||||
&& rm -rf /tmp/plugins
|
||||
|
||||
# ── Stage 2: AOT cache training (must use the *runtime* JVM) ─────────────
|
||||
# Boot the full application, wait for readiness, fire warm-up HTTP requests
|
||||
# that exercise Vaadin/Hilla, Spring Security, Hibernate, and PF4J plugin
|
||||
# loading, then gracefully shut down
|
||||
FROM eclipse-temurin:25-jre AS aot-training
|
||||
|
||||
FROM eclipse-temurin:21-jre
|
||||
WORKDIR /training
|
||||
|
||||
# curl is needed by the training script to poll health and send warm-up requests
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends curl && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy the extracted layers to reassemble the application for the training run
|
||||
COPY --from=extractor /builder/extracted/dependencies/ ./
|
||||
COPY --from=extractor /builder/extracted/spring-boot-loader/ ./
|
||||
COPY --from=extractor /builder/extracted/snapshot-dependencies/ ./
|
||||
COPY --from=extractor /builder/extracted/application/ ./
|
||||
|
||||
# Copy plugins
|
||||
COPY --from=extractor /builder/plugins ./plugins
|
||||
|
||||
# Copy and run the AOT training script
|
||||
# On x86-64, the script passes UseAVX=0 to restrict generated code to baseline
|
||||
# SSE2 so the cache is portable across all amd64 CPUs (skipped on aarch64).
|
||||
COPY --link ./docker/aot-training.sh ./aot-training.sh
|
||||
RUN chmod +x aot-training.sh && ./aot-training.sh
|
||||
|
||||
# ── Stage 3: runtime image ───────────────────────────────────────────────
|
||||
FROM eclipse-temurin:25-jre
|
||||
|
||||
# OCI labels
|
||||
LABEL maintainer="grimsi" \
|
||||
@@ -49,12 +82,15 @@ RUN groupadd -g "$GID" "$USER" && \
|
||||
# Copy entrypoint script with proper perms and ownership
|
||||
COPY --link --chown=${UID}:${GID} --chmod=0755 ./docker/entrypoint.ubuntu.sh /entrypoint.sh
|
||||
|
||||
# Copy application layers and plugin jars from builder stage
|
||||
COPY --from=builder --link --chown=${UID}:${GID} /opt/gameyfin/extracted/dependencies/ ./
|
||||
COPY --from=builder --link --chown=${UID}:${GID} /opt/gameyfin/extracted/spring-boot-loader/ ./
|
||||
COPY --from=builder --link --chown=${UID}:${GID} /opt/gameyfin/extracted/snapshot-dependencies/ ./
|
||||
COPY --from=builder --link --chown=${UID}:${GID} /opt/gameyfin/extracted/application/ ./
|
||||
COPY --from=builder --link --chown=${UID}:${GID} /opt/gameyfin/plugins ./plugins
|
||||
# Copy application layers from extractor stage
|
||||
COPY --from=extractor --link --chown=${UID}:${GID} /builder/extracted/dependencies/ ./
|
||||
COPY --from=extractor --link --chown=${UID}:${GID} /builder/extracted/spring-boot-loader/ ./
|
||||
COPY --from=extractor --link --chown=${UID}:${GID} /builder/extracted/snapshot-dependencies/ ./
|
||||
COPY --from=extractor --link --chown=${UID}:${GID} /builder/extracted/application/ ./
|
||||
COPY --from=extractor --link --chown=${UID}:${GID} /builder/plugins ./plugins
|
||||
|
||||
# Copy AOT cache from training stage
|
||||
COPY --from=aot-training --link --chown=${UID}:${GID} /training/app.aot ./
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
|
||||
Executable
+124
@@ -0,0 +1,124 @@
|
||||
#!/usr/bin/env bash
|
||||
# ──────────────────────────────────────────────────────────────────────────────
|
||||
# AOT cache training script
|
||||
#
|
||||
# Instead of the quick-exit -Dspring.context.exit=onRefresh approach, this
|
||||
# script boots the full application, waits for readiness, fires HTTP requests
|
||||
# that exercise the hot paths (Vaadin/Hilla, Spring Security, Hibernate, PF4J
|
||||
# plugin loading), and then gracefully shuts the JVM down.
|
||||
#
|
||||
# Because the JVM is started with -XX:AOTCacheOutput=… it records method
|
||||
# profiling data for every code path that actually ran, producing a much
|
||||
# richer AOT cache than the "exit on refresh" strategy.
|
||||
# ──────────────────────────────────────────────────────────────────────────────
|
||||
set -euo pipefail
|
||||
|
||||
# ── Configurable knobs ────────────────────────────────────────────────────────
|
||||
APP_PORT=8080
|
||||
MGMT_PORT=8081
|
||||
HEALTH_URL="http://localhost:${MGMT_PORT}/actuator/health/readiness"
|
||||
MAX_WAIT=300 # seconds to wait for the app to become ready
|
||||
WARMUP_PAUSE=2 # seconds to sleep after warmup before sending SIGTERM
|
||||
|
||||
# Dummy AES key — only used inside the ephemeral training container
|
||||
export APP_KEY="bknLhYui9N21X2z3sIR+HR9LHI9STMMOZRz5K8nFzJY="
|
||||
|
||||
# ── Start the application in the background ───────────────────────────────────
|
||||
# On x86-64, restrict to baseline SSE2 (UseAVX=0) so the AOT cache is portable across all x86 CPUs
|
||||
# The flag is x86-only and must not be passed on aarch64.
|
||||
ARCH_OPTS=""
|
||||
case "$(uname -m)" in
|
||||
x86_64|amd64) ARCH_OPTS="-XX:UseAVX=0" ;;
|
||||
esac
|
||||
|
||||
echo "▶ Starting application for AOT training …"
|
||||
java -XX:AOTCacheOutput=app.aot \
|
||||
-XX:+UseCompactObjectHeaders \
|
||||
$ARCH_OPTS \
|
||||
-jar application.jar --spring.profiles.active=aot-training &
|
||||
APP_PID=$!
|
||||
|
||||
# ── Wait for readiness ────────────────────────────────────────────────────────
|
||||
echo "Waiting for health endpoint (${HEALTH_URL}) …"
|
||||
elapsed=0
|
||||
until curl -sf "${HEALTH_URL}" 2>/dev/null | grep -q '"status":"UP"'; do
|
||||
if ! kill -0 "$APP_PID" 2>/dev/null; then
|
||||
echo "✗ Application exited prematurely (PID ${APP_PID})."
|
||||
exit 1
|
||||
fi
|
||||
if [ "$elapsed" -ge "$MAX_WAIT" ]; then
|
||||
echo "✗ Timed out after ${MAX_WAIT}s waiting for the app to start."
|
||||
kill "$APP_PID" 2>/dev/null || true
|
||||
exit 1
|
||||
fi
|
||||
sleep 1s
|
||||
elapsed=$((elapsed + 1))
|
||||
done
|
||||
echo "✓ Application is ready (took ~${elapsed}s)."
|
||||
|
||||
# ── Warm-up requests ─────────────────────────────────────────────────────────
|
||||
# Each request exercises a different slice of the runtime:
|
||||
# • Vaadin Hilla page rendering + React SSR bootstrap
|
||||
# • Spring Security filter chain
|
||||
# • Hilla JSON-RPC endpoint serialisation (SetupEndpoint, UserEndpoint)
|
||||
# • Actuator / Micrometer metrics
|
||||
echo "Sending warm-up requests …"
|
||||
|
||||
# Helper: ignore HTTP errors — we only care that the JVM executes the code path.
|
||||
warmup() {
|
||||
echo " → $1"
|
||||
curl -sf -o /dev/null -w " HTTP %{http_code} (%{time_total}s)\n" "$@" || true
|
||||
}
|
||||
|
||||
warmup_post() {
|
||||
local url="$1"
|
||||
local body="${2:-{}}"
|
||||
echo " → POST $url"
|
||||
curl -sf -o /dev/null -w " HTTP %{http_code} (%{time_total}s)\n" \
|
||||
-X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$body" \
|
||||
"$url" || true
|
||||
}
|
||||
|
||||
# -- Vaadin / static pages --
|
||||
warmup "http://localhost:${APP_PORT}/"
|
||||
warmup "http://localhost:${APP_PORT}/login"
|
||||
warmup "http://localhost:${APP_PORT}/setup"
|
||||
|
||||
# -- Hilla endpoints (JSON-RPC style: POST /connect/<Endpoint>/<method>) --
|
||||
warmup_post "http://localhost:${APP_PORT}/connect/SetupEndpoint/isSetupCompleted"
|
||||
warmup_post "http://localhost:${APP_PORT}/connect/UserEndpoint/getUserInfo"
|
||||
warmup_post "http://localhost:${APP_PORT}/connect/MessageEndpoint/isEnabled"
|
||||
warmup_post "http://localhost:${APP_PORT}/connect/ConfigEndpoint/areGameRequestsEnabled"
|
||||
warmup_post "http://localhost:${APP_PORT}/connect/PlatformEndpoint/getStats"
|
||||
|
||||
# -- Actuator --
|
||||
warmup "http://localhost:${MGMT_PORT}/actuator/health"
|
||||
warmup "http://localhost:${MGMT_PORT}/actuator/info"
|
||||
warmup "http://localhost:${MGMT_PORT}/actuator/metrics"
|
||||
|
||||
echo "✓ Warm-up complete."
|
||||
|
||||
# ── Graceful shutdown ─────────────────────────────────────────────────────────
|
||||
echo "⏳ Pausing ${WARMUP_PAUSE}s before shutdown …"
|
||||
sleep "$WARMUP_PAUSE"
|
||||
|
||||
echo "⏹ Sending SIGTERM to PID ${APP_PID} …"
|
||||
kill "$APP_PID" 2>/dev/null || true
|
||||
|
||||
# Wait for the process to exit
|
||||
if wait "$APP_PID" 2>/dev/null; then
|
||||
echo "✓ Application exited cleanly."
|
||||
else
|
||||
echo "✓ Application exited (code $?)."
|
||||
fi
|
||||
|
||||
# ── Verify the AOT cache was produced ─────────────────────────────────────────
|
||||
if [ -s app.aot ]; then
|
||||
echo "✓ AOT cache written ($(du -h app.aot | cut -f1))."
|
||||
else
|
||||
echo "✗ AOT cache file is missing or empty!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -3,6 +3,8 @@ services:
|
||||
image: ghcr.io/gameyfin/gameyfin:2
|
||||
container_name: gameyfin
|
||||
restart: unless-stopped
|
||||
# (optional) Limit the memory usage of the container. Recommended minimum is 1024m.
|
||||
# mem_limit: 1024m
|
||||
environment:
|
||||
# Generate a new APP_KEY using the command "openssl rand -base64 32" or similar.
|
||||
APP_KEY: <your app key here>
|
||||
@@ -14,6 +16,14 @@ services:
|
||||
# (optional) Set the user and group ID to run Gameyfin with a specific user.
|
||||
# PUID: 1000 # Change this to your user ID if needed
|
||||
# PGID: 1000 # Change this to your group ID if needed
|
||||
|
||||
# (optional) Override or extend JVM flags. The container ships with sensible defaults.
|
||||
#
|
||||
# JAVA_OPTS – extra flags *appended* to the built-in defaults:
|
||||
# JAVA_OPTS: -Dsome.property=value
|
||||
#
|
||||
# JAVA_OPTS_OVERRIDE – *replaces* all built-in defaults entirely:
|
||||
# JAVA_OPTS_OVERRIDE: -Xmx512m -XX:+UseG1GC
|
||||
volumes:
|
||||
- "./db:/opt/gameyfin/db"
|
||||
- "./data:/opt/gameyfin/data"
|
||||
|
||||
@@ -20,6 +20,50 @@ if [ -n "$PUID$PGID" ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
export JAVA_TOOL_OPTIONS="${JAVA_OPTS:-}"
|
||||
# ── JVM memory tuning for containers ──────────────────────────────
|
||||
# Explicit heap cap instead of MaxRAMPercentage to leave room for
|
||||
# metaspace, native threads, NIO direct buffers and H2 file-mapped pages.
|
||||
# -Xmx512m / -Xms128m – hard heap ceiling; floor at 128 m so idle apps shrink.
|
||||
# UseG1GC – good general-purpose GC.
|
||||
# G1HeapRegionSize=1m – smaller regions improve reclamation at small heaps.
|
||||
# MinHeapFreeRatio / MaxHeapFreeRatio – return unused heap to the OS faster.
|
||||
# G1PeriodicGCInterval – triggers a concurrent GC every 15 s while idle so
|
||||
# the free-ratio settings are actually evaluated and
|
||||
# uncommitted pages are returned to the OS.
|
||||
# UseStringDeduplication saves heap on duplicate String values.
|
||||
# UseCompactObjectHeaders saves ~8 bytes per object reference on 64-bit JVMs.
|
||||
# Reduced thread-stack size (-Xss512k) saves ~0.5 MB per thread.
|
||||
# MaxMetaspaceSize – bounds class-metadata growth (Vaadin/Spring load many).
|
||||
# MaxDirectMemorySize – caps NIO direct buffers.
|
||||
# AOT Cache reduces startup time and memory footprint.
|
||||
DEFAULT_JVM_OPTS="\
|
||||
-Xms128m \
|
||||
-Xmx512m \
|
||||
-XX:+UseG1GC \
|
||||
-XX:G1HeapRegionSize=1m \
|
||||
-XX:MinHeapFreeRatio=15 \
|
||||
-XX:MaxHeapFreeRatio=30 \
|
||||
-XX:G1PeriodicGCInterval=15000 \
|
||||
-XX:+UseStringDeduplication \
|
||||
-XX:+UseCompactObjectHeaders \
|
||||
-XX:MaxMetaspaceSize=192m \
|
||||
-XX:MaxDirectMemorySize=64m \
|
||||
-Xss512k"
|
||||
|
||||
exec gosu gameyfin:gameyfin java -Djava.net.preferIPv4Stack=true org.springframework.boot.loader.launch.JarLauncher
|
||||
# Append AOT Cache flag if a non-empty training cache file exists
|
||||
if [ -s /opt/gameyfin/app.aot ]; then
|
||||
DEFAULT_JVM_OPTS="${DEFAULT_JVM_OPTS} -XX:AOTCache=/opt/gameyfin/app.aot"
|
||||
fi
|
||||
|
||||
# Two env-var options for users (set in docker-compose "environment:"):
|
||||
# JAVA_OPTS – extra flags *appended* to the built-in defaults
|
||||
# e.g. JAVA_OPTS=-Dsome.prop=value
|
||||
# JAVA_OPTS_OVERRIDE – if set, *replaces* all built-in defaults entirely
|
||||
# e.g. JAVA_OPTS_OVERRIDE=-Xmx512m -XX:+UseG1GC
|
||||
if [ -n "${JAVA_OPTS_OVERRIDE:-}" ]; then
|
||||
export JDK_JAVA_OPTIONS="${JAVA_OPTS_OVERRIDE}"
|
||||
else
|
||||
export JDK_JAVA_OPTIONS="${DEFAULT_JVM_OPTS} ${JAVA_OPTS:-}"
|
||||
fi
|
||||
|
||||
exec gosu gameyfin:gameyfin java -Djava.net.preferIPv4Stack=true -jar application.jar
|
||||
|
||||
Reference in New Issue
Block a user