Skip to content

Deploying a Sharkey App

Introduction

Sharkey is an open-source, federated social platform built on Misskey with enhanced moderation features. Deploying Sharkey with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage—all configured from klutch.sh/app. This guide covers installation, Dockerfile setup, environment variables, storage, Nixpacks overrides, and sample checks.


Prerequisites

  • A Klutch.sh account (sign up)
  • A GitHub repository containing your Sharkey Dockerfile (GitHub is the only supported git source)
  • External PostgreSQL and Redis
  • Domain and TLS for secure, federated traffic

For onboarding, see the Quick Start.


Architecture and ports

  • Sharkey serves HTTP on internal port 3000. Choose HTTP traffic in Klutch.sh and set the internal port to 3000.
  • Persistent storage is recommended for media uploads; databases live in Postgres and Redis.

Repository layout

sharkey/
├── Dockerfile # Must be at repo root for auto-detection
└── README.md

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


Installation (local) and starter commands

Build and run locally (ensure Postgres/Redis are reachable):

Terminal window
docker build -t sharkey-local .
docker run -p 3000:3000 \
-e DATABASE_URL=postgres://user:pass@localhost:5432/sharkey \
-e REDIS_URL=redis://localhost:6379/0 \
-e DOMAIN=localhost:3000 \
sharkey-local

Dockerfile for Sharkey (production-ready)

Place this at the repo root; Klutch.sh auto-detects Dockerfiles.

FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:18-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=3000
COPY --from=builder /app/.output ./.output
COPY --from=builder /app/package*.json ./
RUN npm ci --omit=dev
EXPOSE 3000
CMD ["node", ".output/server/index.mjs"]

Notes:

  • Pin Node to the version Sharkey supports; adjust if upstream changes.
  • Keep the Dockerfile at the repo root; Docker selection is automatic in Klutch.sh.

Environment variables (Klutch.sh)

Set these before deploying:

  • PORT=3000
  • DATABASE_URL=postgres://<user>:<password>@<host>:5432/<db>
  • REDIS_URL=redis://<host>:6379/0
  • DOMAIN=example-app.klutch.sh
  • SECRET_KEY=<secure-random-hex>
  • Optional: SMTP settings (SMTP_HOST, SMTP_USER, SMTP_PASS, SMTP_PORT, SMTP_FROM) and object storage settings if offloading media

If deploying without the Dockerfile and relying on Nixpacks:

  • NIXPACKS_NODE_VERSION=18
  • NIXPACKS_START_CMD=node .output/server/index.mjs

Attach persistent volumes

If you store media locally, add storage in Klutch.sh (path and size only):

  • /app/files — media uploads.

Ensure the path matches your Sharkey configuration.


Deploy Sharkey 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 (DB/Redis URLs, domain, secret, and optional SMTP/storage settings).
  5. Attach a volume at /app/files if storing media locally; size it for your content.
  6. Deploy. Your instance will be reachable at https://example-app.klutch.sh; finalize setup in the UI.

Sample checks

Landing page:

Terminal window
curl -I https://example-app.klutch.sh

If a health endpoint exists (replace if different):

Terminal window
curl -I https://example-app.klutch.sh/api/health

Health checks and production tips

  • Add an HTTP readiness probe to / or /api/health.
  • Keep secrets (DB/Redis, SECRET_KEY, SMTP) in Klutch.sh secrets; rotate regularly.
  • Prefer object storage for media at scale; if using local storage, monitor /app/files and resize proactively.
  • Pin image/Node versions and test upgrades in staging before production rollout.

Sharkey on Klutch.sh delivers reproducible Docker builds, managed secrets, and optional media storage—without extra YAML or CI steps. Configure ports, env vars, and storage, then launch your federated social platform.