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

simplify dockerization

This commit is contained in:
Joshua Tauberer
2015-01-30 17:40:58 -05:00
parent 51d89a780d
commit 4eb9af2ebd
19 changed files with 131 additions and 181 deletions

View File

@@ -39,9 +39,14 @@ function apt_get_quiet {
}
function apt_install {
if [ ! "$IS_DOCKER" ];then
# Report any packages already installed.
PACKAGES=$@
if [ ! -z "$IS_DOCKER" ]; then
# Speed things up because packages are already installed by the image.
PACKAGES=""
fi
# Report any packages already installed.
TO_INSTALL=""
ALREADY_INSTALLED=""
for pkg in $PACKAGES; do
@@ -163,10 +168,18 @@ function ufw_allow {
function restart_service {
# Restart a service quietly.
if [ ! "$IS_DOCKER" ]; then
# The normal way to restart a 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
fi
hide_output service $1 restart
}
## Dialog Functions ##

View File

@@ -102,6 +102,14 @@ 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
@@ -139,5 +147,4 @@ openssl x509 -in $STORAGE_ROOT/ssl/ssl_certificate.pem -noout -fingerprint \
| sed "s/SHA1 Fingerprint=//"
echo
echo Then you can confirm the security exception and continue.
echo
echo