Skip to content

Commit

Permalink
Make all production nginxes use same start command
Browse files Browse the repository at this point in the history
  • Loading branch information
cdrini committed Jun 30, 2021
1 parent c539d9f commit ed30ab4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
14 changes: 12 additions & 2 deletions docker-compose.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ services:
profiles: ["ol-covers0"]
image: "${OLIMAGE:-openlibrary/olbase:latest}"
user: root
command: nginx -g "daemon off;"
command: docker/ol-nginx-start.sh
environment:
- CRONTAB_FILES=/etc/cron.d/archive-webserver-logs
restart: always
depends_on:
- covers
Expand All @@ -53,6 +55,10 @@ services:
# Needs access to openlibrary for static files
- ../olsystem:/olsystem
- /1/var/lib/openlibrary/sitemaps/sitemaps:/sitemaps
# web log rotation
- ../olsystem/etc/cron.d/archive-webserver-logs:/etc/cron.d/archive-webserver-logs
- ../olsystem/etc/logrotate.d/nginx:/etc/logrotate.d/nginx
- /1/var/log/nginx:/var/log/nginx
ports:
- 80:80
- 443:443
Expand Down Expand Up @@ -121,6 +127,8 @@ services:
image: "${OLIMAGE:-openlibrary/olbase:latest}"
user: root
command: docker/ol-nginx-start.sh
environment:
- CRONTAB_FILES=/etc/cron.d/archive-webserver-logs
volumes:
# nginx configurations
- ./docker/nginx.conf:/etc/nginx/nginx.conf:ro
Expand Down Expand Up @@ -151,7 +159,7 @@ services:
profiles: ["ol-home0"]
image: "${OLIMAGE:-openlibrary/olbase:latest}"
user: root
command: nginx -g "daemon off;"
command: docker/ol-nginx-start.sh
restart: always
depends_on:
- infobase
Expand All @@ -160,6 +168,8 @@ services:
- ./docker/infobase_nginx.conf:/etc/nginx/sites-enabled/infobase_nginx.conf:ro
# Needs olsystem for black-listed IPs
- ../olsystem:/olsystem
# Log rotation
- ../olsystem/etc/logrotate.d/nginx:/etc/logrotate.d/nginx
ports:
- 7000:7000
networks:
Expand Down
6 changes: 4 additions & 2 deletions docker/ol-nginx-start.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash

crontab /etc/cron.d/archive-webserver-logs
service cron start
if [ -n "$CRONTAB_FILES" ] ; then
crontab $CRONTAB_FILES
service cron start
fi

# logrotate comes from olsystem which is volume mounted
# logrotate requires files to be 644
Expand Down

0 comments on commit ed30ab4

Please sign in to comment.