[mailcow] Move ejabberd site to last available site

master
andryyy 2021-02-12 19:26:49 +01:00
parent 63160890e0
commit 8c6b512f05
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
8 changed files with 26 additions and 18 deletions

View File

@ -71,6 +71,7 @@ cat <<EOF > /ejabberd/ejabberd_macros.yml
# Autogenerated by mailcow # Autogenerated by mailcow
define_macro: define_macro:
'MAILCOW_HOSTNAME': "${MAILCOW_HOSTNAME}" 'MAILCOW_HOSTNAME': "${MAILCOW_HOSTNAME}"
'EJABBERD_HTTPS': ${XMPP_HTTPS_PORT}
EOF EOF
# Set open_basedir # Set open_basedir

View File

@ -1,12 +1,12 @@
FROM php:7.4-fpm-alpine3.11 FROM php:7.4-fpm-alpine3.11
LABEL maintainer "Andre Peters <andre.peters@servercow.de>" LABEL maintainer "Andre Peters <andre.peters@servercow.de>"
ENV APCU_PECL 5.1.18 ENV APCU_PECL 5.1.19
ENV IMAGICK_PECL 3.4.4 ENV IMAGICK_PECL 3.4.4
# Mailparse is pulled from master branch # Mailparse is pulled from master branch
#ENV MAILPARSE_PECL 3.0.2 #ENV MAILPARSE_PECL 3.0.2
ENV MEMCACHED_PECL 3.1.5 ENV MEMCACHED_PECL 3.1.5
ENV REDIS_PECL 5.3.1 ENV REDIS_PECL 5.3.3
RUN apk add -U --no-cache autoconf \ RUN apk add -U --no-cache autoconf \
aspell-dev \ aspell-dev \

View File

@ -172,8 +172,8 @@ fi
# Fix permissions for global filters # Fix permissions for global filters
chown -R 82:82 /global_sieve/* chown -R 82:82 /global_sieve/*
[[ ! -f /etc/nginx/conf.d/ejabberd.conf ]] && echo '# Autogenerated by mailcow' > /etc/nginx/conf.d/ejabberd.conf [[ ! -f /etc/nginx/conf.d/ZZZ-ejabberd.conf ]] && echo '# Autogenerated by mailcow' > /etc/nginx/conf.d/ZZZ-ejabberd.conf
chown 82:82 /etc/nginx/conf.d/ejabberd.conf chown 82:82 /etc/nginx/conf.d/ZZZ-ejabberd.conf
# Run hooks # Run hooks
for file in /hooks/*; do for file in /hooks/*; do

View File

@ -53,13 +53,11 @@ listen:
module: ejabberd_s2s_in module: ejabberd_s2s_in
max_stanza_size: 524288 max_stanza_size: 524288
- -
port: 5443 port: EJABBERD_HTTPS
ip: "::" ip: "::"
module: ejabberd_http module: ejabberd_http
tls: true tls: true
request_handlers: request_handlers:
/admin: ejabberd_web_admin
/api: mod_http_api
/captcha: ejabberd_captcha /captcha: ejabberd_captcha
/upload: mod_http_upload /upload: mod_http_upload
/ws: ejabberd_http_ws /ws: ejabberd_http_ws
@ -69,6 +67,7 @@ listen:
module: ejabberd_http module: ejabberd_http
request_handlers: request_handlers:
/admin: ejabberd_web_admin /admin: ejabberd_web_admin
/api: mod_http_api
- -
module: ejabberd_http module: ejabberd_http
port: 5281 port: 5281
@ -161,7 +160,6 @@ modules:
mod_fail2ban: {} mod_fail2ban: {}
mod_http_api: {} mod_http_api: {}
mod_http_upload: mod_http_upload:
put_url: https://@HOST@:5443/upload
docroot: /var/www/upload docroot: /var/www/upload
custom_headers: custom_headers:
"Access-Control-Allow-Origin": "https://@HOST@" "Access-Control-Allow-Origin": "https://@HOST@"

View File

@ -6,7 +6,7 @@ function xmpp_control($_action, $_data = null) {
case 'reload': case 'reload':
$curl = curl_init(); $curl = curl_init();
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_setopt($curl, CURLOPT_URL, 'https://ejabberd:5443/api/reload_config'); curl_setopt($curl, CURLOPT_URL, 'http://ejabberd:5280/api/reload_config');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
@ -32,7 +32,7 @@ function xmpp_control($_action, $_data = null) {
case 'restart': case 'restart':
$curl = curl_init(); $curl = curl_init();
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_setopt($curl, CURLOPT_URL, 'https://ejabberd:5443/api/restart'); curl_setopt($curl, CURLOPT_URL, 'http://ejabberd:5280/api/restart');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
@ -82,7 +82,7 @@ function xmpp_control($_action, $_data = null) {
) as $stat => $url) { ) as $stat => $url) {
$curl = curl_init(); $curl = curl_init();
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_setopt($curl, CURLOPT_URL, 'https://ejabberd:5443/api/' . $url); curl_setopt($curl, CURLOPT_URL, 'http://ejabberd:5280/api/' . $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
@ -128,10 +128,10 @@ function xmpp_rebuild_configs() {
touch('/ejabberd/ejabberd_hosts.yml'); touch('/ejabberd/ejabberd_hosts.yml');
touch('/ejabberd/ejabberd_acl.yml'); touch('/ejabberd/ejabberd_acl.yml');
touch('/etc/nginx/conf.d/ejabberd.conf'); touch('/etc/nginx/conf.d/ZZZ-ejabberd.conf');
$ejabberd_hosts_md5 = md5_file('/ejabberd/ejabberd_hosts.yml'); $ejabberd_hosts_md5 = md5_file('/ejabberd/ejabberd_hosts.yml');
$ejabberd_acl_md5 = md5_file('/ejabberd/ejabberd_acl.yml'); $ejabberd_acl_md5 = md5_file('/ejabberd/ejabberd_acl.yml');
$ejabberd_site_md5 = md5_file('/etc/nginx/conf.d/ejabberd.conf'); $ejabberd_site_md5 = md5_file('/etc/nginx/conf.d/ZZZ-ejabberd.conf');
if (!empty($xmpp_domains)) { if (!empty($xmpp_domains)) {
// Handle hosts file // Handle hosts file
@ -165,12 +165,12 @@ function xmpp_rebuild_configs() {
fclose($acl_handle); fclose($acl_handle);
// Handle Nginx site // Handle Nginx site
$site_handle = @fopen('/etc/nginx/conf.d/ejabberd.conf', 'r+'); $site_handle = @fopen('/etc/nginx/conf.d/ZZZ-ejabberd.conf', 'r+');
if ($site_handle !== false) { if ($site_handle !== false) {
ftruncate($site_handle, 0); ftruncate($site_handle, 0);
fclose($site_handle); fclose($site_handle);
} }
$site_handle = fopen('/etc/nginx/conf.d/ejabberd.conf', 'w'); $site_handle = fopen('/etc/nginx/conf.d/ZZZ-ejabberd.conf', 'w');
if (!$site_handle) { if (!$site_handle) {
throw new Exception($lang['danger']['file_open_error']); throw new Exception($lang['danger']['file_open_error']);
} }
@ -248,7 +248,7 @@ EOF;
); );
} }
if (md5_file('/etc/nginx/conf.d/ejabberd.conf') != $ejabberd_site_md5) { if (md5_file('/etc/nginx/conf.d/ZZZ-ejabberd.conf') != $ejabberd_site_md5) {
$response = json_decode(docker('post', 'nginx-mailcow', 'exec', array("cmd" => "reload", "task" => "nginx"), 'Content-type: application/json'), true); $response = json_decode(docker('post', 'nginx-mailcow', 'exec', array("cmd" => "reload", "task" => "nginx"), 'Content-type: application/json'), true);
if (isset($response['type']) && $response['type'] == "success") { if (isset($response['type']) && $response['type'] == "success") {
$_SESSION['return'][] = array( $_SESSION['return'][] = array(

View File

@ -101,7 +101,7 @@ services:
- rspamd - rspamd
php-fpm-mailcow: php-fpm-mailcow:
image: mailcow/phpfpm:1.71 image: mailcow/phpfpm:1.72
command: "php-fpm -d date.timezone=${TZ} -d expose_php=0" command: "php-fpm -d date.timezone=${TZ} -d expose_php=0"
depends_on: depends_on:
- redis-mailcow - redis-mailcow
@ -527,7 +527,7 @@ services:
- olefy - olefy
ejabberd-mailcow: ejabberd-mailcow:
image: mailcow/ejabberd:1.2 image: mailcow/ejabberd:1.3
volumes: volumes:
- ./data/conf/ejabberd/ejabberd.yml:/home/ejabberd/conf/ejabberd.yml:z - ./data/conf/ejabberd/ejabberd.yml:/home/ejabberd/conf/ejabberd.yml:z
- xmpp-vol-1:/home/ejabberd/database:z - xmpp-vol-1:/home/ejabberd/database:z
@ -547,6 +547,7 @@ services:
- MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME} - MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
- MASTER=${MASTER:-y} - MASTER=${MASTER:-y}
- IPV4_NETWORK=${IPV4_NETWORK:-172.22.1} - IPV4_NETWORK=${IPV4_NETWORK:-172.22.1}
- XMPP_HTTPS_PORT=${XMPP_HTTPS_PORT:-5443}
- DBNAME=${DBNAME} - DBNAME=${DBNAME}
- DBUSER=${DBUSER} - DBUSER=${DBUSER}
- DBPASS=${DBPASS} - DBPASS=${DBPASS}

View File

@ -172,6 +172,7 @@ SOLR_PORT=127.0.0.1:18983
REDIS_PORT=127.0.0.1:7654 REDIS_PORT=127.0.0.1:7654
XMPP_C2S_PORT=5222 XMPP_C2S_PORT=5222
XMPP_S2S_PORT=5269 XMPP_S2S_PORT=5269
XMPP_HTTPS_PORT=5443
# Your timezone # Your timezone
# See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for a list of timezones # See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for a list of timezones

View File

@ -220,6 +220,7 @@ CONFIG_ARRAY=(
"MAILCOW_PASS_SCHEME" "MAILCOW_PASS_SCHEME"
"XMPP_C2S_PORT" "XMPP_C2S_PORT"
"XMPP_S2S_PORT" "XMPP_S2S_PORT"
"XMPP_HTTPS_PORT"
) )
sed -i --follow-symlinks '$a\' mailcow.conf sed -i --follow-symlinks '$a\' mailcow.conf
@ -409,6 +410,10 @@ for option in ${CONFIG_ARRAY[@]}; do
if ! grep -q ${option} mailcow.conf; then if ! grep -q ${option} mailcow.conf; then
echo "XMPP_S2S_PORT=5269" >> mailcow.conf echo "XMPP_S2S_PORT=5269" >> mailcow.conf
fi fi
elif [[ ${option} == "XMPP_HTTPS_PORT" ]]; then
if ! grep -q ${option} mailcow.conf; then
echo "XMPP_HTTPS_PORT=5443" >> mailcow.conf
fi
elif ! grep -q ${option} mailcow.conf; then elif ! grep -q ${option} mailcow.conf; then
echo "Adding new option \"${option}\" to mailcow.conf" echo "Adding new option \"${option}\" to mailcow.conf"
echo "${option}=n" >> mailcow.conf echo "${option}=n" >> mailcow.conf
@ -484,6 +489,8 @@ for container in "${MAILCOW_CONTAINERS[@]}"; do
docker rm -f "$container" 2> /dev/null docker rm -f "$container" 2> /dev/null
done done
[[ ! -f data/conf/nginx/ejabberd.conf ]] && mv data/conf/nginx/ejabberd.conf data/conf/nginx/ZZZ-ejabberd.conf
# Silently fixing remote url from andryyy to mailcow # Silently fixing remote url from andryyy to mailcow
git remote set-url origin https://github.com/mailcow/mailcow-dockerized git remote set-url origin https://github.com/mailcow/mailcow-dockerized
echo -e "\e[32mCommitting current status...\e[0m" echo -e "\e[32mCommitting current status...\e[0m"