Install
Use with AI
For Dokploy, Coolify, Render, DigitalOcean App Platform or an existing reverse proxy, use the deploy paths guide. Managed platforms have additional provisioning steps and no on-demand TLS for brand domains.
How to run Helpdock on your own server with Docker Compose. Developers building the project instead want the development guide.
The stack runs the published image, ghcr.io/docker-hunterpedia/helpdock, with
the Compose file from the same release. Every key .env can hold is in the
configuration reference; keeping the install running
(backups, upgrades, key rotation) is in operations.
What you need
| A Linux server | 2 vCPU and 4 GB of memory is enough to start. ClamAV, if you enable it, wants another 2 GB. |
| Docker Engine with the Compose v2 plugin | docker compose version must print v2; the stack uses service profiles and depends_on health conditions. |
| Two DNS records | See below. |
| Ports 80 and 443 | Open to the internet, so Caddy can get certificates. |
DNS
Point both hostnames at the server’s public address:
| Record | Name | Value |
|---|---|---|
A (and AAAA) |
admin.example.com |
the server’s IP |
A (and AAAA) |
api.example.com |
the server’s IP |
admin.example.com serves the admin app; api.example.com serves the REST API,
the chat widget and its WebSocket endpoint. They can be any two names you
control — they are what you put in ADMIN_HOST and API_HOST below.
Point email parse providers at https://<API_HOST>/internal/inbound-parse/<provider>
(receiving mail). The bundled Caddyfiles allow
that path on the API and admin hosts, while blocking other /internal/* paths.
Brand help-center hosts block all internal paths. Existing 1.0.x installs need
the Caddy routing fix to receive parse webhooks.
A brand’s help center gets its own domain later, in admin, and needs no configuration here: Caddy issues a certificate for it the first time a browser asks, after the api has confirmed the domain was verified (see Custom domains).
Install
Pick a release from the releases page, and check out that release’s Compose file:
git clone --depth 1 --branch v<version> https://github.com/Docker-Hunterpedia/Helpdock.git
cd Helpdock/docker
cp ../.env.example .env
Everything you have to fill in is in .env. Pin the image to the same release,
HELPDOCK_VERSION=<version> (without the v); the template’s latest works
but is not reproducible. Generate the master key next:
openssl rand -base64 32
Then set, at least:
APP_URL=https://admin.example.com
APP_MASTER_KEY=<the key you just generated>
NODE_ENV=production
# Same password in both places: the runtime role is created with
# HELPDOCK_APP_PASSWORD and connected to with DATABASE_URL.
HELPDOCK_APP_PASSWORD=<a long random password>
DATABASE_URL=postgres://helpdock_app:<that same password>@postgres:5432/helpdock
POSTGRES_PASSWORD=<another long random password>
DATABASE_MIGRATION_URL=postgres://helpdock_owner:<that password>@postgres:5432/helpdock
REDIS_URL=redis://redis:6379
ADMIN_HOST=admin.example.com
API_HOST=api.example.com
ACME_EMAIL=you@example.com
HELPDOCK_VERSION=<version>
# Object storage, described below.
S3_ENDPOINT=https://s3.example.com
S3_REGION=us-east-1
S3_BUCKET=helpdock
S3_ACCESS_KEY_ID=<access key>
S3_SECRET_ACCESS_KEY=<secret key>
APP_MASTER_KEY encrypts every secret Helpdock stores. Back it up with the
database. Without it, every stored secret is unrecoverable
(DOMAIN-RULES §10).
The S3_* keys point at object storage for attachments and article images.
Every attachment lives there, and the bucket must be private: Helpdock
serves each object through a presigned URL that lives five minutes and is issued
only after the caller has been authorised on the parent ticket. Give the
credentials read, write and delete on that one bucket and nothing else.
Set S3_FORCE_PATH_STYLE=true for MinIO, Ceph and most other self-hosted
gateways, which address a bucket as a path; Amazon S3 does not want it. For a
local MinIO, docker compose --profile dev up -d minio minio-bucket starts one
and creates the bucket — MinIO has no “create on first write”, so the mc
sidecar is what makes it.
Two optional keys belong to the same pipeline (the attachments guide):
FFMPEG_PATHandFFPROBE_PATHsay where the worker finds ffmpeg, which it spawns to normalise voice notes to Opus and to take a video’s poster frame. The image installs both, so a Compose deployment needs neither key. Without them, images and files still work and audio and video are rejected.CLAMAV_HOSTturns on antivirus scanning of uploaded files. The stack ships a profile for it —docker compose --profile clamav up -d, thenCLAMAV_HOST=clamav— and it wants about 2 GB of memory, which is why it is off by default. A host that is set and unreachable rejects uploads rather than passing them: an install that asked for scanning and quietly got none is worse than one that never asked.
Then:
docker compose up -d
docker compose ps
Compose pulls ghcr.io/docker-hunterpedia/helpdock:<version> for the api and
worker services, and the Postgres, Redis and Caddy images beside it.
The api runs the migrations at boot, provisions the runtime database role, refuses to serve if that role could bypass row-level security, and starts listening. The worker waits for it and then starts the outbox relay.
First run
Open https://admin.example.com. An install with no accounts in it has exactly
one screen — the setup wizard — and every other path goes there.
Finish the wizard before anyone else can reach the host, or set a setup key. Until the wizard is finished there is nobody to check a visitor against, so whoever completes the first step becomes the install administrator. That is true of every self-hosted first-run wizard. The api counts setup attempts per source address, and refuses a setup request a browser made from another site, which together slow a stranger down but do not stop one.
The setup key
If the host is reachable from anywhere before you finish the wizard — the DNS
records are public, the firewall is open — set HD_SETUP_TOKEN in .env
before the first docker compose up -d. It is optional, and recommended for
any such host:
openssl rand -base64 32
Paste the output as HD_SETUP_TOKEN=… (at least 32 characters; the api refuses
to start with a shorter one). Step 1 of the wizard then shows a Setup key
field, and the admin account is created only when it matches, so only someone
who can read the server’s .env can claim the install. A wrong or missing key
is refused, creates nothing, and counts against the same per-address limit as
every other setup attempt.
The key is compared in constant time, never logged, never sent to the browser
(the page is told only that a key is required), and it stops mattering once
the administrator exists: every setup request is refused from then on,
whatever it carries. You can remove it from .env after setup.
Without it, the wizard asks for nothing more — so either set it, or keep the host closed (the firewall shut, or the wizard opened through an SSH tunnel) until step 1 is done.
Four steps, none of which can be got wrong permanently except one:
| Step | What it asks for |
|---|---|
| 1 Admin account | The setup key, when HD_SETUP_TOKEN is set. Your name, email, a password of at least twelve characters, and your language. This account is the install administrator: the only one that reaches every brand and every setting. The language you pick here is the one the rest of the wizard, and your admin, are shown in — pick العربية and the whole thing turns around. |
| 2 First brand | The brand’s name, a ticket prefix, its default language, its timezone, and optionally the hostname its help center will answer on. The brand is created with one department, General; rename it or add more in admin. |
| 3 Outgoing email | Your SMTP server, port, encryption, credentials and the address mail comes from. Send a test email delivers one to the address from step 1 and shows you what the server said. This is the install’s system sender: sign-in links, password resets, staff invitations and staff notifications all go from it, sent by the worker. You may skip this, but until it is set none of those are delivered, and the sign-in screens say so instead of claiming a link was sent (authentication › Sending). You can set it later — and change or test it any time — in Settings › Install › System › Outgoing email; the System page warns while it is missing. |
| 4 Done | What was created, and the way in. |
The ticket prefix cannot be changed. It is printed in every ticket number,
every subject line and every email reference for the life of the brand, so
ACME-1042 is ACME-1042 forever. Two to six characters, A-Z and 0-9. The
field previews a ticket number as you type.
The help center domain is stored unverified. Nothing happens to it until you publish the DNS records Brand › Domains shows for it and the check sees them (see Custom domains); Caddy issues no certificate for an unverified hostname.
Step 2 is where you are signed in, because that is the first moment there is a
brand for a session to land in. If the install requires two-factor
authentication (HD_AUTH_REQUIRE2FA=true, or the auth.require2fa setting),
step 4 says so and sends you to enrol an authenticator before anything else.
Either way the install administrator must have one
(authentication), so the next
sign-in asks you to enrol an authenticator if you have not.
Testing outgoing email
The test sends one real message through the server you typed, with a ten-second deadline, and reports one of:
| What you see | What it usually means |
|---|---|
The server’s reply, such as 250 2.0.0 Ok |
It worked. Check the inbox. |
| The server refused those credentials | Wrong username or password, or the relay wants an app password rather than your account password. |
| Could not reach that server | Wrong hostname or port, or a firewall between this machine and the relay. |
| The encrypted connection failed | The port and the encryption setting disagree — 587 is STARTTLS, 465 is TLS — or the relay’s certificate cannot be verified. |
| The server did not answer within ten seconds | Usually a port that is filtered rather than closed. |
| The server refused the message | The From address is not one this relay will send as. |
The password is encrypted with APP_MASTER_KEY before it is stored and is never
shown again, in admin or anywhere else.
If you set any HD_SMTP_* variable in .env, that key wins over whatever the
wizard saves (ARCHITECTURE §4),
and the wizard leaves it alone rather than storing a value nothing reads. The
System page draws such a field locked — Set by environment — and refuses a
save that would change it.
Once it is finished
Finishing generates the install’s web push key pair, unless .env pins one
with HD_PUSH_VAPID_* (notifications). Keep it:
a new pair signs every agent’s browser out of push.
The wizard is closed for good. /setup is no longer a route, and every setup
endpoint answers 409 Conflict — including to whoever finds the URL later.
There is no way to reopen it: the install is “set up” exactly while the users
table has a row in it, and the only way back is to restore a database that had
none.
The setup checklist
After the wizard, every Admin of a brand sees Get set up at the foot of the sidebar (not on the collapsed rail), with a progress bar and “3 of 9”. It opens a panel of nine steps, each with a line on why and a Go link to the page where it is done:
- Connect a channel: a mailbox, a Telegram bot, a Meta account or a widget origin.
- Invite a teammate: a second person holds a role in the brand (a pending invitation counts).
- Set business hours.
- Create an SLA policy.
- Set up assignment: at least one department is not on Manual.
- Add a saved reply or macro.
- Publish a help center article: one language published and public.
- Connect an AI provider (optional): a provider and a model for the brand, or the install’s default.
- Receive your first ticket: a ticket that arrived through a channel. Tickets typed in by an agent and imported tickets do not count.
Nothing is ticked by hand. The steps are read from the brand’s own data each time the panel is opened, so a step ticks when the work exists and un-ticks if it is deleted. Only Admins see the checklist (Team Leaders, Agents and Viewers never do), and each brand has its own.
Hide this checklist hides it for you in that brand and nobody else. When the eight required steps are done, the AI provider being optional, it goes for everyone; a panel that is open at that moment says “Helpdock is set up” and is gone once closed. A person whose role is removed and given again sees the checklist again.
The api is GET /api/brands/:brandId/setup-checklist and
POST /api/brands/:brandId/setup-checklist/dismiss, both for brand:manage.
They are routes of the admin app and are not part of the public /api/v1
OpenAPI document.
Custom domains
A brand’s help center runs on the brand’s own hostname, such as
support.acme.com, and Caddy gets a certificate for it without you editing
anything. An Admin of the brand sets it up in Brand › Domains.
-
Add the domain. Type the host name only, without
https://or a path. A name in another script is stored as the punycode DNS uses. Refused: IP addresses, single labels, names that can never be public (.local,.internal,.testand the like), the install’s own hosts, and a name another brand already has. A brand may have up to ten. -
Create the two records the tab shows, at your DNS provider:
Type Name Value CNAMEsupport.acme.comthe CNAME target: HELPCENTER_CNAME_TARGET, or the host ofAPP_URLTXT_helpdock.support.acme.comhelpdock-verify=followed by a token only this domain hasThe TXT record proves you control the zone. The CNAME sends visitors to this server. An apex domain (
acme.com) cannot have a CNAME: give itA/AAAArecords with the same addresses as the CNAME target instead, which the check accepts. -
Helpdock checks. The worker looks up both records every fifteen minutes for the first two days, then every six hours; Check now looks at once. The tab shows which record it has seen. When it has seen both, the domain is verified, the brand’s first verified domain becomes its primary one (the host in the help center’s links, sitemap and canonical tags; Make primary moves it), and the change is written to the audit log.
-
The certificate. Right after verifying, the worker makes one TLS handshake to the name. That handshake makes Caddy ask the api
GET /internal/domain-check?domain=…, which answers 200 for a verified help center domain, and Caddy obtains the certificate. The tab then says “certificate issued”; if the handshake does not end with a valid certificate, it says “Certificate failed” and why.
A verified domain is checked again every day (every hour until its certificate is confirmed). If its TXT record disappears, it is un-verified: the help center stops answering on it and Caddy stops issuing for it, and the tab says “Verification lost”. A DNS lookup that times out or fails never un-verifies a domain; only an answer that the record does not exist does. Removing a domain in the tab stops routing at once (within 30 seconds on every api replica).
An unverified hostname gets a 403 and no certificate, which is what keeps a
stranger pointing DNS at your server from spending your certificate authority’s
rate limits. The bundled Caddy answers 404 for /internal/* except
/internal/inbound-parse/* on the API and admin hosts. Brand help-center hosts
block every internal path, and the domain check travels over the Compose network.
| The tab says | What it means |
|---|---|
| Waiting for DNS | A record is missing or not visible yet. DNS changes can take up to 48 hours. |
| CNAME points elsewhere | The name has a CNAME, but not to the target shown. Change it. |
| Certificate failed, “resolves to Cloudflare” | The name is proxied by Cloudflare (orange cloud) but the domain is not flagged. See Behind Cloudflare. |
| Certificate failed, with a TLS error | DNS is verified but HTTPS did not work. Ports 80 and 443 must reach Caddy, and nothing else may answer for the name. |
| Verification lost | The TXT record is gone. Publish it again and press Check now. |
HELPCENTER_CNAME_TARGET in .env changes the CNAME target shown to every
brand; set it before brands publish their records, because changing it later
breaks the CNAMEs already created. The worker’s lookups use the system
resolver with a five-second deadline, and the handshake goes through the same
outbound safety rules as every other connection to a user-supplied host
(DOMAIN-RULES §13): a
name that resolves to a private address is not probed unless
OUTBOUND_ALLOW_CIDRS allows it.
Behind Cloudflare
There are two cases.
Some brand domains are proxied by Cloudflare, the install is not. Tick
Proxied by Cloudflare on the domain in Brand › Domains. Cloudflare flattens a
proxied CNAME, so the check accepts a name that resolves to Cloudflare’s edge in
place of the CNAME; the TXT record is still required. A flagged domain gets no
certificate from this server (/internal/domain-check answers 403 and says it
is proxied), and Cloudflare serves HTTPS. Set Cloudflare’s SSL mode for the
zone to Full (strict) and give Caddy a certificate for the name that
Cloudflare trusts, such as a Cloudflare Origin CA certificate mounted into the
caddy container, in a site block of its own in the Caddyfile:
support.acme.com {
tls /etc/caddy/certs/acme-origin.pem /etc/caddy/certs/acme-origin.key
import helpdock_upstream
}
Every hostname is proxied by Cloudflare, the install’s own included.
Cloudflare terminates TLS and Caddy must not try to issue certificates on
demand. Switch the Caddy configuration in .env:
CADDYFILE=./caddy/Caddyfile.cloudflare
then docker compose up -d caddy. That configuration serves ADMIN_HOST and
API_HOST and has no catch-all site; each verified brand domain is added to it
by hand, as the comment in the file shows. Flag those domains as proxied in
Brand › Domains too. Set Cloudflare’s SSL mode to Full (strict) with an
origin certificate, or the hop between Cloudflare and your server is
unauthenticated.
Visitor addresses. Every connection Caddy sees comes from a Cloudflare edge
address. Left alone, the api would take that for the visitor and share each
per-address limit (sign-in, the widget, the web form, the rating page) between
everyone behind the same edge, so one visitor could lock the others out, and
the audit log would record Cloudflare’s addresses. The
Cloudflare Caddyfile therefore lists Cloudflare’s published ranges in
trusted_proxies and forwards the CF-Connecting-IP header as
X-Forwarded-For, but only for a connection that comes from one of those
ranges. A request that reaches your server around Cloudflare is seen as itself,
whatever headers it carries. Compare the ranges in the file with
https://www.cloudflare.com/ips/ now and then, and run
docker compose restart caddy after editing. A range that is missing fails
safe: visitors arriving through that edge are seen as the edge.
To check it, sign in and open the audit log: the address on your own entry should be yours, not Cloudflare’s.
Behind a proxy of your own
The Compose file sets TRUST_PROXY: uniquelocal on the api, so it believes the
X-Forwarded-For that Caddy sends and nothing a client wrote into the header:
Caddy replaces what a client sends with the address the connection came from.
uniquelocal is the private address ranges Docker’s networks are carved from.
The api’s port is not published, so only Caddy reaches it.
If another proxy or load balancer sits in front of Caddy and is not Cloudflare, two things have to change, or every visitor is seen as that proxy:
- In the Caddyfile’s global block, add
servers { trusted_proxies static <the proxy's address or CIDR> }, so Caddy believes theX-Forwarded-Forit sends and appends to it. - In
docker-compose.yml, extendTRUST_PROXYwith the proxy’s address, for exampleuniquelocal,203.0.113.0/24, so the api believes that hop too.
TRUST_PROXY=true believes every hop, which lets a client choose its own
address by sending its own X-Forwarded-For; do not use it behind a proxy that
appends to the header. Configuration lists the
forms the setting takes.
Upgrading
Take a dump, check out the new release’s Compose file, set HELPDOCK_VERSION
to it, then docker compose pull and docker compose up -d; the api migrates
at boot. The steps, and what to do when a migration fails, are in
operations › Upgrading.
Backups
Postgres (pg_dump -Fc), the object storage bucket, and .env with its
APP_MASTER_KEY: without that key every stored secret and every password is
lost. Redis is not backed up. The commands, the restore, and the rehearsal are
in operations › Backups and the
restore drill.
Troubleshooting
docker compose ps # who is up, and who is healthy
docker compose logs -f api # JSON lines, one per request, with a request id
docker compose logs -f worker
docker compose exec api node -e "fetch('http://127.0.0.1:3000/ready').then(r=>r.text()).then(console.log)"
/readyanswers 503. The body names the dependency that is down —database,redisorsettings./healthstays 200 while the process is alive, so a 503 here is a dependency and not a crash.- The api exits at boot with a list of keys.
.envis incomplete or wrong; the message names every key and what it expects, and never the value. The database role … must not serve traffic.DATABASE_URLnames the migration owner instead ofhelpdock_app. The two roles are separate on purpose (DOMAIN-RULES §1.5).- The api cannot authenticate to Postgres.
HELPDOCK_APP_PASSWORDand the password insideDATABASE_URLhave drifted apart. The role is created once, on the first boot, and is left alone afterwards; change the password withALTER ROLE helpdock_app PASSWORD …and update both. - No certificate for a brand domain. Brand › Domains says why first. Then
ask the api directly:
docker compose exec caddy wget -qSO- 'http://api:3000/internal/domain-check?domain=help.brand.example'. A 403 means the domain is not verified, or is flagged as proxied by Cloudflare (the message says which); a 200 means Caddy should be able to issue, so look atdocker compose logs caddyfor the issuance attempt, anddocker compose logs worker | grep 'domain checked'for what the check saw. - Two api containers. That is the default (
deploy.replicas: 2). They serialise on the migration advisory lock at boot. Rundocker compose up -d --scale api=1for one. - The wizard says the install has already been set up. Somebody finished it, or a tab was left open for more than thirty minutes and its setup token expired. If the account is yours, sign in; if it is not, the install was claimed and the only honest recovery is to restore or recreate the database.
- The wizard says the setup key is not right. Compare what you typed with
HD_SETUP_TOKENin the.envthe api container was started with; a change to.envneedsdocker compose up -dto reach the container. Too many wrong attempts from one address are refused for fifteen minutes. - The browser shows the sign-in screen on a brand-new install. The api could
not read the database when it served the page, so it reported the install as
configured rather than offering it to a stranger.
docker compose logs apisays what was wrong; the wizard appears on the next reload once it is fixed.
Sign-in limits behind a reverse proxy
Configure TRUST_PROXY with the CIDRs of your trusted reverse proxies (Fastify trustProxy), and restrict direct API access to those proxies. With TRUST_PROXY=false, all users behind a proxy share its IP budget of 100 failed sign-ins per 15 minutes. The API logs one warning per process if it receives X-Forwarded-For while proxy trust is off; the header value is never logged. Do not enable trust for arbitrary internet clients.