selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

GitHub
Mechon logo

Self-host Mechon

v1.0.0

Discord bot hosting control panel with per-bot sandboxing

BetaOpen SourceMIT
Updated8 months ago
LanguageRust
Setup difficultyAdvanced
ThemeDark mode
Stars
290
CPU
Linux server (amd64 or arm64) with systemd
Requires
Docker Engine, PostgreSQL
Install with Node.js
Mechon dashboard showing bots by state, memory in use, deploys and node capacityLive console with memory, CPU and disk usage for a botDeploy history with rollback capabilityCreating a new bot from a template, picking size and pasting tokenBot list in light theme showing every bot at a glance

What is Mechon?

Mechon lets you run a Discord bot hosting business on your own servers. Two Go binaries: a panel (API + React UI) on PostgreSQL, and agents that run each customer's bot in a locked-down Docker container with its own Linux user and kernel-enforced memory, CPU, and disk limits. Operators set resource plans; customers deploy from templates (Node.js, Python, Bun) by upload, git, or CI, then get a live console, metrics, and rollback. The panel connects to billing systems like Paymenter, WHMCS, and Stripe through an API and signed webhooks. Agents dial out to the panel, so no inbound ports needed. Currently in preview with isolation testing done but no production use yet.

Should you self-host Mechon?

Mechon scores 45/100 on selfhost.directory (how scoring works) and ranks #10 of 10 in Control Panel. It has 290 GitHub stars.

There was no stable release in the past 12 months, so check the repository's recent activity before you rely on it.

Setup is advanced: plan for several services and some ongoing maintenance. It is MIT-licensed and written mostly in Rust.

Its closest alternative on selfhost.directory is Pelican Panel (64/100, 2 412 stars). It scores higher overall, so compare the two before you pick. See Mechon vs Pelican Panel side by side.

Features

  • API keys for automation
  • Audit Logging
  • Billing system integration
  • Built-in runtime templates
  • Dark/light theme toggle
  • Deploy history with rollback
  • Encrypted bot secrets
  • gVisor hardened runtime optionWired in as a per-plan flag; gVisor not enabled by default in v0
  • Live console and metrics
  • Multiple deployment methods
  • Node capacity monitoring
  • Per-bot sandbox isolation
  • Resource plans and quotas
  • Two-binary architecture
  • Webhook event system

Mechon README

How to install Mechon

Install Mechon with Node.js

Environment variables
MECHON_PANEL_URL, MECHON_NODE_TOKEN, MECHON_VERSION (optional), MECHON_DATA_DIR (optional), MECHON_DNS (optional), MECHON_LOG_LEVEL (optional)
Requirements
  • Linux (amd64 or arm64) with systemd, and root access.
  • Docker Engine, installed and running.
  • losetup, mkfs.ext4, resize2fs and iptables. On Debian or Ubuntu: apt-get install -y util-linux e2fsprogs iptables.
  • Outbound HTTPS to the panel's URL.
Add a node
  1. In the panel, open Nodes, then Add node. Copy the node token; the panel shows it only once.
  2. On the node, run:
curl -fsSL https://raw.githubusercontent.com/jub0t/mechon/main/scripts/install-agent.sh \
 | sudo MECHON_PANEL_URL=https://panel.example.com MECHON_NODE_TOKEN=paste-the-token sh

The script checks the host, downloads the latest release and verifies its checksum, installs /usr/local/bin/mechon-agent, writes /etc/mechon/agent.env (mode 0600) and starts the mechon-agent systemd unit. It does not install Docker for you. To pin a version, add MECHON_VERSION=v0.1.0. The optional settings MECHON_DATA_DIR, MECHON_DNS and MECHON_LOG_LEVEL are passed the same way.

Agent runs as root next to Docker; dials out to panel so no inbound ports needed. Requires Docker Engine and loop device tools.

How to configure Mechon

  • MECHON_DATABASE_URLPostgreSQL connection URL for the panel database

    PostgreSQL connection URL for the panel database

    values: postgres:///mechon?host=/var/run/postgresql or postgres://user:pass@host:5432/db?sslmode=require

  • MECHON_DATA_DIR/var/lib/mechon-panelDirectory for panel artifacts, bot volumes, and other persistent data

    Directory for panel artifacts, bot volumes, and other persistent data

    values: any writable path

  • MECHON_DNSOptional custom DNS servers for bot containers

    Optional custom DNS servers for bot containers

    values: IP addresses

  • MECHON_LISTEN127.0.0.1:8080Address and port the panel HTTP server binds to

    Address and port the panel HTTP server binds to

    values: host:port

  • MECHON_LOG_LEVELAgent log level

    Agent log level

    values: debug, info, warn, error

  • MECHON_NODE_TOKENNode authentication token (shown once in panel when adding a node)

    Node authentication token (shown once in panel when adding a node)

    values: opaque token string

  • MECHON_PANEL_URLPanel URL used by the agent to connect (set during agent install)

    Panel URL used by the agent to connect (set during agent install)

    values: https://panel.example.com

  • MECHON_PUBLIC_URLPublic HTTPS URL of the panel (used for Origin checks and webhooks)

    Public HTTPS URL of the panel (used for Origin checks and webhooks)

    values: https://panel.example.com

  • MECHON_SECRET_KEYSecret key used to encrypt bot secrets (Discord tokens) at rest; generated via `mechon keygen`

    Secret key used to encrypt bot secrets (Discord tokens) at rest; generated via `mechon keygen`

    values: base64-encoded 32-byte key

  • MECHON_TRUST_PROXYfalseTrust X-Forwarded-* headers from a reverse proxy (set to true only when a proxy is in front)

    Trust X-Forwarded-* headers from a reverse proxy (set to true only when a proxy is in front)

    values: true or false

  • MECHON_VERSIONlatestOptional version pin for the agent binary (e.g., v0.1.0)

    Optional version pin for the agent binary (e.g., v0.1.0)

    values: version tag

Mechon releases & version history

More in Control Panel

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…