docs: deployment and configuration for redis

This commit is contained in:
realaravinth 2021-06-13 13:01:23 +05:30
parent 9636180673
commit 1ddbf196ff
No known key found for this signature in database
GPG Key ID: AD9F0F08E855ED88
3 changed files with 29 additions and 16 deletions

View File

@ -21,37 +21,44 @@ you will be overriding the values set in the configuration files.
| Name | Value | | Name | Value |
| ------------------------------------ | ------------------------------------------------------------- | | ------------------------------------ | ------------------------------------------------------------- |
| `MCAPTCHA_DATEBASE_PASSWORD` | Postgres password | | `MCAPTCHA_DATEBASE_PASSWORD` | Postgres password |
| `MCAPTCHA_DATEBASE_NAME` | Postgres database name | | `MCAPTCHA_DATEBASE_NAME` | Postgres database name |
| `MCAPTCHA_DATEBASE_PORT` | Postgres port | | `MCAPTCHA_DATEBASE_PORT` | Postgres port |
| `MCAPTCHA_DATEBASE_HOSTNAME` | Postgres hostmane | | `MCAPTCHA_DATEBASE_HOSTNAME` | Postgres hostmane |
| `MCAPTCHA_DATEBASE_USERNAME` | Postgres username | | `MCAPTCHA_DATEBASE_USERNAME` | Postgres username |
| `MCAPTCHA_DATEBASE_POOL` | Postgres database connection pool size | | `MCAPTCHA_DATEBASE_POOL` | Postgres database connection pool size |
| `DATABSE_URL` (overrides above vars) | databse URL in `postgres://user:pass@host:port/dbname` format | | `DATABSE_URL` (overrides above vars) | databse URL in `postgres://user:pass@host:port/dbname` format |
#### Redis:
| Name | Value |
| --------------------- | -------------------------- |
| `MCAPTCHA_REDIS_URL` | Redis URL |
| `MCAPTCHA_REDIS_POOL` | Redis connection pool size |
#### Server: #### Server:
| Name | Value | | Name | Value |
| ------------------------------------- | --------------------------------------------------- | | ---------------------------------------- | ------------------------------------------------------ |
| `MCAPTCHA_SERVER_PORT` | The port on which you want mcaptcha to listen to | | `MCAPTCHA_SERVER_PORT` | The port on which you want mcaptcha to listen to |
| `PORT`(overrides `MCAPTCHA_SERVER_PORT`) | The port on which you want mcaptcha to listen to | | `PORT`(overrides `MCAPTCHA_SERVER_PORT`) | The port on which you want mcaptcha to listen to |
| `MCAPTCHA_SERVER_IP` | The IP address on which you want mcaptcha to listen to | | `MCAPTCHA_SERVER_IP` | The IP address on which you want mcaptcha to listen to |
| `MCAPTCHA_SERVER_DOMAIN` | Domain under which mcaptcha will be\* | | `MCAPTCHA_SERVER_DOMAIN` | Domain under which mcaptcha will be\* |
| `MCAPTCHA_SERVER_COOKIE_SECRET` | Cookie secret, must be long and random | | `MCAPTCHA_SERVER_COOKIE_SECRET` | Cookie secret, must be long and random |
| `MCAPTCHA_SERVER_ALLOW_REGISTRATION` | `bool` that controls | | registration | | `MCAPTCHA_SERVER_ALLOW_REGISTRATION` | `bool` that controls | | registration |
\* Authentication doesn't work without `MCAPTCHA_DOMAIN` set to the correct \* Authentication doesn't work without `MCAPTCHA_DOMAIN` set to the correct
domain domain
### Configuration file location: ### Configuration file location:
| Name | Value | | Name | Value |
| -------------- | ------------------- | | ----------------- | ------------------- |
| `MCAPTCHA_CONFIG` | Path to config file | | `MCAPTCHA_CONFIG` | Path to config file |
### Proof of work: ### Proof of work:
| Name | Value | | Name | Value |
| ---------------- | --------------------------------------------------------------------------------------- | | ------------------- | --------------------------------------------------------------------------------------- |
| `MCAPTCHA_POW_SALT` | Salt has to be long and random | | `MCAPTCHA_POW_SALT` | Salt has to be long and random |
| `MCAPTCHA_POW_GC` | Garbage collection duration in seconds, requires tuning but 30 is a good starting point | | `MCAPTCHA_POW_GC` | Garbage collection duration in seconds, requires tuning but 30 is a good starting point |

View File

@ -1,6 +1,6 @@
# Deployment instructions: # Deployment instructions:
See [CONFIGURATION.md](./CONFIGURATION.md) for configuration instructions See [CONFIGURATION.md](./CONFIGURATION.md) for configuration instructions
There are three ways to deploy mCaptcha: There are three ways to deploy mCaptcha:
@ -71,6 +71,11 @@ postgres=# CREATE USER mcaptcha WITH PASSWORD 'my super long password and yes y
$ createdb -O mcaptcha mcaptcha # create db 'mcaptcha' with 'mcaptcha' as owner $ createdb -O mcaptcha mcaptcha # create db 'mcaptcha' with 'mcaptcha' as owner
``` ```
### 4. Install and load [`mCaptcha/cache`](https://github.com/mCaptcha/cache) module:
See [`mCaptcha/cache`](https://github.com/mCaptcha/cache) for more
details.
### 4. Build `mcaptcha`: ### 4. Build `mcaptcha`:
To build `mcaptcha`, you need the following dependencies: To build `mcaptcha`, you need the following dependencies:
@ -140,8 +145,10 @@ WantedBy=multi-user.target
``` ```
2. Enable service: 2. Enable service:
```bash ```bash
$ sudo systemctl daemon-reload && \ $ sudo systemctl daemon-reload && \
sudo systemctl enable mcaptcha && \ # Auto startup during boot sudo systemctl enable mcaptcha && \ # Auto startup during boot
sudo systemctl start mcaptcha sudo systemctl start mcaptcha
`` ``
```

View File

@ -83,7 +83,6 @@ async fn spec() -> HttpResponse {
} }
async fn index() -> HttpResponse { async fn index() -> HttpResponse {
println!("getting index");
handle_embedded_file("index.html") handle_embedded_file("index.html")
} }