From 18071bc36cad15dc8b9a16fda942b591f44e1a44 Mon Sep 17 00:00:00 2001 From: Markus Hubig Date: Sun, 12 Apr 2020 16:08:11 +0200 Subject: [PATCH 1/6] [GH-21] Adds cron to the image. --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 017fe29..6308e70 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ RUN set -ex \ libxml2-dev \ libpng-dev \ libldap2-dev \ + cron \ --no-install-recommends && rm -r /var/lib/apt/lists/* \ \ && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ From cb6a75fd0deaeca58217400e70b728924b1d1065 Mon Sep 17 00:00:00 2001 From: Markus Hubig Date: Sun, 12 Apr 2020 20:55:22 +0200 Subject: [PATCH 2/6] [GH-21] Adds a crontab file to the image. --- Dockerfile | 1 + crontab | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 crontab diff --git a/Dockerfile b/Dockerfile index 6308e70..b6c5790 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,6 +31,7 @@ RUN set -ex \ \ && a2enmod rewrite +COPY crontab /etc/cron.d/partkeepr COPY info.php /var/www/html/web/info.php COPY php.ini /usr/local/etc/php/php.ini COPY apache.conf /etc/apache2/sites-available/000-default.conf diff --git a/crontab b/crontab new file mode 100644 index 0000000..b9467c0 --- /dev/null +++ b/crontab @@ -0,0 +1,2 @@ +0 0,6,12,18 * * * /usr/local/bin/php /var/www/html/app/console partkeepr:cron:run +# Don't remove the empty line at the end of this file. It is required to run the cron job From e4d6305a6e413a0d3b16176e2107a94eb65dd437 Mon Sep 17 00:00:00 2001 From: Markus Hubig Date: Sun, 12 Apr 2020 23:50:35 +0200 Subject: [PATCH 3/6] [GH-21] Adds a cronjob service and updates the cronjob --- crontab | 2 +- docker-compose.yml | 29 +++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/crontab b/crontab index b9467c0..d2e3a2a 100644 --- a/crontab +++ b/crontab @@ -1,2 +1,2 @@ -0 0,6,12,18 * * * /usr/local/bin/php /var/www/html/app/console partkeepr:cron:run +*/10 * * * * /usr/local/bin/php /var/www/html/app/console partkeepr:cron:run -V 2>&1 > /proc/1/fd/1 # Don't remove the empty line at the end of this file. It is required to run the cron job diff --git a/docker-compose.yml b/docker-compose.yml index 7c3a464..8be3b1a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,16 @@ version: "3" services: + database: + image: mariadb:10.0 + environment: + - MYSQL_RANDOM_ROOT_PASSWORD=yes + - MYSQL_DATABASE=partkeepr + - MYSQL_USER=partkeepr + - MYSQL_PASSWORD=partkeepr + volumes: + - mysql-data:/var/lib/mysql + partkeepr: image: mhubig/partkeepr:latest environment: @@ -51,22 +61,25 @@ services: ports: - "8080:80" volumes: + - partkeepr-conf:/var/www/html/app/config - partkeepr-data:/var/www/html/data - partkeepr-web:/var/www/html/web depends_on: - database - database: - image: mariadb:10.0 - environment: - - MYSQL_RANDOM_ROOT_PASSWORD=yes - - MYSQL_DATABASE=partkeepr - - MYSQL_USER=partkeepr - - MYSQL_PASSWORD=partkeepr + cronjob: + image: mhubig/partkeepr:latest + entrypoint: [] + command: bash -c "crontab /etc/cron.d/partkeepr && cron -f" volumes: - - mysql-data:/var/lib/mysql + - partkeepr-conf:/var/www/html/app/config:ro + - partkeepr-data:/var/www/html/data + - partkeepr-web:/var/www/html/web + depends_on: + - partkeepr volumes: + partkeepr-conf: partkeepr-data: partkeepr-web: mysql-data: From 3a8865b2b00a601441662d9d7eb5c5ccc0efe546 Mon Sep 17 00:00:00 2001 From: Markus Hubig Date: Sun, 12 Apr 2020 23:53:17 +0200 Subject: [PATCH 4/6] [GH-21] Removes test mode --- crontab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crontab b/crontab index d2e3a2a..13fe7f2 100644 --- a/crontab +++ b/crontab @@ -1,2 +1,2 @@ -*/10 * * * * /usr/local/bin/php /var/www/html/app/console partkeepr:cron:run -V 2>&1 > /proc/1/fd/1 +*/10 * * * * /usr/local/bin/php /var/www/html/app/console partkeepr:cron:run 2>&1 > /proc/1/fd/1 # Don't remove the empty line at the end of this file. It is required to run the cron job From 07abe5aa1ef78bd89f6682b2caab7b26ae81f4f4 Mon Sep 17 00:00:00 2001 From: Markus Hubig Date: Sun, 12 Apr 2020 23:53:39 +0200 Subject: [PATCH 5/6] [GH-21] Adds restart policy --- docker-compose.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 8be3b1a..524bacb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,7 @@ services: database: image: mariadb:10.0 + restart: on-failure environment: - MYSQL_RANDOM_ROOT_PASSWORD=yes - MYSQL_DATABASE=partkeepr @@ -13,6 +14,7 @@ services: partkeepr: image: mhubig/partkeepr:latest + restart: on-failure environment: - PARTKEEPR_DATABASE_HOST - PARTKEEPR_DATABASE_NAME @@ -69,6 +71,7 @@ services: cronjob: image: mhubig/partkeepr:latest + restart: on-failure entrypoint: [] command: bash -c "crontab /etc/cron.d/partkeepr && cron -f" volumes: From aaf5ff3b4790bcb1622bfe8647002317296fdb76 Mon Sep 17 00:00:00 2001 From: Markus Hubig Date: Mon, 13 Apr 2020 00:03:28 +0200 Subject: [PATCH 6/6] [GH-21] Scales the db setup image. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 43cf395..cd3d89a 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ docker-compose exec partkeepr cat app/authkey.php The default database parameters are: -![Database Parameters](https://raw.githubusercontent.com/mhubig/docker-partkeepr/master/setupdb.png "Database Parameters") + ## Howto manually build the docker image