From bd89a8b1fb72facecd6b0ec17207f509fc574700 Mon Sep 17 00:00:00 2001 From: Finn Date: Wed, 16 Oct 2019 21:28:31 -0700 Subject: [PATCH] Update for Signal Server 2.55 --- docker-compose.yaml => docker-compose.yml | 18 +++++- migrate-and-start-server.sh | 6 ++ ...message-table-in-accountdb-migration.patch | 4 +- signal-server-patches/remove-sqs.patch | 4 +- signal-server-patches/remove-twilio.patch | 59 ++++--------------- signal-server.Dockerfile | 13 ++-- 6 files changed, 44 insertions(+), 60 deletions(-) rename docker-compose.yaml => docker-compose.yml (53%) create mode 100755 migrate-and-start-server.sh diff --git a/docker-compose.yaml b/docker-compose.yml similarity index 53% rename from docker-compose.yaml rename to docker-compose.yml index 67521ab..b63c16f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yml @@ -13,12 +13,28 @@ services: POSTGRES_USER: signal expose: - 5432 + volumes: + - "./postgres-data:/var/lib/postgresql/data" + adminer: + image: adminer + restart: always + ports: + - "127.0.0.1:8083:8080" + testhelper: + image: registry.git.callpipe.com/finn/signald-test-infrastructure/testhelper:master + restart: always + build: + context: . + dockerfile: testhelper.Dockerfile + environment: + DB: "host=db user=signal dbname=signal password=password sslmode=disable" + ports: + - "127.0.0.1:8082:8082" signal: image: registry.git.callpipe.com/finn/signald-test-infrastructure/signal-server:2.02 build: context: . dockerfile: signal-server.Dockerfile - command: server /etc/signal-server.yaml volumes: - "./signal-server.yaml:/etc/signal-server.yaml" ports: diff --git a/migrate-and-start-server.sh b/migrate-and-start-server.sh new file mode 100755 index 0000000..f769d27 --- /dev/null +++ b/migrate-and-start-server.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -exu +java -jar /usr/share/TextSecureServer.jar abusedb migrate /etc/signal-server.yaml +java -jar /usr/share/TextSecureServer.jar accountdb migrate /etc/signal-server.yaml +java -jar /usr/share/TextSecureServer.jar messagedb migrate /etc/signal-server.yaml +java -jar /usr/share/TextSecureServer.jar server /etc/signal-server.yaml diff --git a/signal-server-patches/no-message-table-in-accountdb-migration.patch b/signal-server-patches/no-message-table-in-accountdb-migration.patch index 4d68f0e..2571fb9 100644 --- a/signal-server-patches/no-message-table-in-accountdb-migration.patch +++ b/signal-server-patches/no-message-table-in-accountdb-migration.patch @@ -1,7 +1,7 @@ diff --git a/src/main/resources/accountsdb.xml b/src/main/resources/accountsdb.xml index f2a9c31..7090051 100644 ---- a/src/main/resources/accountsdb.xml -+++ b/src/main/resources/accountsdb.xml +--- a/service/src/main/resources/accountsdb.xml ++++ b/service/src/main/resources/accountsdb.xml @@ -119,29 +119,6 @@ diff --git a/signal-server-patches/remove-sqs.patch b/signal-server-patches/remove-sqs.patch index a26475a..a2b6125 100644 --- a/signal-server-patches/remove-sqs.patch +++ b/signal-server-patches/remove-sqs.patch @@ -1,7 +1,7 @@ diff --git a/src/main/java/org/whispersystems/textsecuregcm/sqs/DirectoryQueue.java b/src/main/java/org/whispersystems/textsecuregcm/sqs/DirectoryQueue.java index bd05995..0d12f57 100644 ---- a/src/main/java/org/whispersystems/textsecuregcm/sqs/DirectoryQueue.java -+++ b/src/main/java/org/whispersystems/textsecuregcm/sqs/DirectoryQueue.java +--- a/service/src/main/java/org/whispersystems/textsecuregcm/sqs/DirectoryQueue.java ++++ b/service/src/main/java/org/whispersystems/textsecuregcm/sqs/DirectoryQueue.java @@ -66,26 +66,7 @@ public class DirectoryQueue { } diff --git a/signal-server-patches/remove-twilio.patch b/signal-server-patches/remove-twilio.patch index 4d4c6a1..ba430b3 100644 --- a/signal-server-patches/remove-twilio.patch +++ b/signal-server-patches/remove-twilio.patch @@ -1,56 +1,17 @@ -diff --git a/src/main/java/org/whispersystems/textsecuregcm/sms/SmsSender.java b/src/main/java/org/whispersystems/textsecuregcm/sms/SmsSender.java -index 8b62e0f..0e68bb0 100644 ---- a/src/main/java/org/whispersystems/textsecuregcm/sms/SmsSender.java -+++ b/src/main/java/org/whispersystems/textsecuregcm/sms/SmsSender.java -@@ -16,15 +16,12 @@ - */ - package org.whispersystems.textsecuregcm.sms; - -- --import com.twilio.sdk.TwilioRestException; - import org.slf4j.Logger; - import org.slf4j.LoggerFactory; - - import java.io.IOException; - import java.util.Optional; - --@SuppressWarnings("OptionalUsedAsFieldOrParameterType") - public class SmsSender { - - static final String SMS_IOS_VERIFICATION_TEXT = "Your Signal verification code: %s\n\nOr tap: sgnl://verify/%s"; -@@ -33,11 +30,8 @@ public class SmsSender { - - private final Logger logger = LoggerFactory.getLogger(SmsSender.class); - -- private final TwilioSmsSender twilioSender; -+ public SmsSender(TwilioSmsSender twilioSender) { - -- public SmsSender(TwilioSmsSender twilioSender) -- { -- this.twilioSender = twilioSender; - } - - public void deliverSmsVerification(String destination, Optional clientType, String verificationCode) -@@ -48,20 +42,12 @@ public class SmsSender { +diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/sms/SmsSender.java b/service/src/main/java/org/whispersystems/textsecuregcm/sms/SmsSender.java +index 55773a3..c3c705b 100644 +--- a/service/src/main/java/org/whispersystems/textsecuregcm/sms/SmsSender.java ++++ b/service/src/main/java/org/whispersystems/textsecuregcm/sms/SmsSender.java +@@ -42,10 +42,10 @@ public class SmsSender { destination = "+521" + destination.substring(3); } -- try { -- twilioSender.deliverSmsVerification(destination, clientType, verificationCode); -- } catch (TwilioRestException e) { -- logger.info("Twilio SMS Failed: " + e.getErrorMessage()); -- } -+ logger.info("Sending SMS verification code to " + destination + ": " + verificationCode); +- twilioSender.deliverSmsVerification(destination, clientType, verificationCode); ++ // twilioSender.deliverSmsVerification(destination, clientType, verificationCode); } - public void deliverVoxVerification(String destination, String verificationCode) - throws IOException - { -- try { -- twilioSender.deliverVoxVerification(destination, verificationCode); -- } catch (TwilioRestException e) { -- logger.info("Twilio Vox Failed: " + e.getErrorMessage()); -- } -+ logger.info("Sending voice verification code to " + destination + ": " + verificationCode); + public void deliverVoxVerification(String destination, String verificationCode, Optional locale) { +- twilioSender.deliverVoxVerification(destination, verificationCode, locale); ++ // twilioSender.deliverVoxVerification(destination, verificationCode, locale); } } diff --git a/signal-server.Dockerfile b/signal-server.Dockerfile index ada478b..31db6e7 100644 --- a/signal-server.Dockerfile +++ b/signal-server.Dockerfile @@ -1,15 +1,16 @@ -FROM debian:9 as build -RUN apt-get update && apt-get install -y openjdk-8-jdk-headless maven git +FROM debian:buster as build +RUN apt-get update && apt-get install -y openjdk-11-jdk-headless maven git RUN git -C /usr/local/src clone https://github.com/signalapp/Signal-Server WORKDIR /usr/local/src/Signal-Server COPY signal-server-patches /tmp/signal-server-patches RUN /tmp/signal-server-patches/apply-patches.sh RUN mvn install -DskipTests -FROM debian:9 -RUN apt-get update && apt-get install -y openjdk-8-jre-headless -COPY --from=build /usr/local/src/Signal-Server/target/TextSecureServer-2.02.jar /usr/share/TextSecureServer.jar +FROM debian:buster +RUN apt-get update && apt-get install -y openjdk-11-jre-headless +COPY --from=build /usr/local/src/Signal-Server/service/target/TextSecureServer-2.55.jar /usr/share/TextSecureServer.jar +COPY migrate-and-start-server.sh /usr/bin/migrate-and-start-server RUN useradd signal RUN chown -R signal /usr/share/TextSecureServer.jar USER signal -ENTRYPOINT ["java", "-jar", "/usr/share/TextSecureServer.jar"] +CMD ["/usr/bin/migrate-and-start-server"]