mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2026-03-22 18:47:23 +01:00
working dockerization
This commit is contained in:
@@ -166,17 +166,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
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,22 @@ 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
|
||||
if [ ! -z "$IS_DOCKER" ]; then
|
||||
# Use runit for docker
|
||||
mkdir -p /etc/service/mailinabox
|
||||
cp /usr/local/mailinabox/containers/docker/runit/mailinabox.sh /etc/service/mailinabox/run
|
||||
chmod +x /etc/service/mailinabox/run
|
||||
|
||||
# runit -> LSB compatibility
|
||||
# see http://smarden.org/runit/faq.html#lsb
|
||||
mv /etc/init.d/mailinabox /etc/init.d/mailinabox.lsb
|
||||
chmod -x /etc/init.d/mailinabox.lsb
|
||||
ln -s /usr/bin/sv /etc/init.d/mailinabox
|
||||
else
|
||||
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;
|
||||
|
||||
@@ -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!
|
||||
|
||||
@@ -39,7 +39,7 @@ fi
|
||||
# Put a start script in a global location. We tell the user to run 'mailinabox'
|
||||
# in the first dialog prompt, so we should do this before that starts.
|
||||
cat > /usr/local/bin/mailinabox << EOF;
|
||||
#!/bin/bash
|
||||
|
||||
cd `pwd`
|
||||
source setup/start.sh
|
||||
EOF
|
||||
@@ -146,13 +146,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.
|
||||
while [ ! -f /var/lib/mailinabox/api.key ]; do
|
||||
@@ -190,4 +183,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
|
||||
|
||||
Reference in New Issue
Block a user