Commit e6058b10 authored by Julien Jerphanion's avatar Julien Jerphanion
Browse files

Documenting ; changing shebang

parent 890a2b32
# mattermost-cleaner
This image runs a cron to delete automatic messages from Mattermost teams (alpha version, only run on one team).
Delete command is run once when container starts and then every hour (depending on parameter) via cron.
This image runs a `cron` to delete automatic messages from Mattermost teams (alpha version, only run on one team).
Delete command is run once when container starts and then every hour (depending on parameter) via `cron`.
**Warning** The commande delete directly data from database, which is bad pratice
https://docs.mattermost.com/install/troubleshooting.html#important-notes
https://docs.mattermost.com/deployment/on-boarding.html#do-not-manipulate-the-mattermost-database
**Warning** The commande delete directly data from database, which is bad pratice ; see [here](https://docs.mattermost.com/install/troubleshooting.html#important-notes) and [there](https://docs.mattermost.com/deployment/on-boarding.html#do-not-manipulate-the-mattermost-database)
## Usage:
docker run -d \
```bash
$ docker run -d \
--name mattermost-cleaner \
--env POSTGRES_HOST=mattermost-db \
--env POSTGRES_PORT=5432 \
......@@ -21,18 +20,20 @@ docker run -d \
--net docker_default \
--link mattermost-db:mattermost-db \
registry.picasoft.net:5000/mattermost-cleaner:alpha
```
## Parameters
POSTGRES_HOST the name of the container
POSTGRES_PORT the port number of the postgres database
POSTGRES_USER the username of the postgres database
POSTGRES_PASS the password of the postgres database
POSTGRES_DB the name of the postgres database
CRON_TIME the interval of cron job to run postgresdump. `0 * * * *` by default, which is every hour
Here are the different parameters
- `POSTGRES_HOST` the name of the container
- `POSTGRES_PORT` the port number of the postgres database
- `POSTGRES_USER` the username of the postgres database
- `POSTGRES_PASS` the password of the postgres database
- `POSTGRES_DB` the name of the postgres database
- `CRON_TIME` the interval of cron job to run postgresdump. `0 * * * *` by default, which is every hour
## Docker-compose
```yaml
version: "2"
services:
mattermost-cleaner:
......@@ -47,3 +48,4 @@ services:
- POSTGRES_PASS=password
- POSTGRES_DB=mattermost
- MATTERMOST_TEAM=team
```
#!/bin/bash
#!/usr/bin/env bash
sh psqlcmd.sh
echo "${CRON_TIME} /psqlcmd.sh" > /crontab.conf
crontab /crontab.conf
......
#!/bin/bash
#!/usr/bin/env bash
[ -z "${POSTGRES_HOST}" ] && { echo "=> POSTGRES_HOST cannot be empty" && exit 1; }
[ -z "${POSTGRES_PORT}" ] && { echo "=> POSTGRES_PORT cannot be empty" && exit 1; }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment