From 688cfa2f591e3f0db7431c5f319add48bcaac771 Mon Sep 17 00:00:00 2001 From: Joffily Ferreira Date: Wed, 12 Jun 2019 14:05:58 -0300 Subject: [PATCH 1/3] =?UTF-8?q?Adiciona=20contrab=20ao=20n=C3=ADvel=20do?= =?UTF-8?q?=20container=20docker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Este commit permite que a limpeza de cache e atualização da base de periódicos sejam realizadas mediante ao contrab configurado durante o build da imagem. Foi utilizado o supervisord para inicializar o daemon do crontab. --- Dockerfile | 8 +++++++- docker/application-cron | 2 ++ docker/supervisord.conf | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 docker/application-cron diff --git a/Dockerfile b/Dockerfile index 0396e9e..db94166 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ FROM ubuntu:18.04 RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get -y install apache2 \ libapache2-mod-php php-gd php-curl php-memcached curl python-setuptools \ - python-pip php-sqlite3 php-xml php-mbstring php-cli && \ + python-pip php-sqlite3 php-xml php-mbstring php-cli cron && \ rm -rf /var/lib/apt/lists/* && \ pip install supervisor @@ -35,6 +35,7 @@ ENV CI_ENV production ADD . /var/www/site/ COPY --from=buildstatic /app/static/ /var/www/site/static/ +COPY docker/application-cron /etc/cron.d/application-cron ADD docker/apache-config.conf /etc/apache2/sites-enabled/000-default.conf ADD docker/foreground.sh /etc/apache2/foreground.sh @@ -44,6 +45,11 @@ RUN chmod -R 0777 /var/www/site/application/cache RUN chmod 755 /etc/apache2/foreground.sh RUN mkdir /var/log/supervisor/ +RUN chmod 0644 /etc/cron.d/application-cron +RUN crontab /etc/cron.d/application-cron + +RUN php /var/www/site/index.php cache_util update_database + WORKDIR /var/www/site EXPOSE 80 CMD ["supervisord" , "-n", "-c", "/etc/supervisord.conf"] diff --git a/docker/application-cron b/docker/application-cron new file mode 100644 index 0000000..875cf7c --- /dev/null +++ b/docker/application-cron @@ -0,0 +1,2 @@ +*/60 * * * * echo Cleaning application cache > /proc/1/fd/1 && php /var/www/site/index.php cache_util clean_cache >&1 +0 3 * * 1,5 echo Updating application database > /proc/1/fd/1 && php /var/www/site/index.php cache_util update_database >&1 diff --git a/docker/supervisord.conf b/docker/supervisord.conf index c92cbe1..6b7dd12 100755 --- a/docker/supervisord.conf +++ b/docker/supervisord.conf @@ -154,3 +154,7 @@ startretries=10 ;autorestart=true ;priority=300 +[program:cron] +command = cron -f +autostart=true +autorestart=true From 5d3ddbffda47863854a97359f1b6a1ab85214ddc Mon Sep 17 00:00:00 2001 From: Joffily Ferreira Date: Wed, 12 Jun 2019 14:09:15 -0300 Subject: [PATCH 2/3] Remove o bloqueio do cache utils a partir do .htaccess --- .htaccess | 1 - 1 file changed, 1 deletion(-) diff --git a/.htaccess b/.htaccess index 6371756..5948ed3 100644 --- a/.htaccess +++ b/.htaccess @@ -3,6 +3,5 @@ RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index\.php|images|css|javascript|rte|robots\.txt) -RewriteCond $1 !cache_util RewriteRule ^(.*)$ index.php?$1 [L,QSA] From 067e04970e7126ea1d5ff121cc5f4d5634a05cb5 Mon Sep 17 00:00:00 2001 From: Joffily Ferreira Date: Wed, 12 Jun 2019 14:10:15 -0300 Subject: [PATCH 3/3] =?UTF-8?q?Ignora=20arquivos=20est=C3=A1ticos=20gerado?= =?UTF-8?q?s=20durante=20o=20desenvolvimento?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index d8d76b7..b180731 100644 --- a/.gitignore +++ b/.gitignore @@ -36,8 +36,10 @@ user_guide_src/cilexer/pycilexer.egg-info/* node_modules/ # CSS Files -static/style.css -static/style.css.map +static/css/style.css +static/css/style.css.map +static/css/journal-print.css +static/css/journal-print.css.map # JavaScript static/js/scielo-min.js