Deploy bare metal

Bare metal deployment is tedious, most of this will be automated with a script in the future.

2. Configure

mcaptcha is highly configurable.

Configuration is applied/merged in the following order:

  1. path to configuration file passed in via MCAPTCHA_CONFIG
  2. ./config/default.toml
  3. /etc/mcaptcha/config.toml
  4. environment variables.

1. Install postgres if you don’t have it already.

For Debian based distributions:

sudo apt install postgres

2. Create new user for running mcaptcha

$ sudo useradd -b /srv -m -s /usr/bin/zsh mcaptcha

3. Create new user in Postgres

$ sudo -iu postgres # switch to `postgres` user
$ psql
postgres=#  CREATE USER mcaptcha WITH PASSWORD 'my super long password and yes you need single quote`;
$  createdb -O mcaptcha mcaptcha # create db 'mcaptcha' with 'mcaptcha' as owner

4. Install and load mCaptcha/cache module:

See mCaptcha/cache for more details.

4. Build mcaptcha

To build mcaptcha, you need the following dependencies:

  1. rust
  2. node(v14.16.0)
  3. yarn(JavaScript package manager)
  4. make

How to build

  1. Install Cargo using rustup with:
$ curl --proto '=https' --tlsv1.2 -sSf | sh
  1. Install node(v14.16.0)

  2. Install yarn(JavaScript package manager)

  3. Build with make:

$ make dev-env && \
	make release

5. Install package:

$ sudo cp ./target/release/mcaptcha /usr/bin/ && \
	mkdir sudo /etc/mcaptcha && \
	sudo cp config/default.toml /etc/mcaptcha/config.toml

6. Systemd service configuration:

  1. Copy the following to /etc/systemd/system/mcaptcha.service:
Description=mCaptcha: a CAPTCHA system that gives attackers a run for their money

SuccessExitStatus=3 4
RestartForceExitStatus=3 4


  1. Enable service:
$ sudo systemctl daemon-reload && \
	sudo systemctl enable mcaptcha && \ # Auto startup during boot
	sudo systemctl start mcaptcha

Edit this page on GitHub