Skip to content
Projects

About

AI workspace for teams

AI & Machine Learning

How these counts are measured

What you can do

  • Office work: hand off everyday tasks to AI Build slide decks, write documents, work with spreadsheets, and organize files. Turn scattered materials into a clear, finished deliverable. Example: Use these materials to prepare a briefing in PowerPoint and summarize the key figures from the spreadsheet.
  • Coding: turn requirements into working code Let AI help design the architecture, write code, and fix issues so you can focus on the engineering decisions that matter most. Example: Implement the feature described in this spec, add tests, and fix any issues you find when you run the code.
  • Design: bring your ideas to life Create posters and graphics, design interactions, or produce microdramas. Take your ideas beyond words. Example: Use the event theme to design a poster and a matching page.

Measured star growth

in 24h
+9
in 7 days
+49
in 15 days
+128
in 1 month
+499

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

monkeyai/README.en.md

Original

Self-host MonkeyAI

Use this guide to install MonkeyAI on your own infrastructure, sign in to the admin console, and maintain the instance. The Chinese deployment guide and Compose file provide more detail on the source deployment.

Choose an installation path · Prepare the host · Install · Sign in for the first time · Configure your instance · Back up and restore · Upgrade · Troubleshoot

Choose an installation path

Path Use it when What it does
Published installer You want a packaged deployment on a Linux server. Installs the release's prebuilt images, sets up credentials and data directories, and manages upgrades. An offline package is available for networks without registry access.
Docker Compose from source You want to build or test components at a particular revision, or already have compatible application images. Uses the checkout's Compose configuration. You manage credentials, storage, networking, and upgrades. The public source build alone does not bootstrap an administrator.

Keep the two paths separate. The published package has its own Compose files, image variables, and defaults; do not copy the repository's Compose file over an installed instance.

Prepare the host

  • Host and tools. The published installer supports Linux on AMD64 (x86-64) and ARM64, with root access for installation. Its documented test baselines are Ubuntu 22.04/24.04 and Rocky Linux 9. Plan for Docker Engine and Docker Compose v2.20 or later. Installing Docker through the installer requires a running systemd, iptables/NAT, and cgroups. The installer does not support Podman, Alpine/OpenRC, or 32-bit hosts. CentOS 7 has a legacy path but is no longer maintained; openEuler is not yet verified by the release documentation. A source build requires Docker with Compose and BuildKit, plus a full Git checkout; Go and Node run inside the build images.
  • Capacity. The project overview lists 1 CPU core and 1 GB of RAM for a lightweight instance. Treat that as a starting point, not a build or production capacity guarantee. Allow space for images, temporary files, PostgreSQL, RustFS objects, and backups. Size CPU and RAM for your workload and concurrent connections. Cloud computers require a separate engine host; the base Compose stack does not provision one.
  • Network. Pick the address users will actually open and check for port conflicts. Use a private network for initial setup and trusted HTTPS for production. If using built-in certificate issuance, prepare a public domain and inbound TCP 80 and 443. The online installer and source builds need outbound access to their download and registry endpoints; source builds also need access to package registries. The offline installer bundles Docker/Compose and the service images. It does not make the running service air-gapped: configured integrations can still need network access, and the packaged Pro backend documents outbound aggregate instance reporting.

Use one deployment per Docker host with these defaults: the packaged installation uses fixed container names, and the source configuration also has fixed names for the ingress and task proxy.

Install

Use the published installer

On the Linux host, open Self-host MonkeyAI and run the published installation command in an interactive terminal as root. The bootstrap selects a release from the server release manifest, verifies the package checksum, and starts the installer. To select a specific published version, pass its tag as MONKEYAI_VERSION to the bootstrap. For an offline installation, choose the matching Linux architecture and offline archive from the manifest, verify its SHA-256, transfer and extract it on the target host, then run sudo sh ./install.sh from the extracted directory. The archive's README lists preflight and non-interactive options.

  1. Choose Install (安装). The release installer may display a Chinese terminal menu even when the web UI is in English.
  2. Choose an empty installation directory (default: /data/monkeyai) and enter the service address. New packaged installations use HTTPS on port 443 by default, with HTTP on port 80 redirecting to it. An explicit port in the HTTPS address changes the HTTPS listener's host port. Plan for both port mappings.
  3. Save the administrator email and generated password shown at the end. The default email is [email protected]. The installer generates the PostgreSQL and RustFS credentials and does not retain the bootstrap admin password in .env after a successful new installation.

The default packaged TLS certificate uses a shared key and may not match your hostname or be trusted by browsers. Before sending credentials over an untrusted network or inviting users, configure a trusted certificate using automatic TLS or an external gateway. Do not bypass browser certificate warnings in production.

Build and start from source

Run the commands in this section from monkeyai/ inside a full clone of the MonkeyAI repository. Check out the revision you intend to deploy before building. Use a new PostgreSQL database or an empty data directory for a fresh installation.

First-login limitation: At this revision, the public server entry point uses a no-op member writer. Building the public checkout does not create the first administrator, even if you set the bootstrap variables. A healthy stack is not proof that you can sign in. Use the published installer for a new instance with admin access, or supply a compatible backend image that implements member management.

  1. On first setup only, create .env from the configuration example:

    (umask 077; cp -n .env.example .env)
    chmod 600 .env
    

    Replace the sample values for POSTGRES_PASSWORD, RUSTFS_ACCESS_KEY, and RUSTFS_SECRET_KEY. If using a backend image that supports administrator bootstrap, set MONKEYAI_INITIAL_ADMIN_EMAIL and a unique MONKEYAI_INITIAL_ADMIN_PASSWORD of at least 12 characters for a fresh database. Use a database password made from URL-safe characters with the default connection string: Compose inserts it into the URI as-is. If you supply your own MONKEYAI_DATABASE_URL, apply proper URI encoding to its credentials.

  2. Prepare the bind mounts. RustFS and the application runtime use UID/GID 10001:10001. On Linux, run:

    sudo mkdir -p data/rustfs data/rustfs-logs data/runtime
    sudo chown 10001:10001 data/rustfs data/rustfs-logs data/runtime
    sudo chmod 700 data/runtime
    

    If you are reusing restored data, make sure the existing contents have the correct ownership and permissions too. Preserve data/runtime/identity.json from the original instance.

  3. Validate the configuration and start the stack:

    docker compose config --quiet
    docker compose up -d --build
    docker compose ps -a
    

    For a local instance, open http://localhost:8080. For a remote host, use a private connection and set MONKEYAI_PUBLIC_URL to the real browser-facing address. Do not expose the default HTTP setup to the public internet.

PostgreSQL must be healthy before migrate runs. The backend and proxy services wait for migrations to succeed and for RustFS to be healthy. The backend checks the private resource bucket and creates it if needed, with a one-minute initialization limit. The admin service serves static web files; the nginx service is the public ingress. The page or ingress may respond before the backend is ready. A migration container that exits with code 0 is expected.

Use prebuilt images with the source Compose file. If you distribute your own images instead of building on the host, set ADMIN_IMAGE, BACKEND_IMAGE, MIGRATE_IMAGE, PROXY_IMAGE, and NGINX_IMAGE to the full image references for the same release set. Make them available locally or from a registry the host can access, then run docker compose up -d --no-build. The migration image contains the SQL and must match the backend release. The repository defaults ending in :local are build tags, not published image URLs.

Sign in for the first time

These steps assume either a packaged installation or a Compose deployment with an administrator-capable backend image.

  1. Open the instance's public address and follow the sign-in link, or go directly to /admin. An unauthenticated visit to /admin redirects to /login.
  2. Choose Password sign-in. Use the credentials from the installer result, or the initial email and password you set for the source build. Once signed in, confirm you can open the admin console. The packaged Pro backend lets the first administrator sign in before a license is imported, but requires a valid license to add or re-enable other members. Check the license screen in system settings.
  3. For a source deployment, after confirming access, remove MONKEYAI_INITIAL_ADMIN_EMAIL and MONKEYAI_INITIAL_ADMIN_PASSWORD from .env and recreate the backend with docker compose up -d --no-build --no-deps backend. The bootstrap settings only create an administrator when the user table is empty. They do not reset an existing account.

Configure your instance

Edit .env in the deployment directory. Use docker compose config --quiet before applying changes. Use docker compose up -d to recreate the affected services; restart does not apply new environment values or port mappings. For packaged deployments, use their installed Compose files and avoid replacing their pinned image references with source-build defaults.

Setting Default in source Compose When to change it
MONKEYAI_PUBLIC_URL http://localhost:8080 Set it to the exact external root address, including scheme and any nonstandard port. The web app and API share this origin, which is also used for OAuth, redirects, and resource URLs.
MONKEYAI_ADMIN_PORT / MONKEYAI_HTTPS_PORT 8080 / 8443 on the host Change if ports conflict. The container ports stay 8080 / 8443. The HTTPS port is mapped even when built-in TLS is off. admin and backend do not publish their own ports.
POSTGRES_USER / POSTGRES_DB monkeyai / monkeyai Use MONKEYAI_DATABASE_URL if pointing migrate, backend, and proxy to a different database. Changing POSTGRES_PASSWORD alone does not rotate the password in an initialized database.
MONKEYAI_S3_ENDPOINT / MONKEYAI_S3_BUCKET http://rustfs:9000 / monkeyai-resources Set a different endpoint or bucket when replacing the bundled object storage. The default region is us-east-1 and path-style access is on. The S3 API is internal by default; the source stack publishes the RustFS console only at 127.0.0.1:9001. The reviewed installer package does not publish the console.
MONKEYAI_S3_ACCESS_KEY / MONKEYAI_S3_SECRET_KEY Fall back to the RustFS credentials To use separate app credentials, grant s3:ListBucket and s3:GetBucketLocation on the bucket, plus s3:GetObject, s3:PutObject, and s3:DeleteObject on its objects. Add s3:CreateBucket if the backend must create the bucket.
MONKEYAI_RUNTIME_RELAY true Set to false if you do not need relay access. Leaving it on does not authorize access by itself: device owners must enable remote access locally and approve permissions. File URLs use the public origin unless MONKEYAI_RUNTIME_FILES_ORIGIN is set.
MONKEYAI_LOG_LEVEL / MONKEYAI_LOG_MAX_SIZE / MONKEYAI_LOG_MAX_FILES warn / 20m / 5 Adjust backend verbosity and per-service Docker log rotation for your retention and disk budget.

Publish over HTTPS

If an existing gateway terminates TLS, configure it for the external hostname, preserve the host, and support WebSocket upgrades and streaming. Keep the internal ingress private. Set MONKEYAI_PUBLIC_URL to the public HTTPS address. In MONKEYAI_TRUSTED_PROXY_CIDRS, list only the IP addresses or CIDRs of proxies that connect directly to nginx. Have those proxies append the actual peer address to X-Forwarded-For or replace the header; do not pass arbitrary client-supplied values unchanged. Leave the setting empty when clients connect directly.

For built-in ACME, point the domain's DNS at the host. Public TCP 80 must reach container port 8080 for HTTP-01; TCP 443 must reach 8443 for HTTPS. If you publish an AAAA record, make sure IPv6 can reach the ingress as well. The container must be able to reach the CA over HTTPS. Set these values in .env:

MONKEYAI_AUTO_TLS_ENABLED=true
[email protected]
MONKEYAI_PUBLIC_URL=https://ai.example.com
MONKEYAI_ADMIN_PORT=80
MONKEYAI_HTTPS_PORT=443

Use an HTTPS domain root, not an IP address, localhost, a wildcard, or a URL with a path prefix, query, or fragment. Enabling ACME accepts the selected CA's terms. The default CA is Let's Encrypt; MONKEYAI_AUTO_TLS_CA overrides its directory URL. To apply the configuration to a running instance with the current images already available, run:

docker compose up -d --pull never --no-build --no-deps backend proxy nginx
docker compose logs --tail=100 nginx

This can interrupt active connections. The first certificate is issued in the background; the local /healthz response does not prove that public TLS works. Confirm the HTTPS URL from a separate network without disabling certificate verification. To turn off ACME, set MONKEYAI_AUTO_TLS_ENABLED=false and update the public URL if the external address changes. If packaged local TLS remains enabled, Nginx falls back to the bundled certificate. The acme volume is retained when this setting changes.

Set outbound access and client download links

Set HTTP_PROXY and HTTPS_PROXY for backend OAuth and S3 traffic if needed. Keep internal destinations out of the proxy. Source Compose uses MONKEYAI_NO_PROXY to populate NO_PROXY; preserve db,rustfs,backend,anydoc,localhost,127.0.0.1,::1 when overriding it. The inspected release package uses NO_PROXY plus its own internal exclusions instead. Docker image pulls use the Docker daemon's network settings, not the application's proxy settings.

Model and image upstream requests, MCP tool calls, and MCP OAuth discovery connect directly. MCP OAuth token exchange and refresh can use an HTTP proxy configured via HTTPS_PROXY for HTTPS token endpoints, subject to the existing target checks. SMTP and ingress ACME do not use the backend proxy. Review the backend outbound proxy notes if your environment restricts egress.

To change the download links shown by the server's web app, edit web/public/downloads.json and rebuild the admin image, or mount a copy read-only at /usr/share/nginx/html/downloads.json on admin. Use HTTPS URLs or absolute paths on the same site. Set separate Linux and macOS links for ARM64 and x64. An empty value disables the link for that platform.

Back up and restore

Make a backup before each upgrade and on a regular schedule. Either stop writes during a maintenance window or use a coordinated backup method that keeps PostgreSQL and object storage consistent. Do not copy the live PostgreSQL data directory as an ordinary file backup.

  • Database and objects: Keep a PostgreSQL backup and the corresponding RustFS bucket contents together. On the local stack, the bind mounts are data/postgres and data/rustfs. Back up external services separately if you replaced either one. Preserve objects referenced by any retained database snapshot; do not purge old objects based only on current database references.
  • Instance and configuration: Keep .env, the Compose files and overrides, the image versions, data/runtime (including the signing identity), data/license, and data/tls/server when present. For a packaged installation, also preserve compose.defaults.yml, .monkeyai.json, and any extra persistent data directories used by enabled features, such as data/environment-images. Record the Compose project name.
  • ACME: Back up the named acme volume separately. It is usually named <project>_acme and is mounted at /var/lib/nginx/acme in nginx, outside data/. Protect and encrypt backups containing credentials and private keys.

For a logical database backup with the bundled PostgreSQL service, run this from the deployment directory during the coordinated backup window:

backup_dir=$(mktemp -d ./monkeyai-backup.XXXXXX) &&
  docker compose exec -T db sh -c 'pg_dump -Fc -U "$POSTGRES_USER" "$POSTGRES_DB"' > "$backup_dir/monkeyai-db.dump.partial" &&
  mv "$backup_dir/monkeyai-db.dump.partial" "$backup_dir/monkeyai-db.dump"

The dump is ready only if the command succeeded and produced monkeyai-db.dump in the new backup directory. Test the dump and its matching objects by restoring them in isolation. For recovery, start from the matching service versions and configuration; restore both the objects and database before starting the application stack. Preserve file ownership and the original identity for a recovery of the same instance. Verify sign-in and an existing resource download, including its checksum where available. Keep restored test instances isolated so they do not reuse a production identity on the same network or report as the live instance.

docker compose down stops and removes the containers but leaves bind-mounted data and named volumes in place. Do not use docker compose down -v for routine maintenance: it removes named volumes, including ACME state. In the current source Compose file, data/runtime is a bind mount, not a named volume; protect it independently.

Upgrade

  1. Review the target release and the database migration notes. Plan a maintenance window, allow time for migration, drain active work, and take a coordinated backup. An old database from before the consolidated migration history needs a separate migration plan; do not use migrate force to make it appear compatible.

  2. Packaged installation: Verify and extract the target release package. From its extracted directory, run sudo sh ./install.sh, select Upgrade (升级), and point it at the existing installation directory. For a non-interactive upgrade, use the same directory with the following command (substitute your actual path):

    sudo sh ./install.sh --non-interactive --action upgrade --install-dir /data/monkeyai
    

    Do not use the installer to upgrade a manually managed Compose instance. The installer's configuration backup alone cannot roll back a database migration.

  3. Source Compose: Keep the same project name and data paths. Build or stage matching images first. For a source build, run docker compose build at the target revision before the maintenance window. Stop the old services with docker compose down (no -v), then run docker compose up -d --no-build in the same deployment directory. Update ingress, admin, backend, proxy, and migrate as a set; do not run old and new application processes against an incompatible schema.

  4. Check docker compose ps -a and migration logs. Verify backend readiness, the external URL and certificate, admin sign-in, and an existing resource download before reopening access. If migration fails, keep the old application off until you confirm schema compatibility. Use a tested restore or the release-specific recovery steps, not an image-only rollback after an incompatible migration.

Troubleshoot

Run these commands from the source Compose directory or the packaged installation directory. Use sudo only if your Docker setup requires it.

docker compose ps -a
docker compose logs --tail=100 db migrate rustfs backend proxy nginx admin
docker compose exec -T backend wget -Y off -qO- http://127.0.0.1:8080/readyz
Symptom What to check
Page loads but sign-in or API calls fail Check the backend's readiness probe and the backend and nginx logs. The ingress /healthz checks Nginx only. The backend /readyz checks database and bucket access; use the internal probe above, not the browser-facing path.
Migration does not finish Check migrate logs and database connectivity. Confirm the migration image matches the backend and inspect the migration state before retrying. Do not force a version or clear the database to get past an error.
Backend keeps restarting Check the bootstrap credentials if administrator bootstrap is supported, the bucket credentials and permissions, and ownership of the RustFS and runtime directories. Missing or unreadable persisted signing state is not fixed by discarding the old identity.
Redirects, login loops, or browser TLS errors Check MONKEYAI_PUBLIC_URL against the URL you opened. For ACME, check the nginx logs, A/AAAA records, inbound port 80, CAA policy, outbound CA access, and ACME volume permissions.
Upstream works from the browser but not from the server Check access from the sending container and whether that request type uses a proxy. Confirm private exclusions. When sharing logs, redact credentials and sensitive query parameters: Nginx logs can contain the original request URL.

If you forget the administrator password and the backend container is running, use the reset command. It operates on an existing administrator, prints a new password, and revokes that account's old sessions and OAuth credentials. Keep the terminal output private.

docker compose exec --user 10001:10001 backend /app/monkeyai-server reset

For a packaged instance, use the verified release package's status or doctor action for installer diagnostics; it saves diagnostic files under .monkeyai/diagnostics/. If an upgrade entered database migration, review its logs and migration state before using the package's retry action.

Explore related projects

Loading…