From f70ca9ed2bd0d29236557b69a4117fa917bab0ea Mon Sep 17 00:00:00 2001 From: Thord Johansson Date: Tue, 26 Mar 2024 11:51:26 +0100 Subject: [PATCH] Reverted back to using local files for nextcloud and added health check --- thinkcentre/nextcloud/NOTES.md | 3 +++ thinkcentre/nextcloud/docker-compose.yml | 32 +++++++++++------------- thinkcentre/nextcloud/lan-healthcheck.sh | 14 +++++++++++ thinkcentre/redis/docker-compose.yml | 12 +++++++++ 4 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 thinkcentre/nextcloud/NOTES.md create mode 100755 thinkcentre/nextcloud/lan-healthcheck.sh create mode 100644 thinkcentre/redis/docker-compose.yml diff --git a/thinkcentre/nextcloud/NOTES.md b/thinkcentre/nextcloud/NOTES.md new file mode 100644 index 0000000..387c3cd --- /dev/null +++ b/thinkcentre/nextcloud/NOTES.md @@ -0,0 +1,3 @@ +Remember to move the cronjob if moving between servers: + +*/5 * * * * /usr/bin/docker container exec -u www-data nextcloud php -f cron.php --define apc.enable_cli=1 diff --git a/thinkcentre/nextcloud/docker-compose.yml b/thinkcentre/nextcloud/docker-compose.yml index e9d207c..49eb236 100644 --- a/thinkcentre/nextcloud/docker-compose.yml +++ b/thinkcentre/nextcloud/docker-compose.yml @@ -9,33 +9,29 @@ services: - 8080:80 volumes: - app:/var/www/html - - files:/var/www/html/data - - config:/var/www/html/config + - /mnt/data/nextcloud/files:/var/www/html/data + - /mnt/data/nextcloud/config:/var/www/html/config + - /mnt/data/nextcloud/config/nextcloud.log:/var/www/html/data/nextcloud.log environment: - MYSQL_PASSWORD=${MYSQL_PASSWORD} - MYSQL_DATABASE=${MYSQL_DATABASE} - MYSQL_USER=${MYSQL_USER} - MYSQL_HOST=${MYSQL_HOST} - #networks: + healthcheck: + test: ["CMD", "../lan-healthcheck.sh"] + interval: 20s + retries: 5 + timeout: 10s + networks: # - mariadb_default - # - proxy + - proxy -#networks: +networks: #mariadb_default: # external: true - #proxy: - # name: proxy - # external: true + proxy: + name: proxy + external: true volumes: app: - files: - driver_opts: - type: "nfs" - o: "addr=192.168.1.100,nfsvers=4" - device: ":/mnt/data/nextcloud/files" - config: - driver_opts: - type: "nfs" - o: "addr=192.168.1.100,nfsvers=4" - device: ":/mnt/data/nextcloud/config" diff --git a/thinkcentre/nextcloud/lan-healthcheck.sh b/thinkcentre/nextcloud/lan-healthcheck.sh new file mode 100755 index 0000000..bd6350c --- /dev/null +++ b/thinkcentre/nextcloud/lan-healthcheck.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +source .env + +CONTAINER_NAME="mariadb-main" + +# Check if the Docker container is running on the remote host +if ssh "$USER@$MYSQL_HOST" "docker ps -q -f name=$CONTAINER_NAME" >/dev/null 2>&1; then + echo "Docker container $CONTAINER_NAME is running on $MYSQL_HOST" + exit 0 +else + echo "Docker container $CONTAINER_NAME is not running on $MYSQL_HOST" + exit 1 +fi diff --git a/thinkcentre/redis/docker-compose.yml b/thinkcentre/redis/docker-compose.yml new file mode 100644 index 0000000..169dbd4 --- /dev/null +++ b/thinkcentre/redis/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3.3' +services: + redis: + container_name: redis + image: redis:latest + restart: always + networks: + - proxy + +networks: + proxy: + external: true