Wiki.js 3 does not upgrade in place from 2.x. It is a new codebase with its own database schema, so the path is a fresh install plus an export package from the old wiki. Most of the move is clean, but pages that lean on 2.x markdown habits come across looking broken until you touch them.
This guide shows how to install Wiki.js 3 with Docker Compose and PostgreSQL behind Nginx with a Let’s Encrypt certificate, then migrate a real 2.x wiki into it and fix what didn’t carry over. Every command below was run on Debian 13 and Ubuntu 26.04 in November 2026, with Wiki.js 3.5.0 on PostgreSQL 18 and the migration coming from a 2.5.317 wiki.
Check the requirements first
Wiki.js 3 needs PostgreSQL 17 or 18 with the ltree and pg_trgm extensions. The official postgres image ships both, and Wiki.js creates them on first start, so you do not install anything into the database by hand. PostgreSQL is the only database the requirements list, so a 2.x wiki on MySQL, MariaDB or SQLite moves across through the export package covered later.
It also needs its own hostname. The requirements page is blunt that a sub-folder install like example.com/wiki is not possible, so plan on a name like wiki.example.com with an A record pointing at the server. Any DNS provider works, as long as port 80 is reachable for the certificate check. Have these ready before the first command:
- A Debian 13 or Ubuntu 26.04 server with sudo access
- A DNS name such as wiki.example.com pointing at it
- Ports 80 and 443 open to the internet
- Admin access to the old 2.x wiki, if you are migrating
One idle Wiki.js 3 stack on the Debian 13 lab VM, which had 2 vCPUs and 4 GB of RAM, used the numbers below. The images are the surprise, so plan disk for them rather than for the wiki content, and remember that every update leaves the previous image behind until you prune it.
| Resource | Measured in the lab | What drives it up |
|---|---|---|
| wiki container RAM | 367 MiB idle | Concurrent editors, search indexing, page renders |
| postgres container RAM | 60 MiB idle | Page count, page history, search queries |
| Docker images on disk | 4.1 GB (wiki 3.46 GB, postgres 676 MB) | Old image layers kept after updates |
| Local volumes (database plus the image’s two) | 71 MB with 3 pages | Uploaded assets, which live in the database by default |
Treat 2 vCPUs, 4 GB of RAM and 20 GB of disk as the floor for a small team wiki. A wiki with thousands of pages, heavy uploads or dozens of people editing at once wants 4 GB or more for the database alone. Size the disk to your asset library too, because Wiki.js 3 stores uploaded files in PostgreSQL rather than on the filesystem.
Set the domain and email
Two values repeat through the rest of the guide: the wiki’s hostname and the contact address for your Let’s Encrypt account. Export them once in the shell you’ll use for the whole install, and use a real mailbox, because the ACME server rejects placeholder domains like example.com.
export DOMAIN="wiki.example.com"
export EMAIL="[email protected]"
Echo them back before going further. A typo here ends up in the Nginx config and the certificate request, which is a slower place to find it.
echo "Domain: ${DOMAIN} Email: ${EMAIL}"
Shell variables only live as long as the session. If you open a new SSH session later, or log out for the Docker group change in the next step, run the two export lines again, because the sed and certbot commands quietly use an empty value otherwise.
Install Docker Engine from Docker’s repository
Use Docker’s own repository rather than the distro’s docker.io package. Debian 13’s docker.io is a much older engine than upstream, and you want the Compose plugin that ships with Docker CE. The commands below read your distro and codename from /etc/os-release, so the same block works on Debian 13 and Ubuntu 26.04.
sudo apt-get update
sudo apt-get install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
. /etc/os-release
sudo curl -fsSL https://download.docker.com/linux/$ID/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
Add the repository as a deb822 .sources file. The printf fills in debian or ubuntu and the codename from the variables you just loaded:
printf 'Types: deb\nURIs: https://download.docker.com/linux/%s\nSuites: %s\nComponents: stable\nSigned-By: /etc/apt/keyrings/docker.asc\n' "$ID" "$VERSION_CODENAME" | sudo tee /etc/apt/sources.list.d/docker.sources
On Debian 13 the file comes out like this. Ubuntu 26.04 shows ubuntu in the URI and resolute as the suite:
Types: deb
URIs: https://download.docker.com/linux/debian
Suites: trixie
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
Install the engine and the Compose plugin, then add yourself to the docker group so the rest of the guide runs without sudo:
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo usermod -aG docker $USER
Log out and back in for the group change to apply, re-export DOMAIN and EMAIL, then confirm both tools answer:
docker --version
docker compose version
Both lab VMs pulled the same engine from Docker’s repository:
Docker version 29.10.0, build fdd4b8e
Docker Compose version v5.8.0
The Docker CE guide for Debian covers rootless mode and log rotation if you want them, and there’s a separate Docker install for Ubuntu 26.04 with the same repository setup.
Write the Compose file and secrets
Keep the stack in /opt/wikijs, owned by your user so you can write the .env file next to it without sudo:
sudo mkdir -p /opt/wikijs
sudo chown $USER: /opt/wikijs
cd /opt/wikijs
Create the Compose file:
sudo vim /opt/wikijs/compose.yaml
Paste the stack below. It differs from the sample in the docs in a few ways. The image tag comes from .env as an exact version instead of :3, and the wiki waits for a healthy database instead of racing it, and port 3000 binds to 127.0.0.1 so nothing reaches Wiki.js except Nginx. Every secret also comes from .env rather than sitting in a file you might paste into a ticket.
services:
db:
image: postgres:18
environment:
POSTGRES_DB: wiki
POSTGRES_USER: wikijs
POSTGRES_PASSWORD: ${DB_PASS}
volumes:
- db-data:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U wikijs -d wiki"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
wiki:
image: ghcr.io/requarks/wiki:${WIKI_VERSION}
depends_on:
db:
condition: service_healthy
environment:
DB_HOST: db
DB_PORT: 5432
DB_USER: wikijs
DB_PASS: ${DB_PASS}
DB_NAME: wiki
ADMIN_EMAIL: ${ADMIN_EMAIL}
ADMIN_PASS: ${ADMIN_PASS}
ports:
- "127.0.0.1:3000:3000"
restart: unless-stopped
volumes:
db-data:
The volume mounts /var/lib/postgresql, not /var/lib/postgresql/data. The PostgreSQL 18 image keeps its data in a versioned subfolder under that path, and the official Wiki.js sample mounts it the same way. The /data mount from older guides doesn’t match the new layout.
Now generate .env. The first line pins the image to 3.5.0, the exact tag this guide was tested with, and the passwords come from openssl rather than from you:
WIKI_VERSION=3.5.0 # pin: tested tag #https://github.com/requarks/wiki/releases/tag/3.5.0
printf "WIKI_VERSION=%s\nDB_PASS=%s\nADMIN_EMAIL=%s\nADMIN_PASS=%s\n" "$WIKI_VERSION" "$(openssl rand -hex 16)" "${EMAIL}" "$(openssl rand -base64 18)" > .env
chmod 600 .env
New 3.x tags arrive often, as the update section below explains, so a newer one may exist by the time you read this. To start on the newest release instead, replace the first line with a lookup of the latest tag:
WIKI_VERSION=$(curl -s https://api.github.com/repos/requarks/wiki/releases/latest | grep tag_name | cut -d '"' -f4)
If that leaves WIKI_VERSION empty, the GitHub API rate-limited you, so type the tag from the releases page. Either way an exact tag lands in .env, which is what the next update replaces, so you always know which version a backup came from. grep WIKI_VERSION .env shows it.
ADMIN_EMAIL and ADMIN_PASS only seed the first administrator account. Once that account exists, changing them does nothing, so store the generated password somewhere safe before you sign in.
Start Wiki.js and confirm it answers
Bring the stack up. The first run pulls about 4 GB of images, which took 1m25s on the Debian 13 VM and 1m22s on Ubuntu 26.04:
docker compose up -d
Give it half a minute, then check that both containers are up and read the startup lines from the wiki log:
docker compose ps --format 'table {{.Service}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}'
docker compose logs wiki --no-color | grep -E "Wiki.js|node.js|PostgreSQL|extensions|administrator|RUNNING"
You want the database marked healthy, port 3000 bound to 127.0.0.1, and the log confirming the PostgreSQL version, the extensions and the administrator account:

The line Created administrator account appears only on the first start. If it’s missing and you see a login failure later, the account came from an earlier run with different values in .env.
Wiki.js answers on /_live once the HTTP server is ready, so test it from the host before adding Nginx:
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:3000/_live
It returned 200 on both distros. Take that as the baseline, because any later failure in the browser then points at Nginx, DNS or the certificate rather than the app. A 000 means nothing is listening yet, so wait for the RUNNING line in the logs.
Put Nginx in front with the WebSocket map
Install Nginx and Certbot with its Nginx plugin. Both come from the distro repositories:
sudo apt-get install -y nginx certbot python3-certbot-nginx
sudo nginx -v
Keep the sudo on the version check. On Debian 13, nginx lives in /usr/sbin, which is not on a normal user’s path, so plain nginx -v answers with command not found even when the package is installed. Ubuntu 26.04 ships a newer nginx than Debian 13, and the table near the end lists both, but the vhost below loads on either without changes.
Open a new virtual host file:
sudo vim /etc/nginx/sites-available/wikijs.conf
Paste the config below as is. SITE_DOMAIN_HERE is a placeholder that the next command swaps for your domain, and Certbot adds the HTTPS server block itself later, so this file only needs port 80:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
listen [::]:80;
server_name SITE_DOMAIN_HERE;
client_max_body_size 10m;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 3600s;
}
}
The map block at the top is the part people drop when they copy only the server block. Wiki.js 3 runs real-time collaboration over WebSockets, and the Connection header has to follow the client’s Upgrade request, which is the WebSocket proxying pattern from the Nginx docs. The Wiki.js installation docs don’t ship an Nginx config at all, so this vhost is ours. Nginx refuses to load a config that names an undefined variable, so a vhost without the map fails before it serves a single page. client_max_body_size 10m matches the wiki’s default upload limit, since Nginx’s own default of 1 MB rejects larger uploads first.
Swap in your domain, enable the site, drop the default site and test the config:
sudo sed -i "s/SITE_DOMAIN_HERE/${DOMAIN}/g" /etc/nginx/sites-available/wikijs.conf
sudo ln -sf /etc/nginx/sites-available/wikijs.conf /etc/nginx/sites-enabled/
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t
The capture below shows the test failing without the map block, then passing with it in place. Check this first if you pasted a vhost from another guide, because the error names a variable rather than the missing block.

With the test passing, reload Nginx so it starts proxying to Wiki.js on port 80:
sudo systemctl reload nginx
The wiki now answers on plain HTTP at your domain. Don’t sign in yet, because the password would cross the network unencrypted until the next step adds TLS.
Get a Let’s Encrypt certificate
With DNS pointing at the server and port 80 open, Certbot’s Nginx plugin requests the certificate over HTTP-01, writes the HTTPS server block into your vhost and adds a redirect from HTTP:
sudo certbot --nginx -d "${DOMAIN}" --non-interactive --agree-tos --redirect -m "${EMAIL}"
A successful run ends by naming the file it changed and the expiry date:
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/wiki.example.com/fullchain.pem
Key is saved at: /etc/letsencrypt/live/wiki.example.com/privkey.pem
This certificate expires on 2027-02-19.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
Deploying certificate
Successfully deployed certificate for wiki.example.com to /etc/nginx/sites-enabled/wikijs.conf
Congratulations! You have successfully enabled HTTPS on https://wiki.example.com
Confirm the wiki answers over HTTPS through Nginx, then dry-run the renewal so you know the timer will work in 90 days:
curl -s -o /dev/null -w '%{http_code}\n' "https://${DOMAIN}/_live"
sudo certbot renew --dry-run
The first should print 200 and the second should end with Congratulations, all simulated renewals succeeded. The Nginx and Let’s Encrypt walkthrough goes further into TLS settings and HSTS if you want to tune the generated block.
Use DNS-01 when port 80 is closed
If the server sits on a private network or port 80 can’t be opened, switch to a DNS-01 challenge. Certbot proves ownership with a TXT record through your DNS provider’s API instead of an HTTP request. Debian 13 packages these provider plugins, each at the same version as Certbot itself:
| DNS provider | Package |
|---|---|
| Cloudflare | python3-certbot-dns-cloudflare |
| Amazon Route 53 | python3-certbot-dns-route53 |
| Google Cloud DNS | python3-certbot-dns-google |
| BIND or any RFC 2136 server | python3-certbot-dns-rfc2136 |
Credentials differ by plugin. Cloudflare and RFC 2136 read an ini file passed with --dns-<provider>-credentials, Route 53 uses standard AWS credentials (environment variables, ~/.aws/credentials or an instance role), and Google uses Application Default Credentials or a JSON key passed with --dns-google-credentials. Call the plugin as the authenticator with the Nginx plugin as the installer (certbot run -a dns-<provider> -i nginx plus any credentials flag, -d and --redirect), so Certbot still writes the 443 server block that this vhost lacks. A bare certonly only fetches the files and leaves the vhost on port 80. The lab used HTTP-01, so we did not run a DNS-01 issuance here. Follow your plugin’s own page for the credential format and the narrowest API token it accepts.
Open the firewall
Ubuntu 26.04 ships UFW but leaves it inactive. Allow SSH before you enable it, or the enable cuts off your own session. The OpenSSH profile only opens port 22, so if sshd listens elsewhere, add sudo ufw allow <port>/tcp for that port first. Then allow the Nginx Full profile, which covers ports 80 and 443:
sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw --force enable
sudo ufw status
Only SSH and the two web ports should be listed:
Status: active
To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
Nginx Full ALLOW Anywhere
OpenSSH (v6) ALLOW Anywhere (v6)
Nginx Full (v6) ALLOW Anywhere (v6)
Port 3000 is not in that list and does not need to be. Docker publishes ports by writing its own iptables rules, which skip UFW entirely, and that’s exactly why the Compose file binds Wiki.js to 127.0.0.1. Check it from the host:
sudo ss -tlnp | grep 3000
The listener should be docker-proxy on loopback only:
LISTEN 0 4096 127.0.0.1:3000 0.0.0.0:* users:(("docker-proxy",pid=2740,fd=8))
The Debian 13 cloud image we used had no UFW and no active firewall rules. Install ufw and apply the same three rules, or rely on your provider’s network firewall as the lab did. The UFW firewall guide covers rate limiting SSH and the logging options.
Sign in and trust the proxy headers
Browse to https://wiki.example.com and sign in with the email you exported and the password from .env. Read it with grep ADMIN_PASS /opt/wikijs/.env, then change it under your profile once you’re in.
By default, Wiki.js ignores the X-Forwarded-* headers Nginx sends. Every request looks like it came from the Docker bridge gateway, so the audit log, rate limiting and any IP-based rule see one address for the whole company. Fix it in the administration area:
- Open Administration and pick Security under System.
- Turn on Trust X-Forwarded-* Proxy Headers.
- Click Apply at the top of the page.

- 1Trust X-Forwarded-*
- 2Apply
It applies straight away, with no container restart. The audit log under Audit Log shows the difference: entries before the change carry 172.18.0.1, the Compose network’s gateway, and the sign-in right after it carries the visitor’s real address:

Only turn this on when Wiki.js sits behind a proxy you control. A client that talks to the app directly can send its own X-Forwarded-For and write any address it likes into your audit log. Because port 3000 is bound to loopback here, nobody can reach the app except through Nginx, and Nginx overwrites the header with the real client address, so trusting it is safe in this setup.
Export the 2.x wiki as a .wkbackup
Skip this and the next two sections if you’re starting fresh. To move an existing wiki, first update the 2.x install to the latest 2.x release, because the export tool for 3.x only exists there. Our source was a 2.5.317 wiki on Debian 12, the setup from our Wiki.js 2.x install guide for Debian. Our test wiki had three pages, two of which use the 2.x habits most likely to break: admonitions, a Mermaid diagram, a tabset and KaTeX math.

In the old wiki, open Administration, then Utilities, and select Export for Wiki.js 3.x. Leave every checkbox ticked and click Create Package at the bottom:

Our three-page wiki packaged in under a second into a 10 KB file. The dialog offers a download and also prints where the file sits inside the container:

Read the red warning on that page before you move the file around. The package holds hashed passwords, 2FA secrets and site configuration keys, unencrypted and unsigned. That’s how imported accounts carry their 2.x password hashes across, but it also means the file deserves the same care as a database dump.
For a large wiki, pulling the file over the browser can time out. Copy it out of the 2.x container instead, from the directory holding the old Compose file. Our 2.x service was named wiki, so change that if yours differs. A 2.x install without Docker writes the package to data/backup/ under the wiki’s install folder.
docker compose cp wiki:/wiki/data/backup/. ~/wkbackup/
ls -lh ~/wkbackup/
Every package you create stays in that folder, named by timestamp, so take the newest one:
-rw-r--r-- 1 josphat josphat 11K Nov 21 08:30 wikijs-20261121T083053449Z.wkbackup
-rw-r--r-- 1 josphat josphat 11K Nov 21 08:34 wikijs-20261121T083425849Z.wkbackup
-rw-r--r-- 1 josphat josphat 11K Nov 21 08:35 wikijs-20261121T083522689Z.wkbackup
Copy that file to the machine you’ll use to open the new wiki in a browser, with scp or whatever you normally use for sensitive files.
Import the package into Wiki.js 3
Sign in to the new wiki as the administrator, open Administration, then Utilities, and click Proceed next to Import from Wiki.js 2.x. The file is read by your browser, so it never has to be uploaded to the server first. The imported content still reaches Wiki.js through Nginx, and our only asset was a few bytes, so we never hit the vhost’s 10 MB request cap. If the old wiki holds larger files, raise client_max_body_size and reload Nginx before you start rather than finding out from a 413 halfway through.
- Click Select archive and pick the
.wkbackupfile. - Leave the content types ticked and Overwrite on conflict off. If the 2.x wiki has pages written in the visual editor, leave Visual Editor Conversion on its default, Convert to markdown; left as HTML, they render but can only be edited as code.
- Click Start Import.

- 1Select archive
- 2Start Import
The import ran in about five seconds and writes a progress log as it goes. These are the lines worth reading:
Package written 2026-11-21T08:35:22.689Z by wiki.js 2.5.317.
The export reported: Page renders are not carried over. Wiki.js 3.x renders pages with its own pipeline, so imported pages are re-rendered in the background.
Groups: 1 imported, 2 skipped.
"[email protected]" is the account running this import and was left exactly as it is, including its password and 2FA.
Users: 1 imported, 2 skipped.
Site settings applied: company, contentLicense, description, features, footerExtra, locales, pageExtensions, robots, theme, title.
Pages: 3 imported, 0 skipped.
Assets: 1 imported, 0 skipped.
The en sidebar already has items and was left alone. Turn on "Overwrite on conflict" to replace it.
Navigation: 0 imported, 1 skipped.
Import finished. 1 settings, 1 folders, 3 pages, 1 users, 1 assets, 1 groups, 1 locales, 0 navigation
3 pages are waiting to be rendered. They will fill in as the renderer works through them.
The skips are deliberate. The two skipped groups and users are the built-in Administrators, Guests, admin and guest accounts that already exist in 3.x, and the admin running the import keeps the password it has now. Only the navigation skip needs action. The docs say the import is safe to repeat, so to get the old sidebar back, run it again with only Navigation ticked and Overwrite on conflict on; we did not run that second pass ourselves. Do that before you edit anything: the docs mark overwrite as destructive, and a rerun with pages ticked replaces every fix you made in 3.x.
After the import we checked the three pages, the user and group lists and the mail settings. This is how each part of the 2.x wiki came through.
| 2.x item | Result in 3.x |
|---|---|
| Pages, folders, tags, assets | Imported |
| Site title and description | Carried over |
| Editor user and the Editors group | Both listed in 3.x (we did not test the editor’s sign-in) |
| Group memberships | Editors showed 0 users and Administrators 2, so check them by hand |
Admonitions such as {.is-danger} | Text imported; we did not check the callout styling |
| Relative links between pages | Link text imported; we did not follow the links |
| Mermaid in a fenced code block | Shown as raw code, no diagram |
{.tabset} headings | Plain headings, no tabs |
Inline $...$ math | Literal text |
Block $$...$$ math | Garbled: t_{restore} came out as t_ |
| Sidebar navigation | Skipped unless Overwrite on conflict is on |
| Mail, security, storage and authentication module settings, logo, hostname | Not imported; set them again |
Users from external login providers such as LDAP or OIDC come across unlinked. They relink by email on their first sign-in, but only after you have set that provider up again in 3.x, because the importer does not apply module settings. Do it before you announce the move, or the first person to try their company login gets an error and assumes their account was lost.
Check group memberships before anyone else signs in. Our 2.x wiki had three users, and after the import the Groups page counted 2 members in Administrators and 0 in Editors. Only the admin and the imported editor could make up those two, so the editor most likely landed with admin rights. Open Administration, then Groups, compare each group’s members with the old wiki, and move anyone who gained access they did not have.
Fix the markdown that 3.x reads differently
The import does not touch page source. Your markdown is stored exactly as it was, and 3.x simply renders some of it differently, so nothing is lost and every fix is an edit you can make at your own pace. Diagrams and math now live in named content blocks, and tabs have their own block syntax. This is the 2.x source of the deploy page:
# Deploy flow
```mermaid
graph LR
A[Commit] --> B[CI build]
B --> C{Tests pass?}
C -->|yes| D[Deploy staging]
C -->|no| E[Fix]
```
# Install the agent {.tabset}
## Debian
```bash
sudo apt install ops-agent
```
## Rocky
```bash
sudo dnf install ops-agent
```
Open the page in the 3.x editor and rewrite it like this. The Mermaid fence goes inside ::block-diagram, and each tab becomes a ::block-tab with a label inside a :::block-tabs container:
# Deploy flow
::block-diagram
```mermaid
graph LR
A[Commit] --> B[CI build]
B --> C{Tests pass?}
C -->|yes| D[Deploy staging]
C -->|no| E[Fix]
```
::
# Install the agent
:::block-tabs
::block-tab{label="Debian"}
```bash
sudo apt install ops-agent
```
::
::block-tab{label="Rocky"}
```bash
sudo dnf install ops-agent
```
::
:::
Math changes the same way. Inline math needs backticks inside the dollar signs, and block math moves into ::block-katex. We also switched the old {.is-danger} admonition to the 3.x callout form while editing the page:
# Database backups
Retention follows $`r = 7d \times 4`$ weeks.
::block-katex
```latex
t_{restore} = \frac{size}{throughput}
```
::
> [!CAUTION]
> Never restore over the primary.
See the [deploy flow](deploy-flow) for the release order.
Saving a page re-renders it. After a bulk change, Rerender All Pages under Administration, then Utilities, does every page at once; it finished our three in 0.8 seconds. The deploy page then showed the diagram and working tabs:

Find the pages to fix before your users do. Wiki.js 3 keeps its tables in a wiki schema, and a search for the old patterns from /opt/wikijs lists the pages to visit:
docker compose exec -T db psql -U wikijs -d wiki -c "SELECT path FROM wiki.pages WHERE content LIKE '%\`\`\`mermaid%' OR content LIKE '%{.tabset}%' OR content LIKE '%\$\$%';"
Treat the result as a checklist rather than a verdict. A converted diagram still contains a Mermaid fence inside its block, so our fixed deploy page kept showing up as ops/deploy-flow after the rewrite.
Relative links behave differently too. According to the upgrade notes, 3.x resolves a relative link against the page’s parent folder, so check any page that links to its neighbours this way; we didn’t click through ours. The upgrade notes list the remaining changes, including draw.io diagrams, which need converting to XML.
Back up and update the stack
Pages, users and uploads all live in PostgreSQL, so a database dump is the core of the backup. The wiki image also creates two anonymous volumes that we did not inspect, so leave them in place rather than pruning them. Run it from /opt/wikijs with a custom-format dump so you can restore single tables later:
docker compose exec -T db pg_dump -U wikijs -d wiki -Fc > ~/wiki-$(date +%F).dump
ls -lh ~/wiki-$(date +%F).dump
The migrated three-page wiki dumped to 260 KB. Copy the dump and /opt/wikijs/.env off the server, because .env holds the pinned Wiki.js version and the database credentials the rebuilt stack expects, and the PostgreSQL guide for Debian covers restoring with pg_restore.
To move to a new release, take a fresh dump first. The upgrade notes are clear that you cannot go back once the schema has been migrated. Then set the new tag in .env, pull and recreate the wiki:
curl -s https://api.github.com/repos/requarks/wiki/releases/latest | grep tag_name
sudo vim /opt/wikijs/.env
docker compose pull wiki
docker compose up -d
Then confirm the service, image tag and health endpoint:
docker compose ps --format 'table {{.Service}}\t{{.Image}}\t{{.Status}}'
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:3000/_live
On the day of testing the latest tag matched what was already running, so the pull was a no-op and the output confirms the stack stayed healthy:
SERVICE IMAGE STATUS
db postgres:18 Up 24 minutes (healthy)
wiki ghcr.io/requarks/wiki:3.5.0 Up 24 minutes
200
Pinning the exact tag in .env is a choice, not a requirement. The 3 tag follows every 3.x release, but then a routine pull becomes an unplanned schema migration, which is the wrong time to find out a backup was skipped. The 3.x line shipped nine releases in its first three weeks, several of them security fixes, so read the release notes before each bump.
Fix common Wiki.js 3 errors
The Nginx, audit log and database errors came up during the lab runs, quoted exactly so you can match them in your own logs. The ACME one is Certbot’s standard refusal of a placeholder contact address; our own certificate runs went through cleanly.
nginx: [emerg] unknown “connection_upgrade” variable
The vhost uses $connection_upgrade without the map block that defines it. It shows up when a WebSocket vhost is pasted without the lines above its server block. Add the four-line map block above the server block and run sudo nginx -t again.
The ACME server believes [email protected] is an invalid email address
Certbot refuses to register an account with an address on a reserved domain. Re-export EMAIL with a mailbox you actually read and rerun the certbot --nginx command. For HTTP-01 failures beyond that, check that the A record resolves to this server and that port 80 isn’t blocked by UFW or a cloud firewall. With DNS-01, a timeout usually means the API token can’t edit the zone.
Audit log shows 172.18.0.1 for every user
Wiki.js is seeing the Docker bridge gateway, not the client, because it doesn’t trust the proxy headers yet. Turn on Trust X-Forwarded-* Proxy Headers under Administration, then Security, and also confirm the vhost still sends X-Forwarded-For, since Certbot’s edit leaves your location block alone.
Database Connection Error: ECONNREFUSED on startup
Our 2.x test stack logged this on its first boot because the wiki started before PostgreSQL accepted connections. It retried and recovered, but a slow disk can burn through all ten attempts. The healthcheck and condition: service_healthy pair in the Compose file above stops the race on 3.x.
Compare Debian 13 and Ubuntu 26.04 for this stack
The Compose stack is identical on both, since everything Wiki.js needs runs in containers. The differences are all on the host side:
| Item | Debian 13 | Ubuntu 26.04 |
|---|---|---|
| Docker CE repository suite | trixie | resolute |
| Docker CE and Compose | 29.10.0 / v5.8.0 | 29.10.0 / v5.8.0 |
Distro docker.io package | 26.1.5 | 29.1.3 |
| nginx from the distro | 1.26.3 | 1.28.3 |
| certbot from the distro | 4.0.0 | 4.0.0 |
| Firewall out of the box | None installed | UFW installed, inactive |
First docker compose up | 1m25s | 1m22s |
Pick whichever your team already patches. If you run Kubernetes instead, the Wiki.js on Kubernetes guide covers that deployment, but for a single wiki a Compose stack on one VM is easier to back up and reason about.
Harden the wiki before the team moves in
The stack above covers the install, but a few settings are still yours to make. None of them come across from 2.x, so work through them before you send the new URL to the team:
- Set up SMTP under Mail for password resets
- Recreate LDAP or OIDC login providers
- Schedule the
pg_dumpfrom cron and copy it off the host - Delete the
.wkbackuponce every page is checked
Mail comes first, because password resets and notifications fail silently without it. The .wkbackup is worth keeping until you’ve checked each page against the conversion table above, but it carries every user’s hashed password, so delete it after that. Wiki.js 3.4.0 also added a management CLI for recovery and maintenance tasks, so read up on it before you need it.
For a team that’s still on 2.x, the move is worth making now. The install is a Compose file and an Nginx vhost, the import carried our users, pages and assets in seconds, and the real work was rewriting the pages that used Mermaid, tabs or math, then fixing group memberships.