Skip to content
This repository was archived by the owner on Jun 9, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ ENV php_version=${php_version} \
DOCUMENT_ROOT=/var/www/html \
APACHE_EXTRA_CONF="" \
APACHE_EXTRA_CONF_DIR="" \
SYSLOG_SERVER_IP=localhost \
SYSLOG_SERVER_PORT=514 \
composer_version=${composer_version}

# Add our setup scripts and run the base one
Expand All @@ -43,6 +45,8 @@ ADD apache2_conf /etc/apache2
ADD php_conf /etc/php/${php_version}/mods-available
ADD phpfpm_conf /etc/php/${php_version}/fpm/pool.d
ADD supervisor_conf/supervisord.conf /etc/supervisor/
ADD supervisor_conf/syslog.conf /etc/supervisor/conf.d/
ADD rsyslog_conf/rsyslog.conf /etc/rsyslog.conf
COPY --from=supervisord /go/bin/supervisord /usr/bin/

# Enable our specific configuration
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ docker run -v $(pwd)/html:/var/www/html -e PHP_MEMORY_LIMIT=2G fpfis/httpd-php:5

## Runtime docker configuration

| env | Description | Default |
|----------------------------|------------------------------------|-------------------|
|`APACHE_ACCESS_LOG` | Location of apache's access log | `/proc/self/fd/1` |
|`APACHE_ERROR_LOG` | Location of apache's error log | `/proc/self/fd/2` |
|`DAEMON_GROUP` | Group name to run the daemons with | `www-data` |
|`DAEMON_USER` | Username to run the daemons with | `www-data` |
|`DOCUMENT_ROOT` | Document root | `/var/www/html` |
| env | Description | Default
|----------------------------|------------------------------------|-----------
|`APACHE_ACCESS_LOG` | Location of apache's access log | `/proc/self/fd/1`
|`APACHE_ERROR_LOG` | Location of apache's error log | `/proc/self/fd/2`
|`DAEMON_GROUP` | Group name to run the daemons with | `www-data`
|`DAEMON_USER` | Username to run the daemons with | `www-data`
|`DOCUMENT_ROOT` | Document root | `/var/www/html`
|`SITE_PATH` | Site URL location (non-dev) | `/`
|`FPM_MAX_CHILDREN` | Max number of PHP processes | `5` |
|`FPM_MIN_CHILDREN` | Min number of PHP processes | `2` |
|`HTTP_PORT` | Port to listen on | `8080` |
|`PHP_MAX_EXECUTION_TIME` | PHP max execution time | `30` |
|`PHP_MAX_INPUT_TIME` | PHP max input time | `30` |
|`PHP_MEMORY_LIMIT` | PHP memory limit | `512M` |
|`FPM_MAX_CHILDREN` | Max number of PHP processes | `5`
|`FPM_MIN_CHILDREN` | Min number of PHP processes | `2`
|`HTTP_PORT` | Port to listen on | `8080`
|`PHP_MAX_EXECUTION_TIME` | PHP max execution time | `30`
|`PHP_MAX_INPUT_TIME` | PHP max input time | `30`
|`PHP_MEMORY_LIMIT` | PHP memory limit | `512M`
|`SMTP_SERVER` | SMTP server to use | empty
|`SMTP_PORT ` | SMTP port to use | `25`
|`SMTP_FROM` | SMTP From to use | empty
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ services:
environment:
- SMTP_SERVER=mailhog
- SMTP_PORT=1025
- SYSLOG_SERVER_IP=web
- SYSLOG_SERVER_PORT=514
ports:
- 8080:8080
volumes:
Expand Down
103 changes: 103 additions & 0 deletions rsyslog_conf/rsyslog.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# /etc/rsyslog.conf Configuration file for rsyslog.
#
# For more information see
# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html
#
# Default logging rules can be found in /etc/rsyslog.d/50-default.conf


#################
#### MODULES ####
#################

module(load="imuxsock") # provides support for local system logging
#module(load="immark") # provides --MARK-- message capability

# provides UDP syslog reception
#module(load="imudp")
#input(type="imudp" port="514")

# provides TCP syslog reception
#module(load="imtcp")
#input(type="imtcp" port="514")

# provides kernel logging support and enable non-kernel klog messages
# module(load="imklog" permitnonkernelfacility="on")

###########################
#### GLOBAL DIRECTIVES ####
###########################

#
# Use traditional timestamp format.
# To enable high precision timestamps, comment out the following line.
#
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# Filter duplicated messages
$RepeatedMsgReduction on

#
# Set the default permissions for all log files.
#
$FileOwner ${DAEMON_USER}
$FileGroup ${DAEMON_USER}
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022
$PrivDropToUser syslog
$PrivDropToGroup syslog

###########################
#### CUSTOM DIRECTIVES ####
###########################

#
# Where to place spool and state files
#
$WorkDirectory /var/spool/rsyslog

$OmitLocalLogging off

#
# APACHE
#
module(load="imfile" PollingInterval="10")

# Apache access file:
input(type="imfile"
File="/var/log/apache2/access.log"
Tag="apache-access"
Severity="info")

# Apache error file:
input(type="imfile"
File="/var/log/apache2/error.log"
Tag="apache-error"
Severity="info")

# PHP out file:
input(type="imfile"
File="/var/log/php/out.log"
Tag="php-out"
Severity="info")

# PHP error file:
input(type="imfile"
File="/var/log/php/error.log"
Tag="php-error"
Severity="info")

#
# Custom code for graylog.
#
$ActionQueueType LinkedList # use asynchronous processing
$ActionQueueFileName srvrfwd # set file name, also enables disk mode
$ActionResumeRetryCount -1 # infinite retries on insert failure
$ActionQueueSaveOnShutdown on # save in-memory data if rsyslog shuts down
*.* @@${SYSLOG_SERVER_IP}:${SYSLOG_SERVER_PORT};RSYSLOG_SyslogProtocol23Format

#
# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf
3 changes: 2 additions & 1 deletion scripts/install-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ fi

modules=$(printf "php${php_version}-%s " ${php_modules})

apt-get install -y apache2 php${php_version}-fpm ${modules} msmtp
apt-get install -y apache2 php${php_version}-fpm ${modules} msmtp rsyslog

apt-get autoremove software-properties-common -y --purge
apt-get clean
rm -rf /var/lib/apt/lists/*
rm -rf /tmp/*

ln -s /bin/true /usr/sbin/sendmail

Expand Down
1 change: 0 additions & 1 deletion scripts/install-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ yarn add --cache-folder /tmp wetty.js
#sed -i '0,/false/{s/false/true/}' /var/www/webconsole/index.php
#rm -f /tmp/webconsole.zip


apt-get clean
rm -rf /var/lib/apt/lists/*
rm -rf /tmp/*
Expand Down
9 changes: 9 additions & 0 deletions supervisor_conf/syslog.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[program:rsyslog]
command=/usr/sbin/rsyslogd
killasgroup=true
stopasgroup=true
stopsignal=INT
stdout_logfile=/var/log/rsyslog/access.log, /dev/stdout
stdout_logfile_maxbytes=1GB
stderr_logfile=/var/log/rsyslog/error.log, /dev/stderr
stderr_logfile_maxbytes=1GB