website/content/docs/self-hosting/docker.md

68 lines
1.7 KiB
Markdown
Raw Normal View History

2021-07-21 15:49:53 +05:30
---
2022-08-01 22:26:08 +05:30
title: "Using Docker"
description: "Deploy mCaptcha using docker"
2021-07-21 15:49:53 +05:30
date: 2021-07-21 15:14
lastmod: 2021-07-21 15:14
draft: false
images: []
menu:
docs:
2023-10-27 21:39:40 +05:30
parent: "Self-Hosting"
2023-12-09 03:43:25 +05:30
weight: 534
2021-07-21 15:49:53 +05:30
toc: true
---
2022-08-01 22:26:08 +05:30
## With Docker
2021-07-21 15:49:53 +05:30
### 1. 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.
See
[CONFIGURATION.md](https://github.com/mCaptcha/mCaptcha/tree/master/docs/CONFIGURATION.md)
for configurable options.
### 2. Run image
If you have already have a Postgres instance running, then:
```
2021-07-21 15:49:53 +05:30
docker run -p <host-machine-port>:<port-in-configuration-file> \
--add-host=database:<database-ip-addrss> \
-e RUST_LOG=debug \
-e DATABASE_URL="postgres://<db-user>:<db-password>@database:<db-port>/<db-name>" \
mcaptcha/mcaptcha:latest
```
If you don't have a Postgres instance running, you can either install
one using a package manager or launch one with docker.
2021-07-21 15:49:53 +05:30
## With docker-compose
1. Download docker-compose file and the configuration file:
```
wget https://raw.githubusercontent.com/mCaptcha/mCaptcha/master/.env.docker-compose
wget https://raw.githubusercontent.com/mCaptcha/mCaptcha/master/docker-compose.yml
```
2021-07-21 15:49:53 +05:30
2. Configure deployment using `.env.docker-compose` environment variable
file
2021-07-21 15:49:53 +05:30
3. Launch containers:
2021-07-21 15:49:53 +05:30
```
2021-07-21 15:49:53 +05:30
docker-compose up -d
```
4. Configure SSL using reverse proxy: mCaptcha doesn't support SSL at
the moment, so please use a reverse proxy to secure your instance. A
reference nginx virtual host configuration file is available [here](../bare-metal/#6-install-and-configure-nginx).