core: rework templating

Use frep [0] which uses the Go templating capabilities.

[0]: https://github.com/subchen/frep
This commit is contained in:
Saúl Ibarra Corretgé 2018-08-09 21:29:58 +02:00
parent 36d98c9e17
commit 1010c71b33
8 changed files with 26 additions and 37 deletions

View File

@ -4,6 +4,7 @@ ARG JITSI_RELEASE=stable
ADD https://github.com/just-containers/s6-overlay/releases/download/v1.21.4.0/s6-overlay-amd64.tar.gz /tmp/s6-overlay.tar.gz
ADD https://download.jitsi.org/jitsi-key.gpg.key /tmp/jitsi.key
ADD https://github.com/subchen/frep/releases/download/v1.3.3/frep-1.3.3-linux-amd64 /usr/bin/frep
COPY rootfs /
@ -18,6 +19,7 @@ RUN \
apt-dpkg-wrap apt-get update && \
apt-dpkg-wrap apt-get dist-upgrade -y && \
apt-dpkg-wrap apt-get autoremove -y --purge gnupg && \
apt-cleanup
apt-cleanup && \
chmod +x /usr/bin/frep
ENTRYPOINT [ "/init" ]

4
base/rootfs/usr/bin/tpl Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
exec frep $1:-

View File

@ -1,5 +1,5 @@
org.jitsi.videobridge.AUTHORIZED_SOURCE_REGEXP=${JICOFO_AUTH_USER}@${XMPP_AUTH_DOMAIN}/.*
org.jitsi.videobridge.AUTHORIZED_SOURCE_REGEXP={{ .Env.JICOFO_AUTH_USER }}@{{ .Env.XMPP_AUTH_DOMAIN }}/.*
org.jitsi.videobridge.TCP_HARVESTER_PORT=4443
org.ice4j.ice.harvest.STUN_MAPPING_HARVESTER_ADDRESSES=${JVB_STUN_SERVERS}
org.ice4j.ice.harvest.STUN_MAPPING_HARVESTER_ADDRESSES={{ .Env.JVB_STUN_SERVERS }}
org.ice4j.ice.harvest.NAT_HARVESTER_LOCAL_ADDRESS=
org.ice4j.ice.harvest.NAT_HARVESTER_PUBLIC_ADDRESS=

View File

@ -1,13 +1,7 @@
#!/usr/bin/with-contenv bash
if [[ ! -f /config/sip-communicator.properties ]]; then
cp /defaults/sip-communicator.properties /config
sed -i \
-e "s,\${XMPP_DOMAIN},$XMPP_DOMAIN,g" \
-e "s,\${XMPP_AUTH_DOMAIN},$XMPP_AUTH_DOMAIN,g" \
-e "s,\${JICOFO_AUTH_USER},$JICOFO_AUTH_USER,g" \
-e "s#\${JVB_STUN_SERVERS}#$JVB_STUN_SERVERS#g" \
/config/sip-communicator.properties
tpl /defaults/sip-communicator.properties > /config/sip-communicator.properties
fi
if [[ ! -f /config/logging.properties ]]; then

View File

@ -1,10 +1,10 @@
admins = { "${JICOFO_AUTH_USER}@${XMPP_AUTH_DOMAIN}" }
admins = { "{{ .Env.JICOFO_AUTH_USER }}@{{ .Env.XMPP_AUTH_DOMAIN }}" }
VirtualHost "${XMPP_DOMAIN}"
VirtualHost "{{ .Env.XMPP_DOMAIN }}"
authentication = "anonymous"
ssl = {
key = "/config/certs/${XMPP_DOMAIN}.key";
certificate = "/config/certs/${XMPP_DOMAIN}.crt";
key = "/config/certs/{{ .Env.XMPP_DOMAIN }}.key";
certificate = "/config/certs/{{ .Env.XMPP_DOMAIN }}.crt";
}
modules_enabled = {
"bosh";
@ -14,19 +14,19 @@ VirtualHost "${XMPP_DOMAIN}"
c2s_require_encryption = false
VirtualHost "${XMPP_AUTH_DOMAIN}"
VirtualHost "{{ .Env.XMPP_AUTH_DOMAIN }}"
ssl = {
key = "/config/certs/${XMPP_AUTH_DOMAIN}.key";
certificate = "/config/certs/${XMPP_AUTH_DOMAIN}.crt";
key = "/config/certs/{{ .Env.XMPP_AUTH_DOMAIN }}.key";
certificate = "/config/certs/{{ .Env.XMPP_AUTH_DOMAIN }}.crt";
}
authentication = "internal_plain"
Component "${XMPP_MUC_DOMAIN}" "muc"
Component "{{ .Env.XMPP_MUC_DOMAIN }}" "muc"
storage = "none"
Component "jitsi-videobridge.${XMPP_DOMAIN}"
component_secret = "${JVB_COMPONENT_SECRET}"
Component "jitsi-videobridge.{{ .Env.XMPP_DOMAIN }}"
component_secret = "{{ .Env.JVB_COMPONENT_SECRET }}"
Component "focus.${XMPP_DOMAIN}"
component_secret = "${JICOFO_COMPONENT_SECRET}"
Component "focus.{{ .Env.XMPP_DOMAIN }}"
component_secret = "{{ .Env.JICOFO_COMPONENT_SECRET }}"

View File

@ -9,14 +9,7 @@ fi
if [[ ! -f $PROSODY_CFG ]]; then
cp -r /defaults/* /config
sed -i \
-e "s,\${XMPP_DOMAIN},$XMPP_DOMAIN,g" \
-e "s,\${XMPP_AUTH_DOMAIN},$XMPP_AUTH_DOMAIN,g" \
-e "s,\${XMPP_MUC_DOMAIN},$XMPP_MUC_DOMAIN,g" \
-e "s,\${JICOFO_AUTH_USER},$JICOFO_AUTH_USER,g" \
-e "s,\${JICOFO_COMPONENT_SECRET},$JICOFO_COMPONENT_SECRET,g" \
-e "s,\${JVB_COMPONENT_SECRET},$JVB_COMPONENT_SECRET,g" \
/config/conf.d/jitsi-meet.cfg.lua
tpl /defaults/conf.d/jitsi-meet.cfg.lua > /config/conf.d/jitsi-meet.cfg.lua
prosodyctl --config $PROSODY_CFG register $JICOFO_AUTH_USER $XMPP_AUTH_DOMAIN $JICOFO_AUTH_PASSWORD
fi

View File

@ -31,8 +31,8 @@ server {
# BOSH
location /http-bind {
proxy_pass ${XMPP_BOSH_URL_BASE}/http-bind;
proxy_pass {{ .Env.XMPP_BOSH_URL_BASE }}/http-bind;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host ${XMPP_DOMAIN};
proxy_set_header Host {{ .Env.XMPP_DOMAIN }};
}
}

View File

@ -13,11 +13,7 @@ if [[ ! -f /config/nginx/nginx.conf ]]; then
fi
if [[ ! -f /config/nginx/site-confs/default ]]; then
cp /defaults/default /config/nginx/site-confs/default
sed -i \
-e "s,\${XMPP_DOMAIN},$XMPP_DOMAIN,g" \
-e "s,\${XMPP_BOSH_URL_BASE},$XMPP_BOSH_URL_BASE,g" \
/config/nginx/site-confs/default
tpl /defaults/default > /config/nginx/site-confs/default
fi
if [[ ! -f /config/config.js ]]; then