README.md 1.78 KB
Newer Older
1
# mattermost-cleaner
Stephane Crozat's avatar
Stephane Crozat committed
2

3
4
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`.
5

6
**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)
Stephane Crozat's avatar
Stephane Crozat committed
7
8
9
10


## Usage:

11
12
```bash
$ docker run -d \
13
14
15
16
17
18
19
20
21
22
    --name mattermost-cleaner \
    --env POSTGRES_HOST=mattermost-db \
    --env POSTGRES_PORT=5432 \
    --env POSTGRES_USER=mattermost \
    --env POSTGRES_PASS=password \
    --env POSTGRES_DB=mattermost \
    --env MATTERMOST_TEAM=team \
    --net docker_default \
    --link mattermost-db:mattermost-db \
    registry.picasoft.net:5000/mattermost-cleaner:alpha
23
```
Stephane Crozat's avatar
Stephane Crozat committed
24
25
## Parameters

26
27
28
29
30
31
32
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
33
34
35

## Docker-compose

36
```yaml
37
38
version: "2"
services:
39
40
41
42
43
44
45
46
47
  mattermost-cleaner:
    image: registry.picasoft.net:5000/mattermost-cleaner:alpha
    container_name: mattermost-cleaner
    links:
      - mattermost-db:mattermost-db
    environment:
      - POSTGRES_HOST=mattermost-db
      - POSTGRES_PORT=5432
      - POSTGRES_USER=mattermost
48
      - POSTGRES_PASS=password
49
      - POSTGRES_DB=mattermost
50
      - MATTERMOST_TEAM=team
51
```