Remove deploy/ folder (belongs in Jannik-Cloud)
The Dockerfile, docker-compose snippet, Caddy fragment, and generate-env.sh now live alongside the rest of the Jannik-Cloud services — that's the one place that already knows how to manage them. The MelodyMuse repo is now app-only: source, build config, the Node server, and docs. The README's 'Docker / Jannik-Cloud' subsection is replaced with a short note pointing the reader at the Jannik-Cloud service directory and the project-layout section no longer lists deploy/.
This commit is contained in:
@@ -80,10 +80,12 @@ npm start # node server.mjs, serves dist/ + /api/*
|
|||||||
|
|
||||||
Then put a reverse proxy (Caddy, nginx, …) in front of `localhost:3000`.
|
Then put a reverse proxy (Caddy, nginx, …) in front of `localhost:3000`.
|
||||||
|
|
||||||
### Docker / Jannik-Cloud
|
### Deployment
|
||||||
|
|
||||||
Reference files are in [`deploy/`](./deploy). See
|
This repo contains **only the app** — the Dockerfile, docker-compose,
|
||||||
[`deploy/README.md`](./deploy/README.md) for the full deploy guide.
|
Caddy fragment, and `.env` generation script for the Jannik-Cloud
|
||||||
|
service live alongside the rest of the Jannik-Cloud services. To
|
||||||
|
deploy, copy them into a new `services/melodymuse/` directory there.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -346,7 +348,6 @@ MelodyMuse/
|
|||||||
├── server/
|
├── server/
|
||||||
│ └── prompts.mjs # system + user prompt construction
|
│ └── prompts.mjs # system + user prompt construction
|
||||||
├── server.mjs # ★ the runtime — serves SPA + /api/*
|
├── server.mjs # ★ the runtime — serves SPA + /api/*
|
||||||
├── deploy/ # reference Dockerfile, compose, caddy, env script
|
|
||||||
├── public/favicon.svg
|
├── public/favicon.svg
|
||||||
├── index.html
|
├── index.html
|
||||||
├── tailwind.config.js
|
├── tailwind.config.js
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
# Multi-stage Dockerfile for MelodyMuse.
|
|
||||||
#
|
|
||||||
# This file lives in the MelodyMuse repo under `deploy/` as a reference. To
|
|
||||||
# add MelodyMuse to a Docker-Compose deployment (including your Jannik-Cloud
|
|
||||||
# stack), copy this file to your service directory and reference it from
|
|
||||||
# docker-compose.yml — see `docker-compose.example.yml`.
|
|
||||||
|
|
||||||
# Stage 1 — build the SPA
|
|
||||||
FROM node:20-alpine AS builder
|
|
||||||
|
|
||||||
RUN apk add --no-cache git
|
|
||||||
|
|
||||||
# Override these at build time if you fork the repo.
|
|
||||||
ARG REPO_URL=https://git.orfel.de/Jannik/MelodyMuse.git
|
|
||||||
ARG BRANCH=main
|
|
||||||
|
|
||||||
WORKDIR /build
|
|
||||||
RUN git clone --depth 1 --branch ${BRANCH} ${REPO_URL} .
|
|
||||||
RUN npm ci
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
# Stage 2 — runtime: just Node + the built assets + the proxy server
|
|
||||||
FROM node:20-alpine
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=builder /build/dist ./dist
|
|
||||||
COPY --from=builder /build/server.mjs ./server.mjs
|
|
||||||
COPY --from=builder /build/server ./server
|
|
||||||
COPY --from=builder /build/package.json ./package.json
|
|
||||||
|
|
||||||
# server.mjs uses only Node's built-ins — no production deps to install.
|
|
||||||
# Install nothing here; the image stays small.
|
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
|
||||||
ENV PORT=3000
|
|
||||||
|
|
||||||
EXPOSE 3000
|
|
||||||
|
|
||||||
# Quick healthcheck so Docker / your orchestrator can detect a broken boot.
|
|
||||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
|
||||||
CMD wget -qO- http://localhost:3000/api/health || exit 1
|
|
||||||
|
|
||||||
CMD ["node", "server.mjs"]
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
# Deploying MelodyMuse
|
|
||||||
|
|
||||||
The files in this folder are **reference templates**. MelodyMuse is a single
|
|
||||||
Node.js server (`server.mjs` in the repo root) that serves the built SPA and
|
|
||||||
proxies LLM calls. To deploy it you can:
|
|
||||||
|
|
||||||
- Run `node server.mjs` directly (after `npm run build`)
|
|
||||||
- Use the included `Dockerfile` + `docker-compose.yml`
|
|
||||||
- Copy these into your Jannik-Cloud `services/melodymuse/` directory
|
|
||||||
|
|
||||||
## Required environment variables
|
|
||||||
|
|
||||||
| Var | Required? | Default | Notes |
|
|
||||||
|---|---|---|---|
|
|
||||||
| `LLM_ENDPOINT` | **yes** | — | OpenAI-compatible base URL, e.g. `https://api.minimax.chat/v1` |
|
|
||||||
| `LLM_API_KEY` | **yes** | — | Provider secret key. **Never** set this in the browser. |
|
|
||||||
| `LLM_MODEL` | no | `MiniMax-M3` | Model name |
|
|
||||||
| `PORT` | no | `3000` | Listen port |
|
|
||||||
| `CORS_ORIGIN` | no | `*` | Set to a specific origin in production if you split SPA and server |
|
|
||||||
|
|
||||||
The server refuses to start if `LLM_ENDPOINT` or `LLM_API_KEY` is missing.
|
|
||||||
|
|
||||||
## Option 1 — Bare Node
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# Clone, build, run
|
|
||||||
git clone https://git.orfel.de/Jannik/MelodyMuse.git
|
|
||||||
cd MelodyMuse
|
|
||||||
npm ci
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
# Set the secrets and start
|
|
||||||
export LLM_ENDPOINT=https://api.minimax.chat/v1
|
|
||||||
export LLM_API_KEY=sk-...
|
|
||||||
npm start
|
|
||||||
```
|
|
||||||
|
|
||||||
## Option 2 — Docker
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# Build
|
|
||||||
docker build -f deploy/Dockerfile -t melodymuse .
|
|
||||||
|
|
||||||
# Run
|
|
||||||
docker run --rm -p 3000:3000 \
|
|
||||||
-e LLM_ENDPOINT=https://api.minimax.chat/v1 \
|
|
||||||
-e LLM_API_KEY=sk-... \
|
|
||||||
melodymuse
|
|
||||||
```
|
|
||||||
|
|
||||||
## Option 3 — Add to Jannik-Cloud
|
|
||||||
|
|
||||||
1. Create `services/melodymuse/` in your Jannik-Cloud repo.
|
|
||||||
2. Copy the four files from this folder into it:
|
|
||||||
- `Dockerfile`
|
|
||||||
- `docker-compose.yml` (rename from `docker-compose.example.yml`)
|
|
||||||
- `melodymuse.caddy`
|
|
||||||
- `generate-env.sh`
|
|
||||||
3. `touch services/melodymuse/service.enabled`
|
|
||||||
4. `bash services/melodymuse/generate-env.sh` — answer the prompts.
|
|
||||||
5. Commit `services/melodymuse/.env.age` and the four non-secret files.
|
|
||||||
6. `sudo bash /opt/Jannik-Cloud/deploy_script.sh` — Caddy will pick up
|
|
||||||
`melodymuse.orfel.de` and route it to the container.
|
|
||||||
|
|
||||||
## Endpoints exposed by the server
|
|
||||||
|
|
||||||
| Method | Path | Purpose |
|
|
||||||
|---|---|---|
|
|
||||||
| `GET` | `/api/health` | Health check. Returns `{ ok, llm_configured, model, endpoint }`. |
|
|
||||||
| `POST` | `/api/generate` | Main generation. Body matches the `GenerateRequest` shape. |
|
|
||||||
| `POST` | `/api/style/random` | Returns a one-line Suno style. Body: `{ mode: "normal" \| "crazy" }`. |
|
|
||||||
| `GET` | everything else | Serves the built SPA from `dist/`, with SPA fallback to `index.html`. |
|
|
||||||
|
|
||||||
## Image footprint
|
|
||||||
|
|
||||||
The runtime image is `node:20-alpine` with only `server.mjs` and the
|
|
||||||
built SPA. No production `npm install` (server.mjs uses only Node
|
|
||||||
built-ins). Total image size is roughly 200 MB.
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
# Example docker-compose snippet for MelodyMuse.
|
|
||||||
#
|
|
||||||
# Drop this into your service directory (e.g. `services/melodymuse/` in a
|
|
||||||
# Jannik-Cloud-style stack) and rename to `docker-compose.yml`. Pair it with
|
|
||||||
# `Dockerfile`, `melodymuse.caddy`, and `generate-env.sh` from the same folder.
|
|
||||||
|
|
||||||
services:
|
|
||||||
melodymuse:
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
image: melodymuse:latest
|
|
||||||
container_name: melodymuse
|
|
||||||
restart: unless-stopped
|
|
||||||
ports:
|
|
||||||
# Only loopback — let your reverse proxy (Caddy) handle public traffic.
|
|
||||||
- "127.0.0.1:3000:3000"
|
|
||||||
environment:
|
|
||||||
LLM_ENDPOINT: ${LLM_ENDPOINT}
|
|
||||||
LLM_API_KEY: ${LLM_API_KEY}
|
|
||||||
LLM_MODEL: ${LLM_MODEL:-MiniMax-M3}
|
|
||||||
PORT: ${PORT:-3000}
|
|
||||||
CORS_ORIGIN: ${CORS_ORIGIN:-*}
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpus: "0.5"
|
|
||||||
memory: 256M
|
|
||||||
networks:
|
|
||||||
- jannik-cloud-net
|
|
||||||
|
|
||||||
networks:
|
|
||||||
jannik-cloud-net:
|
|
||||||
external: true
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# generate-env.sh — create the MelodyMuse `.env` (and AGE-encrypt it).
|
|
||||||
#
|
|
||||||
# Usage: bash generate-env.sh
|
|
||||||
#
|
|
||||||
# Customize LLM_ENDPOINT / LLM_MODEL below before running. The script prompts
|
|
||||||
# for the LLM_API_KEY so it doesn't end up in your shell history.
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
||||||
REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
|
|
||||||
AGE_PUB_KEY="${REPO_ROOT}/keys/age-public-key.txt"
|
|
||||||
|
|
||||||
# ─── Customize these for your deployment ─────────────────────────────────────
|
|
||||||
LLM_ENDPOINT_DEFAULT="https://api.minimax.chat/v1"
|
|
||||||
LLM_MODEL_DEFAULT="MiniMax-M3"
|
|
||||||
# ──────────────────────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
echo "LLM endpoint [${LLM_ENDPOINT_DEFAULT}]:"
|
|
||||||
read -r LLM_ENDPOINT
|
|
||||||
LLM_ENDPOINT="${LLM_ENDPOINT:-$LLM_ENDPOINT_DEFAULT}"
|
|
||||||
|
|
||||||
echo "LLM model [${LLM_MODEL_DEFAULT}]:"
|
|
||||||
read -r LLM_MODEL
|
|
||||||
LLM_MODEL="${LLM_MODEL:-$LLM_MODEL_DEFAULT}"
|
|
||||||
|
|
||||||
echo "LLM API key (input is hidden):"
|
|
||||||
read -rs LLM_API_KEY
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
if [[ -z "${LLM_API_KEY}" ]]; then
|
|
||||||
echo "ERROR: LLM_API_KEY is required."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat > "${SCRIPT_DIR}/.env" <<EOF
|
|
||||||
# MelodyMuse — generated by generate-env.sh
|
|
||||||
LLM_ENDPOINT=${LLM_ENDPOINT}
|
|
||||||
LLM_API_KEY=${LLM_API_KEY}
|
|
||||||
LLM_MODEL=${LLM_MODEL}
|
|
||||||
PORT=3000
|
|
||||||
CORS_ORIGIN=*
|
|
||||||
EOF
|
|
||||||
|
|
||||||
chmod 600 "${SCRIPT_DIR}/.env"
|
|
||||||
|
|
||||||
if [[ -f "${AGE_PUB_KEY}" ]]; then
|
|
||||||
age -r "$(cat "${AGE_PUB_KEY}")" -o "${SCRIPT_DIR}/.env.age" "${SCRIPT_DIR}/.env"
|
|
||||||
echo ""
|
|
||||||
echo "Encrypted .env → .env.age"
|
|
||||||
echo "Commit .env.age (NOT .env) to your repo, then re-run deploy."
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
echo "No AGE public key found at ${AGE_PUB_KEY}."
|
|
||||||
echo "Encrypt manually before committing, e.g.:"
|
|
||||||
echo " age -r <recipient> -o .env.age .env"
|
|
||||||
fi
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
# Caddy reverse proxy for MelodyMuse.
|
|
||||||
# Drop this into your service directory as `melodymuse.caddy` — your
|
|
||||||
# Caddyfile (or `caddy` Docker image) will pick it up automatically.
|
|
||||||
|
|
||||||
melodymuse.orfel.de {
|
|
||||||
encode zstd gzip
|
|
||||||
reverse_proxy melodymuse:3000
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user