This document provides instructions to locally test, build and deploy individual Flatline components.
To develop Flatline locally, ensure submodules are initialized and fetched:
git clone --recurse-submodules [email protected]:mollyim/flatline-platform.git
# Alternatively, for an existing repository:
# git submodule update --init --recursiveTesting and building this project relies on Docker.
The Java compoments are intended to be built with the Temurin 24 JDK.
For the Maven builds to succeed, ensure that JAVA_HOME points to a valid Temurin 24 JDK installation.
Requires a FoundationDB client.
cd flatline-whisper-service
./mvnw clean verify -e \
-pl '!integration-tests' -Dsurefire.failIfNoSpecifiedTests=false -Dtest=\
\!org.whispersystems.textsecuregcm.controllers.VerificationControllerTest,\
\!org.whispersystems.textsecuregcm.controllers.SubscriptionControllerTest,\
\!org.whispersystems.textsecuregcm.registration.IdentityTokenCallCredentialsTestIntegration tests are excluded as they require an existing environment in which to run.
Tests for features that are disabled for the prototype are be excluded.
cd flatline-storage-service
./mvnw clean testcd flatline-registration-service
./mvnw clean testTo test C dependencies:
cd flatline-contact-discovery-service
make -C c docker_tests
make -C c docker_valgrindsTo run minimal tests without Intel SGX:
cd flatline-contact-discovery-service
./mvnw verify -Dtest=\
\!org.signal.cdsi.enclave.**,\
\!org.signal.cdsi.IntegrationTest,\
\!org.signal.cdsi.JsonMapperInjectionIntegrationTest,\
\!org.signal.cdsi.limits.redis.RedisLeakyBucketRateLimiterIntegrationTest,\
\!org.signal.cdsi.util.ByteSizeValidatorTestTo run all tests with Intel SGX:
cd flatline-contact-discovery-service
# Set up Intel SGX on Ubuntu 22.04.
sudo ./c/docker/sgx_runtime_libraries.sh
./mvnw verifyThis component is built in Rust and requires its toolchain.
cd flatline-calling-service
cargo testFor Java components, this stage will build and locally store container images with Jib, in addition to the JAR artifacts.
For other components, the provided Dockerfiles will be used instead.
cd flatline-whisper-service
./mvnw clean deploy \
-Pexclude-spam-filter -Denv=dev -DskipTests \
-Djib.to.image="flatline-whisper-service:dev"cd flatline-storage-service
./mvnw clean package \
-Pdocker-deploy -Denv=dev -DskipTests \
-Djib.to.image="flatline-storage-service:dev"The env property is used as a prefix to fetch the relevant configuration files from storage-service/config.
cd flatline-registration-service
./mvnw clean package \
-Denv=dev -DskipTests \
-Djib.to.image="flatline-registration-service:dev"As configured for this prototype, the verification code is always the last six digits of the phone number.
cd flatline-contact-discovery-service
./mvnw package \
-Dpackaging=docker -DskipTests \
-Djib.to.image="flatline-contact-discovery-service:dev"cd flatline-calling-service
TARGET_CPU=skylake # The target CPU family used to run the component.
docker build . -f frontend/Dockerfile \
--build-arg rust_flags=-Ctarget-cpu=$TARGET_CPU \
-t flatline-calling-service-frontend:dev
docker build . -f backend/Dockerfile \
--build-arg rust_flags=-Ctarget-cpu=$TARGET_CPU \
-t flatline-calling-service-backend:devThe component should run on the target CPU family and others that support its features.
Kubernetes expects container images to be served from a container registry.
You can deploy a simple container registry with the Distribution Registry container image.
For example, to deploy an insecure registry for local testing:
docker run -d \
-p 5000:5000 \
--restart=always \
--name registry \
-v /tmp/registry:/var/lib/registry \
registry:3When building with Maven, push the resulting container images to a registry. For example:
# Whisper Service
(
cd flatline-whisper-service && \
./mvnw -e \
deploy \
-Pexclude-spam-filter \
-Denv=dev \
-DskipTests \
-Djib.goal=build \
-Djib.to.image=localhost:5000/flatline-whisper-service:dev \
-Djib.allowInsecureRegistries=true
)
# Storage Service
(
cd flatline-storage-service && \
./mvnw -e \
clean package \
-Pdocker-deploy \
-Denv=dev \
-DskipTests \
-Djib.goal=build \
-Djib.to.image=localhost:5000/flatline-storage-service:dev \
-Djib.allowInsecureRegistries=true
)
# Registration Service
(
cd flatline-registration-service && \
./mvnw -e \
clean package \
-Denv=dev \
-DskipTests \
-Djib.goal=build \
-Djib.to.image=localhost:5000/flatline-registration-service:dev \
-Djib.allowInsecureRegistries=true
)
# Contact Discovery Service
(
cd flatline-contact-discovery-service && \
./mvnw -e \
deploy \
-Dpackaging=docker \
-DskipTests \
-Djib.to.image=localhost:5000/flatline-contact-discovery-service:dev \
-Djib.allowInsecureRegistries=true
)
# Calling Service
(
cd flatline-calling-service
docker build . -f frontend/Dockerfile \
--build-arg rust_flags=-Ctarget-cpu=skylake \
-t localhost:5000/flatline-calling-service-frontend:dev
docker push localhost:5000/flatline-calling-service-frontend:dev
docker build . -f backend/Dockerfile \
--build-arg rust_flags=-Ctarget-cpu=skylake \
-t localhost:5000/flatline-calling-service-backend:dev
docker push localhost:5000/flatline-calling-service-backend:dev
)Once the images are on the registry, override the Helm image values to reference these images.
For example, to do this for every core Flatline component, create local.yaml with the following:
whisperService:
image:
repository: localhost:5000/flatline-whisper-service
tag: dev
storageService:
image:
repository: localhost:5000/flatline-storage-service
tag: dev
registrationService:
image:
repository: localhost:5000/flatline-registration-service
tag: dev
contactDiscoveryService:
image:
repository: localhost:5000/flatline-contact-discovery-service
tag: dev
callingServiceFrontend:
image:
repository: localhost:5000/flatline-calling-service-frontend
tag: dev
callingServiceBackend:
image:
repository: localhost:5000/flatline-calling-service-backend
tag: devFinally, upgrade the Helm release to use these custom image values:
helm upgrade -f local.yaml $HELM_RELEASE ./charts/flatline