BUCKYVERSE

Legacy Wiki.js local dev and prod sync (buckyverse.org)

Legacy notes for the old Wiki.js deployment, kept for reference after the wiki migration to llm-wiki/.

Why

Architecture

Production setup (from inspect)

As of the last inspect-prod.sh run:

Item Production
Host r26d@buckyverse.org
Containers wiki (ghcr.io/requarks/wiki:2), db (postgres:11), wiki-update-companion
Compose docker-compose v1.29 (use docker-compose not docker compose on server)
Postgres user wiki (not wikijs)
Postgres volume pgdata
Wiki content volume Anonymous volume e061d18871d73252bbef2d76f92ecd83933c39c7b99aca43a48bfb8431059fec → mounted at /wiki/data/content in container
Ports Wiki.js on 80 (→3000), 443 (→3443)

PROD_COMPOSE_DIR is optional. Pull and push use docker exec by container name (db, wiki), so they work without it. If you set PROD_COMPOSE_DIR, you can use push-to-prod.sh --switch to have the script point Wiki.js at the new DB automatically. (The stack may have been started by root from e.g. /etc/wiki or /root/wiki; r26d often cannot read those paths.)

Prerequisites

One-time setup

  1. Clone/navigate to repo

    cd /path/to/buckyverse.org
    
  2. Configure local env

    cd dev/wikijs
    cp .env.example .env
    

    Edit .env:

    • PROD_SSH (required): r26d@buckyverse.org.
    • PROD_DB_USER: wiki (production Postgres user; local uses wikijs).
    • PROD_SSH_KEY (optional): path to SSH key if not default (e.g. ~/.ssh/id_rsa_r26d_2048).
    • PROD_WIKI_VOLUME (optional): only for --data sync; use volume ID e061d18871d73252bbef2d76f92ecd83933c39c7b99aca43a48bfb8431059fec.
      PROD_COMPOSE_DIR (optional): set if you want push-to-prod.sh --switch to update the prod Wiki.js DB and recreate the container from your machine.
  3. Start local stack

    docker compose up -d
    

    Open http://localhost:3000 and complete the initial Wiki.js wizard once (this will be overwritten when you pull from prod).

  4. Pull production

    chmod +x scripts/pull-from-prod.sh scripts/push-to-prod.sh
    ./scripts/pull-from-prod.sh
    

    This dumps the prod PostgreSQL DB, restores it locally, and restarts the local wiki. Reload http://localhost:3000 — you should see production content.

Daily workflow

  1. Refresh from prod (optional)
    To get latest production state:

    cd dev/wikijs
    ./scripts/pull-from-prod.sh
    
  2. Edit locally
    Use http://localhost:3000. No dependency on production sync speed.

  3. Push to production
    When ready to publish:

    ./scripts/push-to-prod.sh
    

    The script creates a new database on prod (e.g. wiki_20260217_143022), restores your local dump into it, and leaves the current prod DB unchanged. You then point Wiki.js at the new DB; if anything goes wrong, rollback is instant by pointing back. See wikijs-push-rollback.md for switch and rollback steps.

Syncing the wiki data volume (optional)

Wiki.js stores uploads and cache in a data volume. If you need that mirrored:

Use --data only when you need uploads/cache in sync; DB-only is usually enough for content.

Production compose path

If Wiki.js on the droplet is not in /root/wikijs, set in .env:

PROD_COMPOSE_DIR=/opt/wikijs

Scripts run docker compose in that directory on the remote host.

Excluding large tables from pull

The assetData table (Wiki.js asset blobs) can be large and cause the connection to drop during pg_dump. The pull script excludes that table’s data by default (schema is still dumped). Your local wiki will have the table but no asset rows; page content and structure are unchanged. To include it (and risk the same failure), set in .env:

PROD_DUMP_EXCLUDE_TABLE_DATA=

To include assetData in the dump (may fail if the table is large), set PROD_DUMP_EXCLUDE_TABLE_DATA= (empty) in .env. Default is "public"."assetData".

Troubleshooting

Files reference

Path Purpose
dev/wikijs/docker-compose.yml Local Wiki.js + PostgreSQL.
dev/wikijs/.env.example Template for .env (copy to .env).
dev/wikijs/scripts/pull-from-prod.sh Pull DB (and optionally data) from droplet.
dev/wikijs/scripts/push-to-prod.sh Push DB to a new prod DB (and optionally data); see wikijs-push-rollback.md.
dev/wikijs/scripts/dump-for-sync.sh Create a DB dump for syncing to another dev machine; see wikijs-sync-to-other-dev.md.
dev/wikijs/scripts/restore-from-backup.sh Restore local DB from a dump (e.g. after copying from another dev).
dev/wikijs/backups/ DB dumps and optional data tarballs (gitignored).

Security notes