Commit e4c0fa11 authored by ale's avatar ale

Add setup script

The container setup script copies the Roundcube configuration files in
place, from the /etc/roundcube directory, and runs database migrations
if necessary.
parent 6eb353c0
Pipeline #845 passed with stages
in 3 minutes and 30 seconds
......@@ -3,6 +3,7 @@ FROM bitnami/minideb:stretch
COPY conf /tmp/conf
COPY build/src /var/www/webmail
COPY build.sh /tmp/build.sh
COPY start.sh /start.sh
#COPY install-roundcube /tmp/install-roundcube
RUN /tmp/build.sh && rm -fr /tmp/build.sh /tmp/conf
......
<VirtualHost *:84>
ServerName webmail.${DOMAIN}
ServerAlias *.webmail.${DOMAIN}
ServerName ${SHARD_ID}.webmail.${DOMAIN}
DocumentRoot /var/www/webmail
......
apache2_setup.service: {
type: oneshot,
stdout: inherit,
service_groups: INIT,
process_timeout: 600,
command: "/start.sh",
}
apache2.service: {
command: "bash -c 'source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND'",
kill_signal: SIGWINCH
kill_signal: SIGWINCH,
exit_kills: true,
}
fpm.service: {
command: "/usr/sbin/php-fpm7.0 --force-stderr --nodaemonize"
command: "/usr/sbin/php-fpm7.0 --force-stderr --nodaemonize",
exit_kills: true,
}
#fakemail.service: {
# command: "python3 -m smtpd -n -c DebuggingServer 0.0.0.0:25",
# env_set: {
# 'PYTHONUNBUFFERED': '1'
# }
#}
console.logging: {
selector: '*.warn',
stdout: true,
......
......@@ -34,7 +34,7 @@ install_config() {
setup_database() {
# The current Roundcube version is stored in the database.
local cur_version=$(mysql -NBe 'select version from rc_version' ${MYSQL_DB} 2>/dev/null)
cur_version=$(mysql -NBe 'select version from rc_version' ${MYSQL_DB} 2>/dev/null)
# If cur_version is empty, it means that the database has not been
# initialized yet.
......@@ -53,6 +53,17 @@ setup_database() {
set -e
set -u
# Abort if some fundamental environment variables are not defined.
# This is nicer than having Apache die with an error.
if [ -z "${DOMAIN}" ]; then
echo "ERROR: The 'DOMAIN' environment variable is not defined" >&2
exit 1
fi
if [ -z "${SHARD_ID}" ]; then
echo "ERROR: The 'SHARD_ID' environment variable is not defined" >&2
exit 1
fi
install_config
setup_database
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment