mirror of
https://github.com/truecharts/charts.git
synced 2026-07-08 15:11:21 -03:00
simplify SOGO container
This commit is contained in:
@@ -27,65 +27,29 @@ RUN \
|
||||
'linux/amd64') export ARCH='linux-x64' ;; \
|
||||
esac \
|
||||
&& \
|
||||
echo "Building from repository $SOGO_UBUNTU_REPOSITORY" \
|
||||
&& apt-get update && apt-get install -y --no-install-recommends \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
gettext \
|
||||
gnupg \
|
||||
mariadb-client \
|
||||
rsync \
|
||||
supervisor \
|
||||
syslog-ng \
|
||||
syslog-ng-core \
|
||||
syslog-ng-mod-redis \
|
||||
dirmngr \
|
||||
netcat \
|
||||
psmisc \
|
||||
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
|
||||
echo "Building from repository $SOGO_UBUNTU_REPOSITORY" && \
|
||||
apt-get install -yq --no-install-recommends apt-transport-https ca-certificates dirmngr gnupg2 && \
|
||||
mkdir ~/.gnupg && \
|
||||
echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf && \
|
||||
(apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-key 0x810273C4 || apt-key adv --keyserver ipv4.pool.sks-keyservers.net --recv-key 0x810273C4) && \
|
||||
echo "deb https://packages.inverse.ca/SOGo/nightly/5/ubuntu/ focal focal" > /etc/apt/sources.list.d/SOGo.list && \
|
||||
apt-get update -qq && \
|
||||
apt-get install -yq --no-install-recommends apache2 sogo sope4.9-gdl1-postgresql sope4.9-gdl1-mysql supervisor memcached memcached && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
|
||||
a2enmod headers proxy proxy_http rewrite ssl && \
|
||||
usermod --home /srv/lib/sogo sogo && \
|
||||
sed -i -e 's/#RedirectMatch \^\/\$ https:\/\/mail.yourdomain.com\/SOGo/RedirectMatch \^\/\$ \/SOGo/' /etc/apache2/conf-enabled/SOGo.conf && \
|
||||
mkdir -p /var/run/memcached/ && \
|
||||
chown memcache:memcache /var/run/memcached
|
||||
|
||||
EXPOSE 80 443
|
||||
|
||||
COPY etc /etc
|
||||
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"]
|
||||
# hadolint ignore=DL3025
|
||||
CMD exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
|
||||
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|
||||
|
||||
LABEL "maintainer"="TrueCharts <info@truecharts.org>"
|
||||
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
|
||||
28
containers/apps/sogo/etc/supervisor/supervisord.conf
Normal file
28
containers/apps/sogo/etc/supervisor/supervisord.conf
Normal file
@@ -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