# Créer le daemon pour docker-compose
''docker-compose'' est la commande qui démarre et stoppe les services associés pour le serveur Matrix:
- karthanistyr/matrix-synapse
- karthanistyr/riot.im
- karthanistyr/matrix-postgres
- karthanistyr/coturn
Elle utilise un fichier ''docker-compose.yaml''. Les volumes sont nommés à partir du nom du dossier depuis lequel la commande ''docker-compose'' est lancée, il convient donc de bien choisir ce dossier.
Le modèle de daemon convient à cet usage.
La référence suivante a été suivie pour créer le daemon: [[https://gist.github.com/karthanistyr/051c959724a77fdc5a197a3cf7a542e0|Running docker-compose-matrix as a systemd service (gist.github.com)]]. Tout écart à la référence pour l'adapter à notre cas d'utilisation est mise en évidence ci-après.
root@tempstest:/home/karth# cd docker-prep
root@tempstest:/home/karth/docker-prep# wget https://gist.githubusercontent.com/karthanistyr/051c959724a77fdc5a197a3cf7a542e0/raw/b4afcc7fa341e53dc808fb08d7226456fe109e5f/docker-compose-matrix.service
--2018-04-07 05:04:42-- https://gist.githubusercontent.com/karthanistyr/051c959724a77fdc5a197a3cf7a542e0/raw/b4afcc7fa341e53dc808fb08d7226456fe109e5f/docker-compose-matrix.service
Resolving gist.githubusercontent.com (gist.githubusercontent.com)... 151.101.120.133
Connecting to gist.githubusercontent.com (gist.githubusercontent.com)|151.101.120.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 351 [text/plain]
Saving to: ‘docker-compose-matrix.service’
docker-compose-matrix 100%[========================>] 351 --.-KB/s in 0s
2018-04-07 05:04:42 (2.54 MB/s) - ‘docker-compose-matrix.service’ saved [351/351]
root@tempstest:/home/karth/docker-prep# cp docker-compose-matrix.service /etc/systemd/system/
root@tempstest:/home/karth/docker-prep# mkdir -p /etc/compose/matrix
root@tempstest:/home/karth/docker-prep# cp ../docker-git/matrix-riot-coturn-postgres-docker-compose/docker-compose.yaml /etc/compose/matrix/
root@tempstest:/home/karth/docker-prep# ls -al /etc/compose/matrix/
total 12
drwxr-xr-x 2 root root 4096 Apr 7 05:08 .
drwxr-xr-x 3 root root 4096 Apr 7 05:07 ..
-rw-r--r-- 1 root root 650 Apr 7 05:08 docker-compose.yaml
root@tempstest:/home/karth/docker-prep# systemctl enable docker-compose-matrix
Created symlink /etc/systemd/system/multi-user.target.wants/docker-compose-matrix.service → /etc/systemd/system/docker-compose-matrix.service.
root@tempstest:/home/karth/docker-prep# systemctl start docker-compose-matrix
root@tempstest:/home/karth/docker-prep# systemctl status docker-compose-matrix.service
● docker-compose-matrix.service - Docker Compose container starter
Loaded: loaded (/etc/systemd/system/docker-compose-matrix.service; enabled; vendor p
Active: active (exited) since Sat 2018-04-07 05:13:44 UTC; 8s ago
Process: 16716 ExecStart=/usr/bin/docker-compose up -d (code=exited, status=0/SUCCESS
Main PID: 16716 (code=exited, status=0/SUCCESS)
CPU: 2.844s
Apr 07 05:13:39 tempstest docker-compose[16716]: Creating network "matrix_default" with
Apr 07 05:13:39 tempstest docker-compose[16716]: Creating volume "matrix_riot-data" wit
Apr 07 05:13:39 tempstest docker-compose[16716]: Creating volume "matrix_postgres-data"
Apr 07 05:13:39 tempstest docker-compose[16716]: Creating volume "matrix_synapse-data"
Apr 07 05:13:39 tempstest docker-compose[16716]: Creating volume "matrix_coturn-data" w
Apr 07 05:13:39 tempstest docker-compose[16716]: Creating matrix_postgres_1
Apr 07 05:13:39 tempstest docker-compose[16716]: Creating matrix_riot.im_1
Apr 07 05:13:39 tempstest docker-compose[16716]: Creating matrix_coturn_1
Apr 07 05:13:42 tempstest docker-compose[16716]: Creating matrix_synapse_1
Apr 07 05:13:44 tempstest systemd[1]: Started Docker Compose container starter.
root@tempstest:/home/karth/docker-prep# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
31c155edc191 karthanistyr/matrix-synapse "/bin/sh -c 'exec py…" 2 minutes ago Up 2 minutes 0.0.0.0:8448->8448/tcp matrix_synapse_1
178c366da90c karthanistyr/riot.im "/bin/sh -c 'exec ht…" 2 minutes ago Up 2 minutes 0.0.0.0:8080->8080/tcp matrix_riot.im_1
1d6006e3eb3d karthanistyr/coturn "/bin/sh -c 'turnser…" 2 minutes ago Up 2 minutes 0.0.0.0:3478->3478/tcp matrix_coturn_1
51d767cd2c29 karthanistyr/matrix-postgres "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 5432/tcp matrix_postgres_1