Skip to content

Commit

Permalink
Merge pull request #113 from joffilyfe/access-crontab
Browse files Browse the repository at this point in the history
Adiciona crontab ao nível do container, remove bloqueio de urls relacionadas ao cache e atualiza banco de cache durante build
  • Loading branch information
Joffily F authored Jun 13, 2019
2 parents 13fe811 + 067e049 commit 0ee0ef2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -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]
</IfModule>
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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"]
Expand Down
2 changes: 2 additions & 0 deletions docker/application-cron
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions docker/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,7 @@ startretries=10
;autorestart=true
;priority=300

[program:cron]
command = cron -f
autostart=true
autorestart=true

0 comments on commit 0ee0ef2

Please sign in to comment.