feat(): add log to stdout

pull/26/head
Hardware 2018-06-22 08:58:40 +02:00
parent 990087f809
commit 88c96728c5
No known key found for this signature in database
GPG Key ID: EC6DF6F90263EDEA
3 changed files with 14 additions and 1 deletions

View File

@ -17,6 +17,7 @@ RUN echo "@community https://nl.alpinelinux.org/alpine/v3.7/community" >> /etc/a
s6 \ s6 \
su-exec \ su-exec \
curl \ curl \
git \
php7@community \ php7@community \
php7-fileinfo@community \ php7-fileinfo@community \
php7-phar@community \ php7-phar@community \
@ -36,6 +37,7 @@ RUN echo "@community https://nl.alpinelinux.org/alpine/v3.7/community" >> /etc/a
php7-opcache@community \ php7-opcache@community \
php7-xmlwriter@community \ php7-xmlwriter@community \
php7-tokenizer@community \ php7-tokenizer@community \
php7-zip@community \
&& cd /tmp \ && cd /tmp \
&& curl -s http://getcomposer.org/installer | php \ && curl -s http://getcomposer.org/installer | php \
&& mv /tmp/composer.phar /usr/bin/composer \ && mv /tmp/composer.phar /usr/bin/composer \

View File

@ -16,7 +16,7 @@ Flarum is the next-generation forum software that makes online discussion fun. I
### Build-time variables ### Build-time variables
- **VERSION** = Version of flarum (default: *v0.1.0-beta.7.1*) - **VERSION** = Version of flarum (default: *v0.1.0-beta.7*)
### Ports ### Ports
@ -43,6 +43,7 @@ Flarum is the next-generation forum software that makes online discussion fun. I
| **UPLOAD_MAX_SIZE** | The maximum size of an uploaded file | *optional* | 50M | **UPLOAD_MAX_SIZE** | The maximum size of an uploaded file | *optional* | 50M
| **PHP_MEMORY_LIMIT** | PHP memory limit | *optional* | 128M | | **PHP_MEMORY_LIMIT** | PHP memory limit | *optional* | 128M |
| **OPCACHE_MEMORY_LIMIT** | OPcache memory size in megabytes | *optional* | 128 | **OPCACHE_MEMORY_LIMIT** | OPcache memory size in megabytes | *optional* | 128
| **LOG_TO_STDOUT** | Enable web server logs to stdout | *optional* | false
## Installation ## Installation

View File

@ -11,6 +11,7 @@ DB_HOST=${DB_HOST:-mariadb}
DB_USER=${DB_USER:-flarum} DB_USER=${DB_USER:-flarum}
DB_NAME=${DB_NAME:-flarum} DB_NAME=${DB_NAME:-flarum}
DEBUG=${DEBUG:-false} DEBUG=${DEBUG:-false}
LOG_TO_STDOUT=${LOG_TO_STDOUT:-false}
# Required env variables # Required env variables
if [ -z "$DB_PASS" ]; then if [ -z "$DB_PASS" ]; then
@ -32,8 +33,17 @@ chown -R $UID:$GID /flarum /services /var/log /var/lib/nginx
cd /flarum/app cd /flarum/app
# Set log output to STDOUT if wanted (LOG_TO_STDOUT=true)
if [ "$LOG_TO_STDOUT" = true ]; then
echo "[INFO] Logging to stdout activated"
chmod o+w /dev/stdout
sed -i "s/.*error_log.*$/error_log \/dev\/stdout warn;/" /etc/nginx/nginx.conf
sed -i "s/.*error_log.*$/error_log = \/dev\/stdout/" /etc/php7/php-fpm.conf
fi
# Disable custom errors pages if debug mode is enabled # Disable custom errors pages if debug mode is enabled
if [ "$DEBUG" = true ]; then if [ "$DEBUG" = true ]; then
echo "[INFO] Debug mode enabled"
sed -i '/error_page/ s/^/#/' /etc/nginx/nginx.conf sed -i '/error_page/ s/^/#/' /etc/nginx/nginx.conf
fi fi