Skip to content

Deploying a Misskey App

Introduction

Misskey is an open-source, federated social platform built on Node.js with a PostgreSQL and Redis backend. Deploying Misskey with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage for media uploads—all managed from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, sample API usage, and production tips.


Prerequisites

  • A Klutch.sh account (sign up)
  • A GitHub repository containing your Misskey source and Dockerfile (GitHub is the only supported git source)
  • PostgreSQL database and Redis instance (deploy as separate Klutch.sh TCP apps on port 8000; connect on 5432 and 6379)
  • Domain and TLS for your Misskey instance

For onboarding, see the Quick Start.


Architecture and ports

  • Misskey serves HTTP on internal port 3000; choose HTTP traffic.
  • PostgreSQL and Redis run externally as TCP apps; connect on 5432 and 6379.
  • Persistent storage is required for media uploads and optional logs.

Repository layout

misskey/
├── Dockerfile # Must be at repo root for auto-detection
├── package.json
├── pnpm-lock.yaml # or yarn.lock / package-lock.json
├── .env.example # Template only; no secrets
├── .config/ # Misskey config if stored locally (keep secrets in env)
└── files/ # Media uploads (persist)

Keep secrets out of Git; store them in Klutch.sh environment variables.


Installation (local) and starter commands

Validate locally before pushing to GitHub:

Terminal window
pnpm install
pnpm build
pnpm start -- --port 3000

Optional helper start.sh:

#!/usr/bin/env bash
set -euo pipefail
exec pnpm start -- --port "${PORT:-3000}"

Make it executable with chmod +x start.sh.


Dockerfile for Misskey (production-ready)

Place this Dockerfile at the repo root; Klutch.sh auto-detects it (no Docker selection in the UI):

FROM node:18-alpine AS build
WORKDIR /app
COPY package.json pnpm-lock.yaml* yarn.lock* package-lock.json* ./
RUN corepack enable
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm build
FROM node:18-alpine
WORKDIR /app
ENV NODE_ENV=production PORT=3000
COPY --from=build /app /app
RUN corepack enable && pnpm install --prod --frozen-lockfile
EXPOSE 3000
CMD ["pnpm", "start", "--", "--port", "3000"]

Notes:

  • Add build tools (apk add --no-cache python3 make g++) if native modules are needed.
  • Ensure files/ (or configured media directory) is writable and mounted as a volume.

Environment variables (Klutch.sh)

Set these in Klutch.sh before deploying:

  • NODE_ENV=production
  • PORT=3000
  • MISSKEY_URL=https://example-app.klutch.sh
  • DB_HOST=<postgres-host>
  • DB_PORT=5432
  • DB_USER=<db-user>
  • DB_PASS=<db-password>
  • DB_NAME=<db-name>
  • REDIS_HOST=<redis-host>
  • REDIS_PORT=6379
  • REDIS_PASSWORD=<redis-password> (if set)
  • FILES_DIR=/app/files
  • Any additional Misskey environment flags (e.g., SMTP, S3 if offloading media)

If you deploy without the Dockerfile and need Nixpacks overrides:

  • NIXPACKS_BUILD_CMD=pnpm install --frozen-lockfile && pnpm build
  • NIXPACKS_START_CMD=pnpm start -- --port 3000
  • NIXPACKS_NODE_VERSION=18

Attach persistent volumes

In Klutch.sh storage settings, add mount paths and sizes (no names required):

  • /app/files — media uploads and attachments.
  • /app/logs — optional if you store logs locally.

Ensure these paths are writable inside the container.


Deploy Misskey on Klutch.sh (Dockerfile workflow)

  1. Push your repository—with the Dockerfile at the root—to GitHub.
  2. Open klutch.sh/app, create a project, and add an app.
  3. Select HTTP traffic and set the internal port to 3000.
  4. Add the environment variables above, including Postgres/Redis credentials, URL, and media path.
  5. Attach persistent volumes for /app/files (and /app/logs if used) sized for your storage and retention needs.
  6. Deploy. Your Misskey instance will be reachable at https://example-app.klutch.sh; attach a custom domain if desired.

Sample API usage

Get instance meta:

Terminal window
curl -X POST "https://example-app.klutch.sh/api/meta" \
-H "Content-Type: application/json" \
-d '{}'

Create a note (replace with user token):

Terminal window
curl -X POST "https://example-app.klutch.sh/api/notes/create" \
-H "Content-Type: application/json" \
-d '{"i":"<user_token>","text":"Hello from Misskey on Klutch.sh!"}'

Health checks and production tips

  • Add an HTTP probe to /api/meta or a lightweight health endpoint.
  • Enforce HTTPS at the edge; forward internally to port 3000.
  • Keep lockfiles pinned and Node version consistent; test upgrades in staging.
  • Monitor database and Redis connections, plus storage usage on /app/files.
  • Store secrets only in Klutch.sh and rotate them regularly.

Misskey on Klutch.sh combines reproducible Docker builds with managed secrets, persistent storage, and flexible HTTP/TCP routing. With the Dockerfile at the repo root, port 3000 configured, and Postgres/Redis connected, you can deliver a federated social platform without extra YAML or workflow overhead.