simplify SOGO container
This commit is contained in:
@@ -27,65 +27,29 @@ RUN \
|
|||||||
'linux/amd64') export ARCH='linux-x64' ;; \
|
'linux/amd64') export ARCH='linux-x64' ;; \
|
||||||
esac \
|
esac \
|
||||||
&& \
|
&& \
|
||||||
echo "Building from repository $SOGO_UBUNTU_REPOSITORY" \
|
echo "Building from repository $SOGO_UBUNTU_REPOSITORY" && \
|
||||||
&& apt-get update && apt-get install -y --no-install-recommends \
|
apt-get install -yq --no-install-recommends apt-transport-https ca-certificates dirmngr gnupg2 && \
|
||||||
apt-transport-https \
|
mkdir ~/.gnupg && \
|
||||||
ca-certificates \
|
echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf && \
|
||||||
gettext \
|
(apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-key 0x810273C4 || apt-key adv --keyserver ipv4.pool.sks-keyservers.net --recv-key 0x810273C4) && \
|
||||||
gnupg \
|
echo "deb https://packages.inverse.ca/SOGo/nightly/5/ubuntu/ focal focal" > /etc/apt/sources.list.d/SOGo.list && \
|
||||||
mariadb-client \
|
apt-get update -qq && \
|
||||||
rsync \
|
apt-get install -yq --no-install-recommends apache2 sogo sope4.9-gdl1-postgresql sope4.9-gdl1-mysql supervisor memcached memcached && \
|
||||||
supervisor \
|
apt-get clean && \
|
||||||
syslog-ng \
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
|
||||||
syslog-ng-core \
|
a2enmod headers proxy proxy_http rewrite ssl && \
|
||||||
syslog-ng-mod-redis \
|
usermod --home /srv/lib/sogo sogo && \
|
||||||
dirmngr \
|
sed -i -e 's/#RedirectMatch \^\/\$ https:\/\/mail.yourdomain.com\/SOGo/RedirectMatch \^\/\$ \/SOGo/' /etc/apache2/conf-enabled/SOGo.conf && \
|
||||||
netcat \
|
mkdir -p /var/run/memcached/ && \
|
||||||
psmisc \
|
chown memcache:memcache /var/run/memcached
|
||||||
wget \
|
|
||||||
patch \
|
|
||||||
&& dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
|
|
||||||
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \
|
|
||||||
&& chmod +x /usr/local/bin/gosu \
|
|
||||||
&& gosu nobody true \
|
|
||||||
&& mkdir /usr/share/doc/sogo \
|
|
||||||
&& touch /usr/share/doc/sogo/empty.sh \
|
|
||||||
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-key 0x810273C4 \
|
|
||||||
&& echo "deb ${SOGO_UBUNTU_REPOSITORY} focal focal" > /etc/apt/sources.list.d/sogo.list \
|
|
||||||
&& apt-get update && apt-get install -y --no-install-recommends \
|
|
||||||
sogo \
|
|
||||||
sogo-activesync \
|
|
||||||
&& apt-get autoclean \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/sogo.list \
|
|
||||||
&& touch /etc/default/locale \
|
|
||||||
&& apt-get remove -y \
|
|
||||||
jq \
|
|
||||||
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
|
|
||||||
&& apt-get autoremove -y \
|
|
||||||
&& apt-get clean \
|
|
||||||
&& \
|
|
||||||
rm -rf \
|
|
||||||
/tmp/* \
|
|
||||||
/var/lib/apt/lists/* \
|
|
||||||
/var/tmp/ \
|
|
||||||
&& chmod -R u=rwX,go=rX /app \
|
|
||||||
&& printf "umask %d" "${UMASK}" >> /etc/bash.bashrc \
|
|
||||||
&& update-ca-certificates
|
|
||||||
|
|
||||||
EXPOSE 80 443
|
EXPOSE 80 443
|
||||||
|
|
||||||
|
COPY etc /etc
|
||||||
COPY ./containers/apps/sogo/entrypoint.sh /entrypoint.sh
|
COPY ./containers/apps/sogo/entrypoint.sh /entrypoint.sh
|
||||||
COPY ./containers/apps/sogo/bootstrap-sogo.sh /bootstrap-sogo.sh
|
|
||||||
COPY ./containers/apps/sogo/syslog-ng.conf /etc/syslog-ng/syslog-ng.conf
|
|
||||||
COPY ./containers/apps/sogo/supervisord.conf /etc/supervisor/supervisord.conf
|
|
||||||
COPY ./containers/apps/sogo/stop-supervisor.sh /usr/local/sbin/stop-supervisor.sh
|
|
||||||
|
|
||||||
RUN chmod +x /bootstrap-sogo.sh \
|
|
||||||
/usr/local/sbin/stop-supervisor.sh
|
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|
||||||
# hadolint ignore=DL3025
|
|
||||||
CMD exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
|
|
||||||
|
|
||||||
LABEL "maintainer"="TrueCharts <info@truecharts.org>"
|
LABEL "maintainer"="TrueCharts <info@truecharts.org>"
|
||||||
LABEL "org.opencontainers.image.source"="https://github.com/truecharts/apps"
|
LABEL "org.opencontainers.image.source"="https://github.com/truecharts/apps"
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
exec gosu sogo /usr/sbin/sogod
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
# each program entry below is a separate terminal command.
|
||||||
|
# Each command MUST run in the foreground and stay running.
|
||||||
|
# If the command ever exits, the supervisor daemon will automatically run it again.
|
||||||
|
# Programs can be controlled like this: 'supervisorctl start fail2ban' 'supervisorctl stop fail2ban'
|
||||||
|
# supervisor writes program statuses in /var/log/supervisor
|
||||||
|
|
||||||
|
[supervisord]
|
||||||
|
nodaemon=true
|
||||||
|
|
||||||
|
[program:apache2]
|
||||||
|
startsecs=0
|
||||||
|
autostart=true
|
||||||
|
autorestart=false
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
environment=APACHE_ARGUMENTS="-DNO_DETACH"
|
||||||
|
command=/usr/sbin/apache2ctl start
|
||||||
|
|
||||||
|
[program:memcached]
|
||||||
|
startsecs=0
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
user=memcache
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
command=/usr/bin/memcached -m 128 -a 0666 -s /var/run/memcached/memcached.sock
|
||||||
|
|
||||||
|
[program:sogo]
|
||||||
|
startsecs=0
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
user=sogo
|
||||||
|
command=/usr/sbin/sogod -WONoDetach YES -WOPidFile /var/run/sogo/sogo.pid
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
; supervisor config file
|
||||||
|
|
||||||
|
[unix_http_server]
|
||||||
|
file=/dev/shm/supervisor.sock ; (the path to the socket file)
|
||||||
|
chmod=0700 ; sockef file mode (default 0700)
|
||||||
|
|
||||||
|
[supervisord]
|
||||||
|
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
|
||||||
|
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
|
||||||
|
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
|
||||||
|
|
||||||
|
; the below section must remain in the config file for RPC
|
||||||
|
; (supervisorctl/web interface) to work, additional interfaces may be
|
||||||
|
; added by defining them in separate rpcinterface: sections
|
||||||
|
[rpcinterface:supervisor]
|
||||||
|
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||||
|
|
||||||
|
[supervisorctl]
|
||||||
|
serverurl=unix:///dev/shm/supervisor.sock ; use a unix:// URL for a unix socket
|
||||||
|
|
||||||
|
; The [include] section can just contain the "files" setting. This
|
||||||
|
; setting can list multiple files (separated by whitespace or
|
||||||
|
; newlines). It can also contain wildcards. The filenames are
|
||||||
|
; interpreted as relative to this file. Included files *cannot*
|
||||||
|
; include files themselves.
|
||||||
|
|
||||||
|
[include]
|
||||||
|
files = /etc/supervisor/conf.d/*.conf
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
printf "READY\n";
|
|
||||||
|
|
||||||
while read line; do
|
|
||||||
echo "Processing Event: $line" >&2;
|
|
||||||
kill -3 $(cat "/var/run/supervisord.pid")
|
|
||||||
done < /dev/stdin
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
[supervisord]
|
|
||||||
nodaemon=true
|
|
||||||
user=root
|
|
||||||
|
|
||||||
[program:syslog-ng]
|
|
||||||
command=/usr/sbin/syslog-ng --foreground --no-caps
|
|
||||||
stdout_logfile=/dev/stdout
|
|
||||||
stdout_logfile_maxbytes=0
|
|
||||||
stderr_logfile=/dev/stderr
|
|
||||||
stderr_logfile_maxbytes=0
|
|
||||||
autostart=true
|
|
||||||
priority=1
|
|
||||||
|
|
||||||
[program:bootstrap-sogo]
|
|
||||||
command=/bootstrap-sogo.sh
|
|
||||||
stdout_logfile=/dev/stdout
|
|
||||||
stdout_logfile_maxbytes=0
|
|
||||||
stderr_logfile=/dev/stderr
|
|
||||||
stderr_logfile_maxbytes=0
|
|
||||||
priority=2
|
|
||||||
startretries=10
|
|
||||||
autorestart=true
|
|
||||||
stopwaitsecs=120
|
|
||||||
|
|
||||||
[eventlistener:processes]
|
|
||||||
command=/usr/local/sbin/stop-supervisor.sh
|
|
||||||
events=PROCESS_STATE_STOPPED, PROCESS_STATE_EXITED, PROCESS_STATE_FATAL
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
@version: 3.19
|
|
||||||
@include "scl.conf"
|
|
||||||
options {
|
|
||||||
chain_hostnames(off);
|
|
||||||
flush_lines(0);
|
|
||||||
use_dns(no);
|
|
||||||
use_fqdn(no);
|
|
||||||
owner("root"); group("adm"); perm(0640);
|
|
||||||
stats_freq(0);
|
|
||||||
bad_hostname("^gconfd$");
|
|
||||||
};
|
|
||||||
source s_src {
|
|
||||||
unix-stream("/dev/log");
|
|
||||||
internal();
|
|
||||||
};
|
|
||||||
source s_sogo {
|
|
||||||
pipe("/dev/sogo_log" owner(sogo) group(sogo));
|
|
||||||
};
|
|
||||||
destination d_stdout { pipe("/dev/stdout"); };
|
|
||||||
destination d_redis_ui_log {
|
|
||||||
redis(
|
|
||||||
host("redis-mailcow")
|
|
||||||
persist-name("redis1")
|
|
||||||
port(6379)
|
|
||||||
command("LPUSH" "SOGO_LOG" "$(format-json time=\"$S_UNIXTIME\" priority=\"$PRIORITY\" program=\"$PROGRAM\" message=\"$MESSAGE\")\n")
|
|
||||||
);
|
|
||||||
};
|
|
||||||
destination d_redis_f2b_channel {
|
|
||||||
redis(
|
|
||||||
host("redis-mailcow")
|
|
||||||
persist-name("redis2")
|
|
||||||
port(6379)
|
|
||||||
command("PUBLISH" "F2B_CHANNEL" "$(sanitize $MESSAGE)")
|
|
||||||
);
|
|
||||||
};
|
|
||||||
log {
|
|
||||||
source(s_sogo);
|
|
||||||
destination(d_redis_ui_log);
|
|
||||||
destination(d_redis_f2b_channel);
|
|
||||||
};
|
|
||||||
log {
|
|
||||||
source(s_sogo);
|
|
||||||
source(s_src);
|
|
||||||
destination(d_stdout);
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user