diff options
author | Quentin Dufour <quentin@dufour.io> | 2021-02-01 07:48:50 +0100 |
---|---|---|
committer | Quentin Dufour <quentin@dufour.io> | 2021-02-01 07:48:50 +0100 |
commit | cb69a1123cc36c792cb0993ae46c3700a7391a62 (patch) | |
tree | 02845fb5b4e8216875942dba0e4c949fc87cc5ed /app/jitsi/build | |
parent | c2960f75b7725e19e5c9366268fd8664ffc5fcac (diff) | |
download | infrastructure-cb69a1123cc36c792cb0993ae46c3700a7391a62.tar.gz infrastructure-cb69a1123cc36c792cb0993ae46c3700a7391a62.zip |
Stabilize build scripts
Diffstat (limited to 'app/jitsi/build')
6 files changed, 150 insertions, 32 deletions
diff --git a/app/jitsi/build/jitsi-conference-focus/0001-Remove-broken-command-line-args-parameters-setting.patch b/app/jitsi/build/jitsi-conference-focus/0001-Remove-broken-command-line-args-parameters-setting.patch new file mode 100644 index 0000000..14d48c5 --- /dev/null +++ b/app/jitsi/build/jitsi-conference-focus/0001-Remove-broken-command-line-args-parameters-setting.patch @@ -0,0 +1,91 @@ +From 3da458fc04560e8ddd597f7910c4f53b714d58ab Mon Sep 17 00:00:00 2001 +From: Quentin Dufour <quentin@dufour.io> +Date: Mon, 1 Feb 2021 06:53:21 +0100 +Subject: [PATCH] Remove broken command line args parameters setting + +--- + src/main/java/org/jitsi/jicofo/Main.java | 61 ------------------------ + 1 file changed, 61 deletions(-) + +diff --git a/src/main/java/org/jitsi/jicofo/Main.java b/src/main/java/org/jitsi/jicofo/Main.java +index 558d1b3..59e04bb 100644 +--- a/src/main/java/org/jitsi/jicofo/Main.java ++++ b/src/main/java/org/jitsi/jicofo/Main.java +@@ -50,7 +50,6 @@ public static void main(String[] args) + logger.error("An uncaught exception occurred in thread=" + t, e)); + + setupMetaconfigLogger(); +- setSystemProperties(args); + JitsiConfig.Companion.reloadNewConfig(); + + // Make sure that passwords are not printed by ConfigurationService +@@ -80,66 +79,6 @@ public static void main(String[] args) + JicofoServices.jicofoServicesSingleton = null; + } + +- /** +- * Read the command line arguments and env variables, and set the corresponding system properties used for +- * configuration of the XMPP component and client connections. +- */ +- private static void setSystemProperties(String[] args) +- throws ParseException +- { +- CmdLine cmdLine = new CmdLine(); +- +- // We may end execution here if one of required arguments is missing +- cmdLine.parse(args); +- +- // XMPP host/domain +- String host; +- String componentDomain; +- // Try to get domain, can be null after this call(we'll fix that later) +- componentDomain = cmdLine.getOptionValue("domain"); +- // Host name +- host = cmdLine.getOptionValue("--host", componentDomain == null ? "localhost" : componentDomain); +- // Try to fix component domain +- if (isBlank(componentDomain)) +- { +- componentDomain = host; +- } +- if (componentDomain != null) +- { +- // For backward compat, the "--domain" command line argument controls the domain for the XMPP component +- // as well as XMPP client connection. +- System.setProperty(XmppClientConnectionConfig.legacyXmppDomainPropertyName, componentDomain); +- } +- if (host != null) +- { +- // For backward compat, the "--host" command line argument controls the hostname for the XMPP component +- // as well as XMPP client connection. +- System.setProperty(XmppClientConnectionConfig.legacyHostnamePropertyName, host); +- } +- +- // XMPP client connection +- String focusDomain = cmdLine.getOptionValue("--user_domain"); +- String focusUserName = cmdLine.getOptionValue("--user_name"); +- String focusPassword = cmdLine.getOptionValue("--user_password"); +- if (isBlank(focusPassword)) +- { +- focusPassword = System.getenv("JICOFO_AUTH_PASSWORD"); +- } +- +- if (focusDomain != null) +- { +- System.setProperty(XmppClientConnectionConfig.legacyDomainPropertyName, focusDomain); +- } +- if (focusUserName != null) +- { +- System.setProperty(XmppClientConnectionConfig.legacyUsernamePropertyName, focusUserName); +- } +- if (isNotBlank(focusPassword)) +- { +- System.setProperty(XmppClientConnectionConfig.legacyPasswordPropertyName, focusPassword); +- } +- } +- + private static void setupMetaconfigLogger() + { + org.jitsi.utils.logging2.Logger configLogger = new org.jitsi.utils.logging2.LoggerImpl("org.jitsi.config"); +-- +2.25.1 + diff --git a/app/jitsi/build/jitsi-conference-focus/Dockerfile b/app/jitsi/build/jitsi-conference-focus/Dockerfile index cb6b127..0e11df9 100644 --- a/app/jitsi/build/jitsi-conference-focus/Dockerfile +++ b/app/jitsi/build/jitsi-conference-focus/Dockerfile @@ -3,25 +3,15 @@ FROM fedora:33 AS builder # unzip is required when executing the mvn package command RUN dnf install -y java-latest-openjdk-headless maven git unzip -ARG PREFIXV -ARG VERSION - -# Create a cache -RUN git clone https://github.com/superboum/jicofo && \ - cd jicofo && \ - mvn package -DskipTests -Dassembly.skipAssembly=false +ARG JICOFO_TAG +RUN git clone --depth 1 --branch $JICOFO_TAG https://github.com/jitsi/jicofo WORKDIR jicofo -# Ensure latest version is compiled -RUN git pull && \ - git checkout 194795ed2a3ca08c25322c99f1ee89d134e1e1a2 - -# Wild patch for debug, once it will work we can safely remove this dead code -#COPY jicofogit/src/main/kotlin/org/jitsi/jicofo/JicofoServices.kt src/main/kotlin/org/jitsi/jicofo/JicofoServices.kt -#COPY jicofogit/src/main/java/org/jitsi/impl/protocol/xmpp/XmppProtocolProvider.java src/main/java/org/jitsi/impl/protocol/xmpp/XmppProtocolProvider.java +COPY *.patch . +RUN git apply 0001-Remove-broken-command-line-args-parameters-setting.patch +RUN mvn package -DskipTests -Dassembly.skipAssembly=false -RUN mvn package -DskipTests -Dassembly.skipAssembly=false && \ - unzip target/jicofo-1.1-SNAPSHOT-archive.zip && \ +RUN unzip target/jicofo-1.1-SNAPSHOT-archive.zip && \ mv jicofo-1.1-SNAPSHOT /srv/build FROM debian:bullseye diff --git a/app/jitsi/build/jitsi-conference-focus/jicofo b/app/jitsi/build/jitsi-conference-focus/jicofo index 2225e98..344b293 100755 --- a/app/jitsi/build/jitsi-conference-focus/jicofo +++ b/app/jitsi/build/jitsi-conference-focus/jicofo @@ -2,8 +2,13 @@ update-ca-certificates -f +if [ -z "${JICOFO_MEMORY}" ]; then + echo "You must set the env variable 'JICOFO_MEMORY'. eg. JICOFO_MEMORY=3072m" + exit 1 +fi + exec java \ - -Xmx400m \ + -Xmx${JICOFO_MEMORY} \ -XX:+HeapDumpOnOutOfMemoryError \ -XX:HeapDumpPath=/tmp \ -Djdk.tls.ephemeralDHKeySize=2048 \ diff --git a/app/jitsi/build/jitsi-videobridge/0001-Disable-legacy-parameters.patch b/app/jitsi/build/jitsi-videobridge/0001-Disable-legacy-parameters.patch new file mode 100644 index 0000000..69b83c0 --- /dev/null +++ b/app/jitsi/build/jitsi-videobridge/0001-Disable-legacy-parameters.patch @@ -0,0 +1,31 @@ +From b327e580ab83110cdb52bc1d11687a096b8fc1df Mon Sep 17 00:00:00 2001 +From: Quentin Dufour <quentin@dufour.io> +Date: Mon, 1 Feb 2021 07:16:50 +0100 +Subject: [PATCH] Disable legacy parameters + +--- + jvb/src/main/kotlin/org/jitsi/videobridge/Main.kt | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/jvb/src/main/kotlin/org/jitsi/videobridge/Main.kt b/jvb/src/main/kotlin/org/jitsi/videobridge/Main.kt +index df71f480..8f0ef9a5 100644 +--- a/jvb/src/main/kotlin/org/jitsi/videobridge/Main.kt ++++ b/jvb/src/main/kotlin/org/jitsi/videobridge/Main.kt +@@ -62,14 +62,6 @@ fun main(args: Array<String>) { + // to be passed. + System.setProperty("org.eclipse.jetty.util.log.class", "org.eclipse.jetty.util.log.JavaUtilLog") + +- // Before initializing the application programming interfaces (APIs) of +- // Jitsi Videobridge, set any System properties which they use and which +- // may be specified by the command-line arguments. +- System.setProperty( +- Videobridge.REST_API_PNAME, +- cmdLine.getOptionValue("--apis").contains(Videobridge.REST_API).toString() +- ) +- + // Reload the Typesafe config used by ice4j, because the original was initialized before the new system + // properties were set. + JitsiConfig.reloadNewConfig() +-- +2.25.1 + diff --git a/app/jitsi/build/jitsi-videobridge/Dockerfile b/app/jitsi/build/jitsi-videobridge/Dockerfile index 4a3d504..2a32946 100644 --- a/app/jitsi/build/jitsi-videobridge/Dockerfile +++ b/app/jitsi/build/jitsi-videobridge/Dockerfile @@ -1,19 +1,16 @@ FROM debian:buster AS builder -ARG PREFIXV -ARG VERSION - RUN apt-get update && \ - apt-get install -y wget unzip maven openjdk-11-jdk-headless + apt-get install -y git unzip maven openjdk-11-jdk-headless -RUN wget https://github.com/jitsi/jitsi-videobridge/archive/${PREFIXV}${VERSION}.zip -O jvb.zip +ARG JVB_TAG +RUN git clone --depth 1 --branch ${JVB_TAG} https://github.com/jitsi/jitsi-videobridge -RUN unzip jvb.zip && \ - mv jitsi-videobridge*${VERSION} jvb && \ - cd jvb && \ - mvn package -DskipTests && \ - ls jvb/target && \ - unzip jvb/target/jitsi-videobridge*.zip && \ +WORKDIR jitsi-videobridge +COPY *.patch . +RUN git apply 0001-Disable-legacy-parameters.patch +RUN mvn package -DskipTests +RUN unzip jvb/target/jitsi-videobridge*.zip && \ mv jitsi-videobridge-*-SNAPSHOT build FROM debian:buster @@ -21,7 +18,7 @@ FROM debian:buster RUN apt-get update && \ apt-get install -y openjdk-11-jre-headless curl -COPY --from=builder /jvb/build /usr/share/jvb +COPY --from=builder /jitsi-videobridge/build /usr/share/jvb COPY jvb_run /usr/local/bin/jvb_run CMD ["/usr/local/bin/jvb_run"] diff --git a/app/jitsi/build/jitsi-videobridge/jvb_run b/app/jitsi/build/jitsi-videobridge/jvb_run index 3a78c46..c82712c 100755 --- a/app/jitsi/build/jitsi-videobridge/jvb_run +++ b/app/jitsi/build/jitsi-videobridge/jvb_run @@ -9,10 +9,15 @@ if [ -z "${JITSI_NAT_PUBLIC_IP}" ]; then JITSI_NAT_PUBLIC_IP=$(curl https://ifconfig.me) fi +if [ -z "${JVB_MEMORY}" ]; then + echo "You must set the env variable 'JVB_MEMORY'. eg: JVB_MEMORY=3072m" + exit 1 +fi + echo "NAT config: ${JITSI_NAT_LOCAL_IP} -> ${JITSI_NAT_PUBLIC_IP}" exec java \ - -Xmx3072m \ + -Xmx${JVB_MEMORY} \ -XX:+UseConcMarkSweepGC \ -XX:+HeapDumpOnOutOfMemoryError \ -XX:HeapDumpPath=/tmp \ @@ -22,5 +27,4 @@ exec java \ -Dorg.ice4j.ice.harvest.NAT_HARVESTER_LOCAL_ADDRESS=${JITSI_NAT_LOCAL_IP} \ -Dorg.ice4j.ice.harvest.NAT_HARVESTER_PUBLIC_ADDRESS=${JITSI_NAT_PUBLIC_IP} \ -cp '/usr/share/jvb/jitsi-videobridge.jar:/usr/share/jvb/lib/*' \ - org.jitsi.videobridge.MainKt \ - --apis=rest,xmpp + org.jitsi.videobridge.MainKt |