1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-27 19:37:22 +01:00

Dockerize using phusion/baseimage and runit services

This commit is contained in:
Toilal
2015-04-04 17:50:16 +02:00
parent 2b9ce85ba8
commit 1eb77c332b
30 changed files with 915 additions and 160 deletions

View File

@@ -113,3 +113,4 @@ chmod +x /etc/cron.daily/mailinabox-dnssec
ufw_allow domain
restart_service nsd

View File

@@ -37,14 +37,8 @@ function apt_get_quiet {
}
function apt_install {
PACKAGES=$@
if [ ! -z "$IS_DOCKER" ]; then
# Speed things up because packages are already installed by the image.
PACKAGES=""
fi
# Report any packages already installed.
PACKAGES=$@
TO_INSTALL=""
ALREADY_INSTALLED=""
for pkg in $PACKAGES; do
@@ -165,18 +159,6 @@ function ufw_allow {
}
function restart_service {
# Restart a service quietly.
if [[ ! -z "$IS_DOCKER" && "$1" == "dovecot" ]]; then
# In Docker, sysvinit takes care of any services with an init.d
# script. The dovecot package provides an Upstart config only,
# and so it won't work this way. We make a new script for it
# elsewhere. We also cant do `sv restart dovecot` because runit
# is not running until after the setup scripts are run. So we
# will have to skip starting dovecot for now.
return 0
fi
hide_output service $1 restart
}

View File

@@ -182,3 +182,4 @@ ufw_allow submission
# Restart services
restart_service postfix
restart_service postgrey

View File

@@ -16,10 +16,12 @@ rm -f /usr/local/bin/mailinabox-daemon
ln -s `pwd`/management/daemon.py /usr/local/bin/mailinabox-daemon
# Create an init script to start the management daemon and keep it
# running after a reboot.
rm -f /etc/init.d/mailinabox
ln -s $(pwd)/conf/management-initscript /etc/init.d/mailinabox
hide_output update-rc.d mailinabox defaults
# running after a reboot, if not runit service exists.
if [ ! -d /etc/service/mailinabox ]; then
rm -f /etc/init.d/mailinabox
ln -s $(pwd)/conf/management-initscript /etc/init.d/mailinabox
hide_output update-rc.d mailinabox defaults
fi
# Perform a daily backup.
cat > /etc/cron.daily/mailinabox-backup << EOF;

View File

@@ -75,7 +75,7 @@ if [ ! -f $STORAGE_ROOT/owncloud/owncloud.db ]; then
'instanceid' => '$instanceid',
'trusted_domains' =>
'trusted_domains' =>
array (
0 => '$PRIMARY_HOSTNAME',
),
@@ -172,4 +172,5 @@ chmod +x /etc/cron.hourly/mailinabox-owncloud
# Enable PHP modules and restart PHP.
php5enmod imap
restart_service memcached
restart_service php5-fpm

View File

@@ -4,6 +4,7 @@ if [ -z "$NONINTERACTIVE" ]; then
# e.g. if we piped a bootstrapping install script to bash to get started. In that
# case, the nifty '[ -t 0 ]' test won't work. But with Vagrant we must suppress so we
# use a shell flag instead. Really supress any output from installing dialog.
apt_get_quiet update
apt_get_quiet install dialog
message_box "Mail-in-a-Box Installation" \
"Hello and thanks for deploying a Mail-in-a-Box!

View File

@@ -63,14 +63,6 @@ source setup/owncloud.sh
source setup/zpush.sh
source setup/management.sh
# In Docker, sysvinit services are started automatically. Runit services
# aren't started until after this setup script finishes. But we need
# Dovecot (which is Upstart-only) running in order to create the first
# mail user. So start dovecot now.
if [ ! -z "$IS_DOCKER" ]; then
/usr/sbin/dovecot -c /etc/dovecot/dovecot.conf
fi
# Ping the management daemon to write the DNS and nginx configuration files.
until nc -z -w 4 localhost 10222
do