From b557c71c37bc63e82dead6369737e05e15a9a77a Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Wed, 13 Jul 2016 17:07:43 +0200 Subject: [PATCH] initial commit --- .gitignore | 2 + Dockerfile | 35 ++++++++++++ rootfs/etc/confd/conf.d/config.php.toml | 6 ++ rootfs/etc/confd/conf.d/nginx.conf.toml | 3 + .../etc/confd/templates/config.inc.php.tmpl | 25 +++++++++ rootfs/etc/confd/templates/nginx.conf.tmpl | 55 +++++++++++++++++++ rootfs/etc/cont-init.d/00-roundcube | 8 +++ rootfs/etc/rsyslog.conf | 49 +++++++++++++++++ rootfs/etc/services.d/nginx/run | 3 + rootfs/etc/services.d/rsyslog/run | 3 + 10 files changed, 189 insertions(+) create mode 100755 .gitignore create mode 100644 Dockerfile create mode 100644 rootfs/etc/confd/conf.d/config.php.toml create mode 100644 rootfs/etc/confd/conf.d/nginx.conf.toml create mode 100644 rootfs/etc/confd/templates/config.inc.php.tmpl create mode 100644 rootfs/etc/confd/templates/nginx.conf.tmpl create mode 100644 rootfs/etc/cont-init.d/00-roundcube create mode 100644 rootfs/etc/rsyslog.conf create mode 100644 rootfs/etc/services.d/nginx/run create mode 100644 rootfs/etc/services.d/rsyslog/run diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..93bfd12 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*~ +.DS_Store diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4d0c0d6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +FROM thallian/php7-fpm:latest + +RUN apk add --no-cache openssl tar nginx postgresql-client aspell rsyslog +RUN apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted \ + php7 \ + php7-imap \ + php7-apcu \ + php7-dom \ + php7-json \ + php7-xml \ + php7-session \ + php7-pdo \ + php7-pdo_pgsql \ + php7-sockets \ + php7-exif \ + php7-iconv \ + php7-openssl \ + php7-mbstring \ + php7-sockets \ + php7-mcrypt \ + php7-zip \ + php7-pspell + +RUN ln -s /usr/bin/php7 /usr/bin/php + +RUN mkdir /var/lib/roundcube +RUN wget -qO- https://github.com/roundcube/roundcubemail/releases/download/1.2.0/roundcubemail-1.2.0-complete.tar.gz | tar xz -C /var/lib/roundcube --strip 1 +RUN chown -R nginx:nginx /var/lib/roundcube + +RUN mkdir /run/nginx + +ADD /rootfs / + +ENV FPMUSER nginx +ENV FPMGROUP nginx diff --git a/rootfs/etc/confd/conf.d/config.php.toml b/rootfs/etc/confd/conf.d/config.php.toml new file mode 100644 index 0000000..5259c5a --- /dev/null +++ b/rootfs/etc/confd/conf.d/config.php.toml @@ -0,0 +1,6 @@ +[template] +src = "config.inc.php.tmpl" +dest = "/var/lib/roundcube/config/config.inc.php" +gid = 101 +uid = 100 +mode = "0660" diff --git a/rootfs/etc/confd/conf.d/nginx.conf.toml b/rootfs/etc/confd/conf.d/nginx.conf.toml new file mode 100644 index 0000000..3e968ea --- /dev/null +++ b/rootfs/etc/confd/conf.d/nginx.conf.toml @@ -0,0 +1,3 @@ +[template] +src = "nginx.conf.tmpl" +dest = "/etc/nginx/nginx.conf" diff --git a/rootfs/etc/confd/templates/config.inc.php.tmpl b/rootfs/etc/confd/templates/config.inc.php.tmpl new file mode 100644 index 0000000..e2021d2 --- /dev/null +++ b/rootfs/etc/confd/templates/config.inc.php.tmpl @@ -0,0 +1,25 @@ +.+?\.php)(?/.*)?$ { + try_files $script_name = 404; + + include fastcgi_params; + fastcgi_param PATH_INFO $path_info; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param HTTPS on; + fastcgi_read_timeout 300; + fastcgi_pass php_roundcube; + } + + location ~* ^.+.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ { + expires 30d; + access_log off; + } + } +} \ No newline at end of file diff --git a/rootfs/etc/cont-init.d/00-roundcube b/rootfs/etc/cont-init.d/00-roundcube new file mode 100644 index 0000000..4434b7d --- /dev/null +++ b/rootfs/etc/cont-init.d/00-roundcube @@ -0,0 +1,8 @@ +#!/usr/bin/with-contenv sh + +#PGPASSWORD=$DBPASSWORD psql -h $DBHOST -U $DBUSER -d $DBNAME -c "SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'nc_appconfig')" | grep f + +if [ $? -ne 1 ]; then + +fi + diff --git a/rootfs/etc/rsyslog.conf b/rootfs/etc/rsyslog.conf new file mode 100644 index 0000000..994aef9 --- /dev/null +++ b/rootfs/etc/rsyslog.conf @@ -0,0 +1,49 @@ +# rsyslogd.conf +# +# if you experience problems, check: +# http://www.rsyslog.com/troubleshoot + +#### MODULES #### + +module(load="imuxsock") # local system logging support (e.g. via logger command) +#module(load="imklog") # kernel logging support (previously done by rklogd) +module(load="immark") # --MARK-- message support +module(load="imudp") # UDP listener support + + +input(type="imudp" port="514") + +# Log all kernel messages to the console. +# Logging much else clutters up the screen. +#kern.* action(type="omfile" file="/dev/console") + +# Log anything (except mail) of level info or higher. +# Don't log private authentication messages! +*.info;mail.none;authpriv.none;cron.none action(type="omfile" file="/var/log/messages") + +# The authpriv file has restricted access. +authpriv.* action(type="omfile" file="/var/log/secure") + +# Log all the mail messages in one place. +mail.* action(type="omfile" file="/dev/console") +roundcube.* action(type="omfile" file="/dev/console") + +# Log cron stuff +cron.* action(type="omfile" file="/var/log/cron") + +# Everybody gets emergency messages +*.emerg action(type="omusrmsg" users="*") + +# Save news errors of level crit and higher in a special file. +uucp,news.crit action(type="omfile" file="/var/log/spooler") + +# Save boot messages also to boot.log +local7.* action(type="omfile" file="/var/log/boot.log") + +# log every host in its own directory +if $fromhost-ip then /var/log/$fromhost-ip/messages + +# Include all .conf files in /etc/rsyslog.d +$IncludeConfig /etc/rsyslog.d/*.conf +$template GRAYLOGRFC5424,"<%PRI%>%PROTOCOL-VERSION% %TIMESTAMP:::date-rfc3339% %HOSTNAME% %APP-NAME% %PROCID% %MSGID% %STRUCTURED-DATA% %msg%\n" +*.info;mail.none;authpriv.none;cron.none;*.* @@graylog:514;GRAYLOGRFC5424 # forward everything to remote server \ No newline at end of file diff --git a/rootfs/etc/services.d/nginx/run b/rootfs/etc/services.d/nginx/run new file mode 100644 index 0000000..807d20a --- /dev/null +++ b/rootfs/etc/services.d/nginx/run @@ -0,0 +1,3 @@ +#!/usr/bin/with-contenv sh + +exec nginx -g "daemon off;" diff --git a/rootfs/etc/services.d/rsyslog/run b/rootfs/etc/services.d/rsyslog/run new file mode 100644 index 0000000..ae9eac0 --- /dev/null +++ b/rootfs/etc/services.d/rsyslog/run @@ -0,0 +1,3 @@ +#!/usr/bin/with-contenv sh + +exec rsyslogd -n \ No newline at end of file