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

more dockerization work

[From @joshdata: This is part of @toilal's work in #377 and 1eb77c332b. The changes are:

* Separates out the runit configuration from starting Mail-in-a-Box setup so that Mail-in-a-Box setup does not block the starting of runit services and we can assume that runit is running during setup (i.e. we can restart services).
* Adds a SKIP_INSTALL flag so that the container can be restarted without re-running the whole Mail-in-a-Box setup.
* Made containers/docker/run more flexible.
* I'm also adding some "|| exit 0"s to the run script to stop if there are any docker errors.
* I'm also adding the prereqs installs from questions.sh into Dockerfile so we don't have to reinstall each time.

]
This commit is contained in:
Toilal
2015-04-04 17:50:16 +02:00
committed by Joshua Tauberer
parent 4eb9af2ebd
commit e004041de2
11 changed files with 258 additions and 144 deletions

View File

@@ -127,6 +127,8 @@ EOF
chmod +x /etc/cron.daily/mailinabox-dnssec
# Permit DNS queries on TCP/UDP in the firewall.
ufw_allow domain
# Start nsd. None of the zones are configured until the management daemon is
# run later, though.
restart_service nsd

View File

@@ -167,19 +167,17 @@ function ufw_allow {
}
function restart_service {
# Restart a service quietly.
if [ -z "$IS_DOCKER" ]; then
# Restart the service.
hide_output service $1 restart
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
else
# In Docker, make sure the service is not disabled by a down file.
if [ -f /etc/service/$1/down ]; then
rm /etc/service/$1/down
fi
sv restart $1
fi
hide_output service $1 restart
}
## Dialog Functions ##

View File

@@ -184,4 +184,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

@@ -12,8 +12,10 @@ if [ -z "$NONINTERACTIVE" ]; then
apt_get_quiet install dialog python3 python3-pip || exit 1
fi
if [ -z "$IS_DOCKER" ]; then
# email_validator is repeated in setup/management.sh
hide_output pip3 install "email_validator==0.1.0-rc5" || exit 1
fi
message_box "Mail-in-a-Box Installation" \
"Hello and thanks for deploying a Mail-in-a-Box!

View File

@@ -102,14 +102,6 @@ source setup/zpush.sh
source setup/management.sh
source setup/munin.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