mirror of
https://github.com/FoxxMD/context-mod.git
synced 2026-01-10 22:28:02 -05:00
feat: Add full docker-compose support and documentation
* Annotated docker-compose file * simplified CM config.yaml for docker-compose "base" * instructions for usage in installation docs
This commit is contained in:
@@ -44,7 +44,7 @@ Feature highlights for **Developers and Hosting (Operators):**
|
||||
* [Database Persistence](/docs/operator/database.md) using SQLite, MySql, or Postgres
|
||||
* Audit trails for bot activity
|
||||
* Historical statistics
|
||||
* [Docker container support](/docs/operator/installation.md#docker-recommended)
|
||||
* [Docker container](/docs/operator/installation.md#docker-recommended) and [docker-compose](/docs/operator/installation.md#docker-compose) support
|
||||
* Easy, UI-based [OAuth authentication](/docs/operator/addingBot.md) for adding Bots and moderator dashboard
|
||||
* Integration with [InfluxDB](https://www.influxdata.com) for detailed [time-series metrics](/docs/operator/database.md#influx) and a pre-built [Grafana](https://grafana.com) [dashboard](/docs/operator/database.md#grafana)
|
||||
|
||||
|
||||
@@ -2,12 +2,25 @@ version: '3.7'
|
||||
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
image: foxxmd/context-mod:latest
|
||||
# use the settings below, instead of 'image', if running context-mod from the repository (developing local changes)
|
||||
# build:
|
||||
# context: .
|
||||
volumes:
|
||||
- './cmAppData/config:/config'
|
||||
# Location of config file to use with CM
|
||||
# The path BEFORE the colon (:) is the path on the host machine
|
||||
# which defaults to a folder named 'data' in the same directory this file is run in.
|
||||
- './data:/config'
|
||||
# For a new installation you should use the config from the repository included for use with docker-compose
|
||||
# https://github.com/FoxxMD/context-mod/blob/master/docker/config/docker-compose/config.yaml
|
||||
# Copy config.yaml to /(this directory)/data/config.yaml and then modify to match any changed settings below (see comments on config.yaml)
|
||||
ports:
|
||||
- "${CM_WEB-8085}:8085"
|
||||
environment:
|
||||
IS_DOCKER: true
|
||||
# If using a linux host, uncomment these and set them accordingly https://github.com/FoxxMD/context-mod/blob/master/docs/operator/installation.md#linux-host
|
||||
# PUID: 1000
|
||||
# PGID: 1000
|
||||
|
||||
cache:
|
||||
image: 'redis:7-alpine'
|
||||
@@ -17,15 +30,16 @@ services:
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: CHANGE_THIS
|
||||
MYSQL_USER: cmuser
|
||||
# this should match the password set in config.yaml
|
||||
MYSQL_PASSWORD: CHANGE_THIS
|
||||
MYSQL_DATABASE: ContextMod
|
||||
volumes:
|
||||
- './cmAppData/db:/var/lib/mysql'
|
||||
- './data/db:/var/lib/mysql'
|
||||
|
||||
influx:
|
||||
image: 'influxdb:latest'
|
||||
volumes:
|
||||
- './cmAppData/influx:/var/lib/influxdb2'
|
||||
- './data/influx:/var/lib/influxdb2'
|
||||
ports:
|
||||
- "${INFLUX_WEB:-8086}:8086"
|
||||
profiles:
|
||||
@@ -34,7 +48,7 @@ services:
|
||||
grafana:
|
||||
image: 'grafana/grafana'
|
||||
volumes:
|
||||
- './cmAppData/grafana:/var/lib/grafana'
|
||||
- './data/grafana:/var/lib/grafana'
|
||||
ports:
|
||||
- "${GRAFANA_WEB:-3000}:3000"
|
||||
environment:
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
operator:
|
||||
name: #YOUR REDDIT USERNAME HERE
|
||||
botName: ContextModMain
|
||||
logging:
|
||||
# default level for all transports
|
||||
level: debug
|
||||
file:
|
||||
# override default level
|
||||
level: warn
|
||||
# true -> log folder at projectDir/log
|
||||
dirname: true
|
||||
caching:
|
||||
provider:
|
||||
store: redis
|
||||
host: cache
|
||||
port: 6379
|
||||
prefix: prod
|
||||
databaseConfig:
|
||||
migrations:
|
||||
continueOnAutomatedBackup: true
|
||||
#force: true # uncomment this to make cm run new migrations without confirmation
|
||||
#logging: ['query', 'error', 'warn', 'log'] # uncomment this to get typeorm to log EVERYTHING
|
||||
connection:
|
||||
type: 'mariadb'
|
||||
host: 'database'
|
||||
username: 'cmuser'
|
||||
password: 'CHANGE_THIS'
|
||||
database: 'ContextMod'
|
||||
web:
|
||||
credentials:
|
||||
redirectUri: 'http://localhost:8085/callback'
|
||||
session:
|
||||
storage: cache
|
||||
port: 8085
|
||||
@@ -1,6 +1,5 @@
|
||||
operator:
|
||||
name: #YOUR REDDIT USERNAME HERE
|
||||
botName: ContextModMain
|
||||
name: CHANGE_THIS #YOUR REDDIT USERNAME HERE
|
||||
logging:
|
||||
# default level for all transports
|
||||
level: debug
|
||||
@@ -24,6 +23,7 @@ databaseConfig:
|
||||
type: 'mariadb'
|
||||
host: 'database'
|
||||
username: 'cmuser'
|
||||
# This should match the password set in docker-compose.yaml
|
||||
password: 'CHANGE_THIS'
|
||||
database: 'ContextMod'
|
||||
web:
|
||||
@@ -32,9 +32,12 @@ web:
|
||||
session:
|
||||
storage: cache
|
||||
port: 8085
|
||||
influxConfig:
|
||||
credentials:
|
||||
url: 'http://influx:8086'
|
||||
token: 'YourInfluxToken'
|
||||
org: YourInfluxOrg
|
||||
bucket: contextmod
|
||||
#
|
||||
# Influx/Grafana requires additional configuration. See https://github.com/FoxxMD/context-mod/blob/master/docs/operator/database.md#influx
|
||||
#
|
||||
#influxConfig:
|
||||
# credentials:
|
||||
# url: 'http://influx:8086'
|
||||
# token: 'YourInfluxToken'
|
||||
# org: YourInfluxOrg
|
||||
# bucket: contextmod
|
||||
@@ -40,6 +40,32 @@ To get the UID and GID for the current user run these commands from a terminal:
|
||||
docker run -d -v /host/path/folder:/config -p 8085:8085 -e PUID=1000 -e PGID=1000 ghcr.io/foxxmd/context-mod:latest
|
||||
```
|
||||
|
||||
### Docker-Compose
|
||||
|
||||
The included [`docker-compose.yml`](/docker-compose.yml) provides production-ready dependencies for CM to use:
|
||||
|
||||
* [Redis](https://redis.io/) for caching
|
||||
* [MariaDB](https://mariadb.org/) for database
|
||||
* Optionally, [Influx/Grafana](/docs/operator/database.md#influx) instances
|
||||
|
||||
#### Setup
|
||||
|
||||
For new installations copy [`config.yaml`](/docker/config/docker-compose/config.yaml) into a folder named `data` in the same folder `docker-compose.yml` will be run from. For users migrating their existing CM instances to docker-compose, copy your existing `config.yaml` into the same `data` folder.
|
||||
|
||||
Read through the comments in both `docker-compose.yml` and `config.yaml` and makes changes to any relevant settings (passwords, usernames, etc...). Ensure that any settings used in both files (EX mariaDB passwords) match.
|
||||
|
||||
To build and start CM:
|
||||
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
To include Grafana/Influx dependencies run:
|
||||
|
||||
```bash
|
||||
docker-compose --profile full up -d
|
||||
```
|
||||
|
||||
## Locally
|
||||
|
||||
Requirements:
|
||||
|
||||
Reference in New Issue
Block a user