mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
feat: add Docker support — Dockerfile, docker-compose, entrypoint
This commit is contained in:
1 parent
4a436d6044
commit
799b527467
8 files changed
+373
-1
No files matched your search
@@ -0,0 +1,26 @@
|
||||
# Bot token from https://fluxer.app/developers
|
||||
BOT_TOKEN=your_bot_token_here
|
||||
|
||||
# MySQL credentials
|
||||
MYSQL_ROOT_PASSWORD=change_me_root
|
||||
MYSQL_DATABASE=remix
|
||||
MYSQL_USER=remix
|
||||
MYSQL_PASSWORD=change_me
|
||||
|
||||
# Web dashboard port mapping (host:container)
|
||||
WEB_PORT=8080
|
||||
|
||||
# NodeLink port mapping
|
||||
NODELINK_PORT=3000
|
||||
|
||||
# Timezone
|
||||
TZ=UTC
|
||||
|
||||
# Optional: paste your entire config.json as a single line (base64 or raw JSON)
|
||||
# If set, the entrypoint will write it to /app/config.json on first boot.
|
||||
# CONFIG_JSON={"token":"...","mysql":{...}}
|
||||
|
||||
# Fluxer OAuth2 (for dashboard)
|
||||
FLUXER_OAUTH_ID=
|
||||
FLUXER_OAUTH_SECRET=
|
||||
FLUXER_OAUTH_REDIRECT_URI=
|
||||
@@ -0,0 +1,43 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# ---- Builder stage: install deps ----
|
||||
FROM node:22-bookworm-slim AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json* ./
|
||||
|
||||
RUN npm ci --omit=dev 2>/dev/null || npm install --omit=dev
|
||||
|
||||
COPY . .
|
||||
|
||||
# ---- Runtime stage: minimal image with ffmpeg ----
|
||||
FROM node:22-bookworm-slim AS runtime
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ffmpeg \
|
||||
tini \
|
||||
curl \
|
||||
&& \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN groupadd -r remix && useradd -r -g remix -d /app -s /sbin/nologin remix
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder --chown=remix:remix /app ./
|
||||
|
||||
RUN chmod +x docker/docker-entrypoint.sh && \
|
||||
mkdir -p /app/storage && chown -R remix:remix /app
|
||||
|
||||
USER remix
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||
CMD pgrep -f "node index.mjs" >/dev/null 2>&1 || exit 1
|
||||
|
||||
ENTRYPOINT ["/usr/bin/tini", "--", "/app/docker/docker-entrypoint.sh"]
|
||||
|
||||
CMD ["node", "index.mjs"]
|
||||
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"token": "YOUR_BOT_TOKEN_HERE",
|
||||
"prefix": "%",
|
||||
"embedColor": "0xe9196c",
|
||||
"owners": [],
|
||||
"mysql": {
|
||||
"host": "mysql",
|
||||
"port": 3306,
|
||||
"user": "remix",
|
||||
"password": "remix_pw",
|
||||
"database": "remix"
|
||||
},
|
||||
"nodelink": {
|
||||
"host": "nodelink",
|
||||
"port": 3000,
|
||||
"password": "youshallnotpass",
|
||||
"requestTimeout": 60000
|
||||
},
|
||||
"spotify": {
|
||||
"clientId": "",
|
||||
"clientSecret": ""
|
||||
},
|
||||
"lastfm": {
|
||||
"apiKey": "",
|
||||
"apiSecret": "",
|
||||
"scrobbleThreshold": 0.5,
|
||||
"scrobbleMinMs": 240000
|
||||
},
|
||||
"dashboard": {
|
||||
"enabled": false,
|
||||
"redis": {
|
||||
"url": "redis://redis:6379"
|
||||
},
|
||||
"fluxer": {
|
||||
"id": "",
|
||||
"secret": "",
|
||||
"redirectUri": ""
|
||||
}
|
||||
},
|
||||
"webPort": 80,
|
||||
"logging": {
|
||||
"enabled": true,
|
||||
"warn": true,
|
||||
"player": true,
|
||||
"inactivity": false,
|
||||
"aloneCheck": false,
|
||||
"voice247": true,
|
||||
"voiceState": false,
|
||||
"voice": false,
|
||||
"mediaplayer": false,
|
||||
"commands": true,
|
||||
"guild": true,
|
||||
"recovery": true,
|
||||
"settings": true,
|
||||
"worker": false,
|
||||
"moonlink": true,
|
||||
"dashboard": false,
|
||||
"redis": false
|
||||
},
|
||||
"timers": {
|
||||
"inactivityTimeout": 180000,
|
||||
"aloneCheckInterval": 30000,
|
||||
"aloneCheckDebounce": 500,
|
||||
"rejoin247Delay": 3000,
|
||||
"leave247RejoinDelay": 5000,
|
||||
"intentionalLeaveTTL": 10000
|
||||
},
|
||||
"presenceInterval": 30000,
|
||||
"presenceContents": [],
|
||||
"fluxer.js": {
|
||||
"timeout": 15000,
|
||||
"retries": 3
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
services:
|
||||
bot:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile
|
||||
container_name: remix-bot
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ./config.json:/app/config.json
|
||||
- ../storage:/app/storage
|
||||
environment:
|
||||
- TZ=${TZ:-UTC}
|
||||
ports:
|
||||
- "${WEB_PORT:-8080}:80"
|
||||
networks:
|
||||
- remix-net
|
||||
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
container_name: remix-mysql
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-remix_root_pw}
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-remix}
|
||||
MYSQL_USER: ${MYSQL_USER:-remix}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-remix_pw}
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD:-remix_root_pw}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 30s
|
||||
networks:
|
||||
- remix-net
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: remix-redis
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
networks:
|
||||
- remix-net
|
||||
|
||||
nodelink:
|
||||
image: node:22-bookworm-slim
|
||||
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"
|
||||
networks:
|
||||
- remix-net
|
||||
|
||||
volumes:
|
||||
mysql_data:
|
||||
nodelink_data:
|
||||
|
||||
networks:
|
||||
remix-net:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
CONFIG_FILE="/app/config.json"
|
||||
|
||||
if [ ! -f "$CONFIG_FILE" ]; then
|
||||
if [ -n "$CONFIG_JSON" ]; then
|
||||
printf '%s' "$CONFIG_JSON" > "$CONFIG_FILE"
|
||||
echo "[Docker] Generated config.json from CONFIG_JSON env var."
|
||||
elif [ -f "/app/docker/config_example.json" ]; then
|
||||
cp /app/docker/config_example.json "$CONFIG_FILE"
|
||||
echo "[Docker] WARNING: config.json not found — copied from docker/config_example.json."
|
||||
echo "[Docker] Edit the mounted config.json and restart the container."
|
||||
else
|
||||
echo "[Docker] FATAL: config.json not found and no template available." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "node" ] && [ "$2" = "index.mjs" ]; then
|
||||
echo "[Docker] Starting Remix bot..."
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"server": {
|
||||
"port": 3000,
|
||||
"password": "youshallnotpass"
|
||||
},
|
||||
"sources": {
|
||||
"youtube": true,
|
||||
"ytmusic": true,
|
||||
"soundcloud": true,
|
||||
"deezer": true,
|
||||
"spotify": true,
|
||||
"http": true
|
||||
},
|
||||
"search": {
|
||||
"defaultSource": "ytmusic",
|
||||
"fallback": true
|
||||
},
|
||||
"audio": {
|
||||
"normalization": true
|
||||
},
|
||||
"cache": {
|
||||
"enabled": true,
|
||||
"maxSize": 536870912
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user