1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-05 15:57:23 +01:00

Merge branch 'better_docker' of https://github.com/pjz/mailinabox into pjz-better_docker

our trees had diverged, various conflicts resolved
This commit is contained in:
Joshua Tauberer
2014-05-02 14:54:21 -04:00
3 changed files with 87 additions and 19 deletions

View File

@@ -20,15 +20,6 @@ if grep "^PUBLIC_IP=192.168.200.1" /etc/mailinabox.conf > /dev/null; then
scripts/start.sh
fi
echo "Starting Mail-in-a-Box services..."
service nsd start
service postfix start
dovecot # it's integration with Upstart doesn't work in docker
service opendkim start
service nginx start
service php-fastcgi start
if [ -t 0 ]
then
# This is an interactive shell. You get a command prompt within
@@ -40,11 +31,11 @@ then
bash
else
# This is a non-interactive shell. It loops forever to prevent
# the docker container from stopping.
# This is a non-interactive shell. Just display status. Because
# other services are running, the container remains running after
# this script exits.
#
# You get here by omitting '-t' from the docker run arguments.
echo "Your Mail-in-a-Box is running..."
while true; do sleep 10; done
fi

View File

@@ -0,0 +1,58 @@
#!/bin/bash
echo "Setting up Mail-in-a-Box services..."
SERVICES="nsd postfix dovecot opendkim nginx php-fastcgi"
for service in $SERVICES; do
mkdir -p /etc/service/$service
done
cat <<EORUN >/etc/service/nsd/run
#!/bin/sh
exec /usr/bin/nsd -d
EORUN
cat <<EORUN >/etc/service/postfix/run
#!/bin/sh
# from http://smarden.org/runit/runscripts.html#postfix
exec 1>&2
daemon_directory=/usr/lib/postfix \
command_directory=/usr/sbin \
config_directory=/etc/postfix \
queue_directory=/var/spool/postfix \
mail_owner=postfix \
setgid_group=postdrop \
/etc/postfix/postfix-script check || exit 1
exec /usr/lib/postfix/master
EORUN
cat <<EORUN >/etc/service/dovecot/run
#!/bin/sh
exec dovecot
EORUN
cat <<EORUN >/etc/service/opendkim/run
#!/bin/sh
exec opendkim -f -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim/opendkim.pid
EORUN
echo "daemon off;" >> /etc/nginx/nginx.conf
cat <<EORUN >/etc/service/nginx/run
#!/bin/sh
exec nginx
EORUN
cat <<EORUN >/etc/service/php-fastcgi/run
#!/bin/bash
export PHP_FCGI_CHILDREN=4 PHP_FCGI_MAX_REQUESTS=1000
exec /usr/bin/php-cgi -q -b /tmp/php-fastcgi.www-data.sock -c /etc/php5/cgi/php.ini
EORUN
for service in $SERVICES; do
chmod a+x /etc/service/$service/run
done
echo "Your Mail-in-a-Box services are configured."