testing this for a day if its bad i just wast my time

This commit is contained in:
NoLogicAlan committed 2026-10-05 03:29:05 +03:00
1 parent fd58343ce9
commit 656cbfe149
33 files changed
+726 -102

No files matched your search

+10 -6
View File
@@ -7,15 +7,19 @@ MYSQL_DATABASE=remix
MYSQL_USER=remix
MYSQL_PASSWORD=remix_pw
# --- Host port mappings ---
# Port exposed on the host for the bot (dashboard backend / health endpoint)
WEB_PORT=8080
# Port exposed on the host for NodeLink (audio node)
NODELINK_PORT=3000
# --- NodeLink (audio node) ---
# REQUIRED. Use the same value in config.json -> nodelink.password. NodeLink is reachable from the
# compose network only (no host port is published), but still pick something unguessable.
NODELINK_PASSWORD=change-me-nodelink
# Optional: git tag or commit of https://github.com/PerformanC/NodeLink to build (default v3.9.0).
# NODELINK_REF=v3.9.0
# --- Optional: commit shown by the bot (the image has no .git). CI passes the commit SHA. ---
# GIT_SHA=
# --- Timezone applied to all containers ---
TZ=UTC
# --- Optional: raw JSON config written to /app/config.json on first boot ---
# Takes precedence over docker/config_example.json when no config.json is mounted.
# CONFIG_JSON={"token":"YOUR_TOKEN","mysql":{"host":"mysql","port":3306,"user":"remix","password":"remix_pw","database":"remix"},"nodelink":{"host":"nodelink","port":3000,"password":"youshallnotpass"}}
# CONFIG_JSON={"token":"YOUR_TOKEN","mysql":{"host":"mysql","port":3306,"user":"remix","password":"remix_pw","database":"remix"},"nodelink":{"host":"nodelink","port":3000,"password":"change-me-nodelink"}}
+16 -8
View File
@@ -5,18 +5,20 @@ FROM node:22-bookworm-slim AS builder
WORKDIR /app
COPY package.json package-lock.json* ./
# .npmrc carries legacy-peer-deps (the @fluxerjs peer ranges conflict); package-lock.json pins versions.
COPY package.json package-lock.json* .npmrc ./
RUN npm ci --omit=dev --legacy-peer-deps 2>/dev/null || npm install --omit=dev --legacy-peer-deps
RUN npm ci --omit=dev --legacy-peer-deps || npm install --omit=dev --legacy-peer-deps
COPY . .
# ---- Runtime stage: minimal image with ffmpeg ----
# ---- Runtime stage: minimal image ----
# No ffmpeg: audio goes through NodeLink and the in-process Opus/WebM pipeline; ffprobe comes from
# the bundled ffprobe-static package.
FROM node:22-bookworm-slim AS runtime
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ffmpeg \
tini \
curl \
ca-certificates \
@@ -32,13 +34,19 @@ COPY --from=builder --chown=10001:10001 /app ./
RUN chmod +x docker/docker-entrypoint.sh && \
mkdir -p /app/storage && chown -R 10001:10001 /app
# Commit shown by the bot (the image has no .git). CI passes it with --build-arg GIT_SHA=<sha>.
ARG GIT_SHA=""
ENV GIT_SHA=${GIT_SHA}
# The bot touches this file every 15s while its event loop is running and it is logged in.
# docker/healthcheck.mjs reports unhealthy when it is missing or stale (no procps needed).
ENV HEARTBEAT_FILE=/tmp/remix-heartbeat
USER 10001:10001
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD pgrep -f "node .*index.mjs" >/dev/null 2>&1 || pgrep -f "node .*shard.mjs" >/dev/null 2>&1 || exit 1
CMD ["node", "docker/healthcheck.mjs"]
ENTRYPOINT ["/usr/bin/tini", "--", "/app/docker/docker-entrypoint.sh"]
CMD ["node", "index.mjs"]
CMD ["node", "index.mjs"]
+1 -1
View File
@@ -13,7 +13,7 @@
"nodelink": {
"host": "nodelink",
"port": 3000,
"password": "youshallnotpass",
"password": "change-me-nodelink",
"requestTimeout": 60000
},
"lastfm": {
+20 -12
View File
@@ -3,6 +3,9 @@ services:
build:
context: ..
dockerfile: docker/Dockerfile
args:
# Baked into the image so the bot can show a working commit link (the image has no .git).
GIT_SHA: ${GIT_SHA:-}
container_name: remix-bot
restart: unless-stopped
depends_on:
@@ -17,8 +20,7 @@ services:
- ../storage:/app/storage
environment:
- TZ=${TZ:-UTC}
ports:
- "${WEB_PORT:-8080}:80"
# No ports: the bot runs no HTTP server (the dashboard talks to it over Redis).
networks:
- remix-net
@@ -34,7 +36,8 @@ services:
volumes:
- mysql_data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD:-remix_root_pw}"]
# Password via MYSQL_PWD (not on the command line, so it is not visible in `ps` or warned about).
test: ["CMD-SHELL", "MYSQL_PWD=\"$$MYSQL_ROOT_PASSWORD\" mysqladmin ping -h localhost -u root"]
interval: 10s
timeout: 5s
retries: 10
@@ -55,18 +58,24 @@ services:
- remix-net
nodelink:
image: node:22-bookworm-slim
# NodeLink is NOT published on npm: it is built from the official repository using its own
# Dockerfile. NODELINK_REF is a git tag or commit (v3.9.0 = commit cdb02c6814fd...).
# Configuration is done with NODELINK_* environment variables (see NodeLink's docker-compose.yml
# for the full list, e.g. cluster, logging and per-source settings).
build:
context: https://github.com/PerformanC/NodeLink.git#${NODELINK_REF:-v3.9.0}
dockerfile: Dockerfile
container_name: remix-nodelink
restart: unless-stopped
working_dir: /nodelink
command: sh -c "if [ ! -f package.json ]; then npm init -y && npm install @performanc/nodelink; fi; node node_modules/@performanc/nodelink/index.js || node index.js"
environment:
- TZ=${TZ:-UTC}
volumes:
- nodelink_data:/nodelink
- ./nodelink.config.json:/nodelink/config.json:ro
ports:
- "${NODELINK_PORT:-3000}:3000"
- NODELINK_SERVER_HOST=0.0.0.0
- NODELINK_SERVER_PORT=3000
- NODELINK_SERVER_PASSWORD=${NODELINK_PASSWORD:?Set NODELINK_PASSWORD in docker/.env (and the same value in config.json -> nodelink.password)}
# Reachable from the bot over the compose network only. It is deliberately NOT published on
# the host: anyone who can reach it with the password can use your server as an audio proxy.
expose:
- "3000"
healthcheck:
test: ["CMD", "node", "-e", "require('net').connect(3000,'127.0.0.1').on('connect',function(){process.exit(0)}).on('error',function(){process.exit(1)})"]
interval: 5s
@@ -78,7 +87,6 @@ services:
volumes:
mysql_data:
nodelink_data:
networks:
remix-net:
+11
View File
@@ -0,0 +1,11 @@
import { readFileSync } from "node:fs";
const file = process.env.HEARTBEAT_FILE || "/tmp/remix-heartbeat";
const maxAgeMs = Number(process.env.HEARTBEAT_MAX_AGE_MS) || 60_000;
try {
const t = Number(readFileSync(file, "utf8"));
process.exit(Number.isFinite(t) && Date.now() - t < maxAgeMs ? 0 : 1);
} catch {
process.exit(1);
}