[mailcow] Move ejabberd site to last available site
parent
63160890e0
commit
8c6b512f05
|
@ -71,6 +71,7 @@ cat <<EOF > /ejabberd/ejabberd_macros.yml
|
|||
# Autogenerated by mailcow
|
||||
define_macro:
|
||||
'MAILCOW_HOSTNAME': "${MAILCOW_HOSTNAME}"
|
||||
'EJABBERD_HTTPS': ${XMPP_HTTPS_PORT}
|
||||
EOF
|
||||
|
||||
# Set open_basedir
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
FROM php:7.4-fpm-alpine3.11
|
||||
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
|
||||
# Mailparse is pulled from master branch
|
||||
#ENV MAILPARSE_PECL 3.0.2
|
||||
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 \
|
||||
aspell-dev \
|
||||
|
|
|
@ -172,8 +172,8 @@ fi
|
|||
# Fix permissions for global filters
|
||||
chown -R 82:82 /global_sieve/*
|
||||
|
||||
[[ ! -f /etc/nginx/conf.d/ejabberd.conf ]] && echo '# Autogenerated by mailcow' > /etc/nginx/conf.d/ejabberd.conf
|
||||
chown 82:82 /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/ZZZ-ejabberd.conf
|
||||
|
||||
# Run hooks
|
||||
for file in /hooks/*; do
|
||||
|
|
|
@ -53,13 +53,11 @@ listen:
|
|||
module: ejabberd_s2s_in
|
||||
max_stanza_size: 524288
|
||||
-
|
||||
port: 5443
|
||||
port: EJABBERD_HTTPS
|
||||
ip: "::"
|
||||
module: ejabberd_http
|
||||
tls: true
|
||||
request_handlers:
|
||||
/admin: ejabberd_web_admin
|
||||
/api: mod_http_api
|
||||
/captcha: ejabberd_captcha
|
||||
/upload: mod_http_upload
|
||||
/ws: ejabberd_http_ws
|
||||
|
@ -69,6 +67,7 @@ listen:
|
|||
module: ejabberd_http
|
||||
request_handlers:
|
||||
/admin: ejabberd_web_admin
|
||||
/api: mod_http_api
|
||||
-
|
||||
module: ejabberd_http
|
||||
port: 5281
|
||||
|
@ -161,7 +160,6 @@ modules:
|
|||
mod_fail2ban: {}
|
||||
mod_http_api: {}
|
||||
mod_http_upload:
|
||||
put_url: https://@HOST@:5443/upload
|
||||
docroot: /var/www/upload
|
||||
custom_headers:
|
||||
"Access-Control-Allow-Origin": "https://@HOST@"
|
||||
|
|
|
@ -6,7 +6,7 @@ function xmpp_control($_action, $_data = null) {
|
|||
case 'reload':
|
||||
$curl = curl_init();
|
||||
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_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|
||||
|
@ -32,7 +32,7 @@ function xmpp_control($_action, $_data = null) {
|
|||
case 'restart':
|
||||
$curl = curl_init();
|
||||
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_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|
||||
|
@ -82,7 +82,7 @@ function xmpp_control($_action, $_data = null) {
|
|||
) as $stat => $url) {
|
||||
$curl = curl_init();
|
||||
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_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|
||||
|
@ -128,10 +128,10 @@ function xmpp_rebuild_configs() {
|
|||
|
||||
touch('/ejabberd/ejabberd_hosts.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_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)) {
|
||||
// Handle hosts file
|
||||
|
@ -165,12 +165,12 @@ function xmpp_rebuild_configs() {
|
|||
fclose($acl_handle);
|
||||
|
||||
// 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) {
|
||||
ftruncate($site_handle, 0);
|
||||
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) {
|
||||
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);
|
||||
if (isset($response['type']) && $response['type'] == "success") {
|
||||
$_SESSION['return'][] = array(
|
||||
|
|
|
@ -101,7 +101,7 @@ services:
|
|||
- rspamd
|
||||
|
||||
php-fpm-mailcow:
|
||||
image: mailcow/phpfpm:1.71
|
||||
image: mailcow/phpfpm:1.72
|
||||
command: "php-fpm -d date.timezone=${TZ} -d expose_php=0"
|
||||
depends_on:
|
||||
- redis-mailcow
|
||||
|
@ -527,7 +527,7 @@ services:
|
|||
- olefy
|
||||
|
||||
ejabberd-mailcow:
|
||||
image: mailcow/ejabberd:1.2
|
||||
image: mailcow/ejabberd:1.3
|
||||
volumes:
|
||||
- ./data/conf/ejabberd/ejabberd.yml:/home/ejabberd/conf/ejabberd.yml:z
|
||||
- xmpp-vol-1:/home/ejabberd/database:z
|
||||
|
@ -547,6 +547,7 @@ services:
|
|||
- MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
|
||||
- MASTER=${MASTER:-y}
|
||||
- IPV4_NETWORK=${IPV4_NETWORK:-172.22.1}
|
||||
- XMPP_HTTPS_PORT=${XMPP_HTTPS_PORT:-5443}
|
||||
- DBNAME=${DBNAME}
|
||||
- DBUSER=${DBUSER}
|
||||
- DBPASS=${DBPASS}
|
||||
|
|
|
@ -172,6 +172,7 @@ SOLR_PORT=127.0.0.1:18983
|
|||
REDIS_PORT=127.0.0.1:7654
|
||||
XMPP_C2S_PORT=5222
|
||||
XMPP_S2S_PORT=5269
|
||||
XMPP_HTTPS_PORT=5443
|
||||
|
||||
# Your timezone
|
||||
# See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for a list of timezones
|
||||
|
|
|
@ -220,6 +220,7 @@ CONFIG_ARRAY=(
|
|||
"MAILCOW_PASS_SCHEME"
|
||||
"XMPP_C2S_PORT"
|
||||
"XMPP_S2S_PORT"
|
||||
"XMPP_HTTPS_PORT"
|
||||
)
|
||||
|
||||
sed -i --follow-symlinks '$a\' mailcow.conf
|
||||
|
@ -409,6 +410,10 @@ for option in ${CONFIG_ARRAY[@]}; do
|
|||
if ! grep -q ${option} mailcow.conf; then
|
||||
echo "XMPP_S2S_PORT=5269" >> mailcow.conf
|
||||
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
|
||||
echo "Adding new option \"${option}\" to mailcow.conf"
|
||||
echo "${option}=n" >> mailcow.conf
|
||||
|
@ -484,6 +489,8 @@ for container in "${MAILCOW_CONTAINERS[@]}"; do
|
|||
docker rm -f "$container" 2> /dev/null
|
||||
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
|
||||
git remote set-url origin https://github.com/mailcow/mailcow-dockerized
|
||||
echo -e "\e[32mCommitting current status...\e[0m"
|
||||
|
|
Loading…
Reference in New Issue