Merge pull request #44 from Venator-Fox/feature/postfix-tuning

Feature/postfix tuning
This commit is contained in:
Adam W Zheng 2019-07-08 17:11:32 -05:00 committed by GitHub
commit 062e707121
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View File

@ -4,12 +4,12 @@ LABEL maintainer="Adam W Zheng <adam.w.zheng@icloud.com>"
ENV S6_RELEASE 1.22.1.0
ENV SIMPLESAMLPHP_RELEASE 1.17.2
#Add S6 Overlay
#Add s6-overlay
ADD https://github.com/just-containers/s6-overlay/releases/download/v$S6_RELEASE/s6-overlay-amd64.tar.gz /tmp/
RUN tar xzf /tmp/s6-overlay-amd64.tar.gz -C / --exclude="./bin" \
&& tar xzf /tmp/s6-overlay-amd64.tar.gz -C /usr ./bin
#Install SimpleSAMLphp Requirements
#Install simplesamlphp requirements
RUN yum -y install centos-release-scl \
&& yum -y install rh-nginx114 rh-php72 rh-php72-php-fpm rh-php72-php-mbstring rh-php72-php-pdo rh-php72-php-ldap sclo-php72-php-pecl-memcached postfix \
&& sed -i 's/user = apache/user = nginx/' /etc/opt/rh/rh-php72/php-fpm.d/www.conf \
@ -24,37 +24,37 @@ RUN echo -e 'server {\n listen 80 default_server;\n listen [::
&& chown -Rv nginx:nginx /var/lib/php/session/ \
&& chmod a+t /var/lib/php/session/
#Download SimpleSAMLphp, Archive must remain present for seeding post install.
#Download simplesamlphp and retain archive for seeding
RUN curl -Lo /var/simplesamlphp.tar.gz https://github.com/simplesamlphp/simplesamlphp/releases/download/v$SIMPLESAMLPHP_RELEASE/simplesamlphp-$SIMPLESAMLPHP_RELEASE.tar.gz \
&& tar xzf /var/simplesamlphp.tar.gz --directory /var \
&& mv /var/simplesamlphp-* /var/simplesamlphp \
&& touch /var/simplesamlphp/cert/breadcrumb \
&& touch /var/simplesamlphp/log/breadcrumb
#Redirect NGINX Logs
#Redirect nginx logs
RUN ln -sf /dev/stdout /var/opt/rh/rh-nginx114/log/nginx/access.log \
&& ln -sf /dev/stderr /var/opt/rh/rh-nginx114/log/nginx/error.log
#Add Service NGINX to be Monitored by S6
#Add service nginx to s6-supervisor
RUN mkdir -p /etc/services.d/nginx/ \
&& touch /etc/services.d/nginx/run \
&& echo '#!/usr/bin/execlineb -P' > /etc/services.d/nginx/run \
&& echo '/opt/rh/rh-nginx114/root/usr/sbin/nginx -g "daemon off;"' >> /etc/services.d/nginx/run
#Add Service PHP-FPM to be Monitored by S6
#Add service php-fpm to s6-supervisor
RUN mkdir -p /etc/services.d/php-fpm/ \
&& touch /etc/services.d/php-fpm/run \
&& echo '#!/usr/bin/execlineb -P' > /etc/services.d/php-fpm/run \
&& echo '/opt/rh/rh-php72/root/usr/sbin/php-fpm' >> /etc/services.d/php-fpm/run --nodaemonize \
&& sed -i 's|pid = /run/php-fpm/php-fpm.pid|pid = /run/php-fpm.pid|g' /etc/opt/rh/rh-php72/php-fpm.conf
#Add Service Postfix to be Monitored by S6
#Add service postfix to s6-supervisor
RUN mkdir -p /etc/services.d/postfix/ \
&& touch /etc/services.d/postfix/run \
&& echo '#!/usr/bin/execlineb -P' > /etc/services.d/postfix/run \
&& echo '/usr/sbin/postfix start' >> /etc/services.d/postfix/run
&& echo '/usr/libexec/postfix/master -c /etc/postfix -d' >> /etc/services.d/postfix/run
#Copy the SimpleSAMLphp CLI Install Script into the Container to be executed on startup
#Copy the simplesamlphp install script into the container to be executed on startup
COPY install-simplesamlphp.sh /etc/cont-init.d/
RUN chmod u+x /etc/cont-init.d/install-simplesamlphp.sh

View File

@ -302,6 +302,7 @@ if [ "$MTA_NULLCLIENT" == "true" ]; then
sed -i "s|#myorigin = \$myhostname|myorigin = $POSTFIX_MYORIGIN|g" /etc/postfix/main.cf
sed -i "s|#relayhost = \$mydomain|relayhost = $POSTFIX_RELAYHOST|g" /etc/postfix/main.cf
sed -i "s|inet_interfaces = localhost|inet_interfaces = $POSTFIX_INETINTERFACES|g" /etc/postfix/main.cf
sed -i "s|inet_protocols = all|inet_protocols = ipv4|g" /etc/postfix/main.cf
sed -i "s|mydestination = \$myhostname, localhost.\$mydomain, localhost|mydestination = $POSTFIX_MYDESTINATION|1" /etc/postfix/main.cf
if [ "$POSTFIX_MYDESTINATION" != "" ] ; then
echo "[$0] [WARN] Only null client is supported in this image. POSTFIX_MYDESTINATION must be set to an empty string but was set to '$POSTFIX_MYDESTINATION'."