Quick start
Prerequisites
- Docker installed
- (optional) Reverse proxy like Caddy or Nginx
- Domain name
yourdomain.com
(for local-only installs, useprivatecaptcha.local
) - Transactional email provider with SMTP credentials (for production)
- At least 2GB of RAM
1. Clone the self-hosting repo
Self-hosting repository contains a Docker-based quickstart template.
git clone https://github.com/PrivateCaptcha/self-hosting.git private-captcha
cd private-captcha
2. Create .env
file
cp .env.example .env
Some notes on environment variables:
PC_USER_FINGERPRINT_KEY
you can generate usingopenssl rand -hex 64
PC_ADMIN_EMAIL
will be used to create actual admin account (see note for local use below)PC_RATE_LIMIT_HEADER
should be the header containing actual client IP (comes from your CDN or reverse proxy)
You can find full documentation on these and other required environment variables here.
Tips for local use
To run Private Captcha only locally, use privatecaptcha.local:8080
instead of yourdomain.com
. To make it work, you need to add a few lines to /etc/hosts
file:
127.0.0.1 portal.privatecaptcha.local
127.0.0.1 api.privatecaptcha.local
127.0.0.1 cdn.privatecaptcha.local
<button class=“hextra-code-copy-btn hx-group/copybtn hx-transition-all active:hx-opacity-50 hx-bg-primary-700/5 hx-border hx-border-black/5 hx-text-gray-600 hover:hx-text-gray-900 hx-rounded-md hx-p-1.5 dark:hx-bg-primary-300/10 dark:hx-border-white/10 dark:hx-text-gray-400 dark:hover:hx-text-gray-50” title=“Copy code”
<div class="copy-icon group-[.copied]/copybtn:hx-hidden hx-pointer-events-none hx-h-4 hx-w-4"></div>
<div class="success-icon hx-hidden group-[.copied]/copybtn:hx-block hx-pointer-events-none hx-h-4 hx-w-4"></div>
NOTE: email with
.local
domain is not a valid RFC-5322 address, so for 2FA code (required for login) you will need to find “two factor code” from docker logs manually
3. (optional) Expose port
By default Private Captcha is listening on http://localhost:8080
. If you want to use Docker networking for production directly (which is not recommended) instead of reverse proxy like Nginx or Caddy, you can create a compose.override.yml
file like this:
services:
privatecaptcha:
ports:
- 8080:8080
4. Navigate to the Portal
Now you can open $PC_PORTAL_BASE_URL
(e.g. portal.yourdomain.com
or http://portal.privatecaptcha.local
) in browser and log in.
NOTE: For local-only use, when asked for a verification code, you might need to find it in the logs of
privatecaptcha
container. Search for “two factor code”.