Commit c8c2937e authored by Michał 'rysiek' Woźniak's avatar Michał 'rysiek' Woźniak
Browse files

more readme

parent 5a422065
FROM debian:jessie
# Watchful NGinX container -- nginx docker container that watches for
# Watchful NginX container -- nginx docker container that watches for
# logrotated logfiles and makes sure nginx reloads them when needed.
#
# Copyright (C) 2015 Organized Crime and Corruption Reporting Project
......@@ -39,7 +39,7 @@ RUN ln -sf /dev/stderr /var/log/nginx/error.log
COPY run.sh /run.sh
RUN chmod +x /run.sh
VOLUME ["/var/cache/nginx"]
VOLUME ["/var/cache/nginx", "/etc/nginx"]
EXPOSE 80 443
#CMD ["nginx", "-g", "daemon off;"]
......
# watchful-nginx
# Watchful NginX
Watchful NginX container -- nginx docker container that watches for logrotated logfiles and makes sure nginx reloads them when needed.
Upon start it creates a dhparam file in `/etc/ssl/nginx/dhparam.pem` (if the file does not exist) and sets an `inotify` watch on `/srv/logs/nginx/logrotate`. Once the watch discovers that the watchfile has been modified, it sends the `USR1` signal to `nginx`, which causes it to reload the logfiles.
Use by volume-mounting the watchfile in this container and in a container that logrotate runs in, and making sure logrotate touches/modifies that file, for instance by using the following in your logrotate config files:
```
postrotate
/bin/date > /srv/logs/nginx/logrotate
```
## ToDo
- watch the logfiles themselves and remove the need for the explicit logrotate flag file
- more configuration options (logfile/watchfile locations, etc)
#!/bin/bash
# Watchful NGinX container -- nginx docker container that watches for
# Watchful NginX container -- nginx docker container that watches for
# logrotated logfiles and makes sure nginx reloads them when needed.
#
# Copyright (C) 2015 Organized Crime and Corruption Reporting Project
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment