diff --git a/services/blob/docker-base/Dockerfile b/services/blob/docker-base/Dockerfile --- a/services/blob/docker-base/Dockerfile +++ b/services/blob/docker-base/Dockerfile @@ -1,6 +1,6 @@ FROM commapp/backup-base:1.0 -COPY services/tunnelbroker/docker-base/contents /transferred +COPY services/blob/docker-base/contents /transferred RUN apt-get update && apt-get install -y libssl-dev && rm -rf /var/lib/apt/lists/* RUN /transferred/install_folly.sh diff --git a/services/docker-compose.yml b/services/docker-compose.yml --- a/services/docker-compose.yml +++ b/services/docker-compose.yml @@ -1,17 +1,8 @@ version: "3.9" services: - base: - build: base-image - image: commapp/services-base:1.0 - # tunnelbroker - tunnelbroker-base: - build: - dockerfile: services/tunnelbroker/docker-base/Dockerfile - context: ../ - image: commapp/tunnelbroker-base:2.0 tunnelbroker-server: build: - dockerfile: services/tunnelbroker/docker-server/Dockerfile + dockerfile: services/tunnelbroker/Dockerfile context: ../ args: - COMM_TEST_SERVICES=${COMM_TEST_SERVICES} @@ -44,12 +35,12 @@ - $HOME/.aws/credentials:/root/.aws/credentials:ro # blob blob-base: - build: + build: dockerfile: services/blob/docker-base/Dockerfile context: ../ image: commapp/blob-base:1.1 blob-server: - build: + build: dockerfile: services/blob/docker-server/Dockerfile context: ../ args: diff --git a/services/package.json b/services/package.json --- a/services/package.json +++ b/services/package.json @@ -4,17 +4,16 @@ "private": true, "license": "BSD-3-Clause", "scripts": { - "build-all": "./scripts/build_base_image.sh", - "build-base-image": "./scripts/build_base_image.sh base", - "build-tunnelbroker-base": "./scripts/build_base_image.sh tunnelbroker-base", + "build-all": "./scripts/build_base_image.sh && docker-compose build", + "build-base-image": "./scripts/build_base_image.sh", "run-tunnelbroker-service": "./scripts/run_server_image.sh tunnelbroker", "test-tunnelbroker-service": "./scripts/test_service.sh tunnelbroker", - "build-backup-base": "./scripts/build_base_image.sh backup-base", + "build-backup-base": "./scripts/build_base_image.sh && docker-compose build backup-base", "run-backup-service": "./scripts/run_server_image.sh backup", "test-backup-service": "./scripts/test_service.sh backup", "run-backup-service-dev-mode": "export COMM_SERVICES_DEV_MODE=1 && ./scripts/run_server_image.sh backup", "test-backup-service-dev-mode": "export COMM_SERVICES_DEV_MODE=1 && ./scripts/test_service.sh backup", - "build-blob-base": "./scripts/build_base_image.sh blob-base", + "build-blob-base": "./scripts/build_base_image.sh && docker-compose build blob-base", "run-blob-service": "./scripts/run_server_image.sh blob", "test-blob-service": "./scripts/test_service.sh blob", "run-blob-service-dev-mode": "export COMM_SERVICES_DEV_MODE=1 && ./scripts/run_server_image.sh blob", diff --git a/services/scripts/build_base_image.sh b/services/scripts/build_base_image.sh --- a/services/scripts/build_base_image.sh +++ b/services/scripts/build_base_image.sh @@ -2,4 +2,10 @@ set -e -docker-compose build $1 +if [ "$#" -gt 1 ]; then + echo "usage: $0 [TAG]" + exit 1 +fi + +tag=${1:-"1.0"} +docker build -t commapp/services-base:${tag} base-image diff --git a/services/tunnelbroker/.dockerignore b/services/tunnelbroker/.dockerignore new file mode 100644 --- /dev/null +++ b/services/tunnelbroker/.dockerignore @@ -0,0 +1,2 @@ +docker/ +Dockerfile diff --git a/services/tunnelbroker/docker-server/contents/server/CMakeLists.txt b/services/tunnelbroker/CMakeLists.txt rename from services/tunnelbroker/docker-server/contents/server/CMakeLists.txt rename to services/tunnelbroker/CMakeLists.txt diff --git a/services/tunnelbroker/Dockerfile b/services/tunnelbroker/Dockerfile new file mode 100644 --- /dev/null +++ b/services/tunnelbroker/Dockerfile @@ -0,0 +1,41 @@ +FROM commapp/services-base:1.0 + +ENV SHELL=/bin/bash + +RUN apt-get update && apt-get install -y \ + libcurl4-openssl-dev \ + libssl-dev \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir /transferred/scripts +WORKDIR /transferred/scripts + +# Install SDKs +COPY services/tunnelbroker/docker/install_folly.sh . +RUN ./install_folly.sh + +COPY services/tunnelbroker/docker/install_aws_sdk.sh . +RUN ./install_aws_sdk.sh + +COPY services/tunnelbroker/docker/install_amqp_cpp.sh . +RUN ./install_amqp_cpp.sh + +COPY services/tunnelbroker/docker/install_cryptopp.sh . +RUN ./install_cryptopp.sh + +COPY services/tunnelbroker/docker/install_libuv.sh . +RUN ./install_libuv.sh + +ARG COMM_TEST_SERVICES +ENV COMM_TEST_SERVICES=${COMM_TEST_SERVICES} + +WORKDIR /transferred + +COPY native/cpp/CommonCpp/grpc/protos/tunnelbroker.proto protos/tunnelbroker.proto +COPY services/tunnelbroker/docker/ scripts/ +COPY services/tunnelbroker/ . + +RUN scripts/build_server.sh + +CMD if [ "$COMM_TEST_SERVICES" -eq 1 ]; then scripts/run_tests.sh; else scripts/run_server.sh; fi diff --git a/services/tunnelbroker/docker-server/contents/server/build.sh b/services/tunnelbroker/build.sh rename from services/tunnelbroker/docker-server/contents/server/build.sh rename to services/tunnelbroker/build.sh diff --git a/services/tunnelbroker/docker-base/Dockerfile b/services/tunnelbroker/docker-base/Dockerfile deleted file mode 100644 --- a/services/tunnelbroker/docker-base/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM commapp/services-base:1.0 - -ENV SHELL=/bin/bash - -COPY services/tunnelbroker/docker-base/contents /transferred - -RUN apt-get update && apt-get install -y \ - libcurl4-openssl-dev \ - libssl-dev \ - zlib1g-dev \ - && rm -rf /var/lib/apt/lists/* - -# Install SDKs -RUN /transferred/install_folly.sh -RUN /transferred/install_aws_sdk.sh -RUN /transferred/install_amqp_cpp.sh -RUN /transferred/install_cryptopp.sh -RUN /transferred/install_libuv.sh - -CMD /bin/bash diff --git a/services/tunnelbroker/docker-server/Dockerfile b/services/tunnelbroker/docker-server/Dockerfile deleted file mode 100644 --- a/services/tunnelbroker/docker-server/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM commapp/tunnelbroker-base:2.0 - -ARG COMM_TEST_SERVICES - -ENV SHELL=/bin/bash -ENV COMM_TEST_SERVICES=${COMM_TEST_SERVICES} - -COPY services/tunnelbroker/docker-server/contents /transferred -COPY native/cpp/CommonCpp/grpc/protos/tunnelbroker.proto /transferred/server/protos/tunnelbroker.proto - -RUN /transferred/build_server.sh - -CMD if [ "$COMM_TEST_SERVICES" -eq 1 ]; then /transferred/run_tests.sh; else /transferred/run_server.sh; fi diff --git a/services/tunnelbroker/docker-server/contents/run_server.sh b/services/tunnelbroker/docker-server/contents/run_server.sh deleted file mode 100755 --- a/services/tunnelbroker/docker-server/contents/run_server.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -set -e - -/transferred/server/cmake/build/bin/tunnelbroker diff --git a/services/tunnelbroker/docker-server/contents/run_tests.sh b/services/tunnelbroker/docker-server/contents/run_tests.sh deleted file mode 100755 --- a/services/tunnelbroker/docker-server/contents/run_tests.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -set -e - -pushd transferred/server/cmake/build -make test ARGS="-V" -popd # transferred/server/cmake/build diff --git a/services/tunnelbroker/docker-server/contents/build_server.sh b/services/tunnelbroker/docker/build_server.sh rename from services/tunnelbroker/docker-server/contents/build_server.sh rename to services/tunnelbroker/docker/build_server.sh --- a/services/tunnelbroker/docker-server/contents/build_server.sh +++ b/services/tunnelbroker/docker/build_server.sh @@ -5,8 +5,6 @@ # folly hack - https://github.com/facebook/folly/pull/1231 sed -i 's/#if __has_include()/#if __has_include()/g' /usr/lib/folly/folly/detail/Demangle.h -pushd transferred/server - rm -rf lib mkdir lib pushd lib @@ -23,5 +21,3 @@ ./generate.sh ./build.sh - -popd # transferred/server diff --git a/services/tunnelbroker/docker-base/contents/install_amqp_cpp.sh b/services/tunnelbroker/docker/install_amqp_cpp.sh rename from services/tunnelbroker/docker-base/contents/install_amqp_cpp.sh rename to services/tunnelbroker/docker/install_amqp_cpp.sh diff --git a/services/tunnelbroker/docker-base/contents/install_aws_sdk.sh b/services/tunnelbroker/docker/install_aws_sdk.sh rename from services/tunnelbroker/docker-base/contents/install_aws_sdk.sh rename to services/tunnelbroker/docker/install_aws_sdk.sh diff --git a/services/tunnelbroker/docker-base/contents/install_cryptopp.sh b/services/tunnelbroker/docker/install_cryptopp.sh rename from services/tunnelbroker/docker-base/contents/install_cryptopp.sh rename to services/tunnelbroker/docker/install_cryptopp.sh diff --git a/services/tunnelbroker/docker-base/contents/install_folly.sh b/services/tunnelbroker/docker/install_folly.sh rename from services/tunnelbroker/docker-base/contents/install_folly.sh rename to services/tunnelbroker/docker/install_folly.sh diff --git a/services/tunnelbroker/docker-base/contents/install_libuv.sh b/services/tunnelbroker/docker/install_libuv.sh rename from services/tunnelbroker/docker-base/contents/install_libuv.sh rename to services/tunnelbroker/docker/install_libuv.sh diff --git a/services/tunnelbroker/docker/run_server.sh b/services/tunnelbroker/docker/run_server.sh new file mode 100755 --- /dev/null +++ b/services/tunnelbroker/docker/run_server.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +set -e + +cmake/build/bin/tunnelbroker diff --git a/services/tunnelbroker/docker/run_tests.sh b/services/tunnelbroker/docker/run_tests.sh new file mode 100755 --- /dev/null +++ b/services/tunnelbroker/docker/run_tests.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +pushd cmake/build +make test ARGS="-V" +popd # cmake/build diff --git a/services/tunnelbroker/docker-server/contents/server/generate.sh b/services/tunnelbroker/generate.sh rename from services/tunnelbroker/docker-server/contents/server/generate.sh rename to services/tunnelbroker/generate.sh diff --git a/services/tunnelbroker/docker-server/contents/server/src/Amqp/AmqpManager.h b/services/tunnelbroker/src/Amqp/AmqpManager.h rename from services/tunnelbroker/docker-server/contents/server/src/Amqp/AmqpManager.h rename to services/tunnelbroker/src/Amqp/AmqpManager.h diff --git a/services/tunnelbroker/docker-server/contents/server/src/Amqp/AmqpManager.cpp b/services/tunnelbroker/src/Amqp/AmqpManager.cpp rename from services/tunnelbroker/docker-server/contents/server/src/Amqp/AmqpManager.cpp rename to services/tunnelbroker/src/Amqp/AmqpManager.cpp diff --git a/services/tunnelbroker/docker-server/contents/server/src/Constants.h b/services/tunnelbroker/src/Constants.h rename from services/tunnelbroker/docker-server/contents/server/src/Constants.h rename to services/tunnelbroker/src/Constants.h diff --git a/services/tunnelbroker/docker-server/contents/server/src/Database/DatabaseEntitiesTools.h b/services/tunnelbroker/src/Database/DatabaseEntitiesTools.h rename from services/tunnelbroker/docker-server/contents/server/src/Database/DatabaseEntitiesTools.h rename to services/tunnelbroker/src/Database/DatabaseEntitiesTools.h diff --git a/services/tunnelbroker/docker-server/contents/server/src/Database/DatabaseEntitiesTools.cpp b/services/tunnelbroker/src/Database/DatabaseEntitiesTools.cpp rename from services/tunnelbroker/docker-server/contents/server/src/Database/DatabaseEntitiesTools.cpp rename to services/tunnelbroker/src/Database/DatabaseEntitiesTools.cpp diff --git a/services/tunnelbroker/docker-server/contents/server/src/Database/DatabaseManager.h b/services/tunnelbroker/src/Database/DatabaseManager.h rename from services/tunnelbroker/docker-server/contents/server/src/Database/DatabaseManager.h rename to services/tunnelbroker/src/Database/DatabaseManager.h diff --git a/services/tunnelbroker/docker-server/contents/server/src/Database/DatabaseManager.cpp b/services/tunnelbroker/src/Database/DatabaseManager.cpp rename from services/tunnelbroker/docker-server/contents/server/src/Database/DatabaseManager.cpp rename to services/tunnelbroker/src/Database/DatabaseManager.cpp diff --git a/services/tunnelbroker/docker-server/contents/server/src/Database/DeviceSessionItem.h b/services/tunnelbroker/src/Database/DeviceSessionItem.h rename from services/tunnelbroker/docker-server/contents/server/src/Database/DeviceSessionItem.h rename to services/tunnelbroker/src/Database/DeviceSessionItem.h diff --git a/services/tunnelbroker/docker-server/contents/server/src/Database/DeviceSessionItem.cpp b/services/tunnelbroker/src/Database/DeviceSessionItem.cpp rename from services/tunnelbroker/docker-server/contents/server/src/Database/DeviceSessionItem.cpp rename to services/tunnelbroker/src/Database/DeviceSessionItem.cpp diff --git a/services/tunnelbroker/docker-server/contents/server/src/Database/Item.h b/services/tunnelbroker/src/Database/Item.h rename from services/tunnelbroker/docker-server/contents/server/src/Database/Item.h rename to services/tunnelbroker/src/Database/Item.h diff --git a/services/tunnelbroker/docker-server/contents/server/src/Database/MessageItem.h b/services/tunnelbroker/src/Database/MessageItem.h rename from services/tunnelbroker/docker-server/contents/server/src/Database/MessageItem.h rename to services/tunnelbroker/src/Database/MessageItem.h diff --git a/services/tunnelbroker/docker-server/contents/server/src/Database/MessageItem.cpp b/services/tunnelbroker/src/Database/MessageItem.cpp rename from services/tunnelbroker/docker-server/contents/server/src/Database/MessageItem.cpp rename to services/tunnelbroker/src/Database/MessageItem.cpp diff --git a/services/tunnelbroker/docker-server/contents/server/src/Database/PublicKeyItem.h b/services/tunnelbroker/src/Database/PublicKeyItem.h rename from services/tunnelbroker/docker-server/contents/server/src/Database/PublicKeyItem.h rename to services/tunnelbroker/src/Database/PublicKeyItem.h diff --git a/services/tunnelbroker/docker-server/contents/server/src/Database/PublicKeyItem.cpp b/services/tunnelbroker/src/Database/PublicKeyItem.cpp rename from services/tunnelbroker/docker-server/contents/server/src/Database/PublicKeyItem.cpp rename to services/tunnelbroker/src/Database/PublicKeyItem.cpp diff --git a/services/tunnelbroker/docker-server/contents/server/src/Database/SessionSignItem.h b/services/tunnelbroker/src/Database/SessionSignItem.h rename from services/tunnelbroker/docker-server/contents/server/src/Database/SessionSignItem.h rename to services/tunnelbroker/src/Database/SessionSignItem.h diff --git a/services/tunnelbroker/docker-server/contents/server/src/Database/SessionSignItem.cpp b/services/tunnelbroker/src/Database/SessionSignItem.cpp rename from services/tunnelbroker/docker-server/contents/server/src/Database/SessionSignItem.cpp rename to services/tunnelbroker/src/Database/SessionSignItem.cpp diff --git a/services/tunnelbroker/docker-server/contents/server/src/DeliveryBroker/DeliveryBroker.h b/services/tunnelbroker/src/DeliveryBroker/DeliveryBroker.h rename from services/tunnelbroker/docker-server/contents/server/src/DeliveryBroker/DeliveryBroker.h rename to services/tunnelbroker/src/DeliveryBroker/DeliveryBroker.h diff --git a/services/tunnelbroker/docker-server/contents/server/src/DeliveryBroker/DeliveryBroker.cpp b/services/tunnelbroker/src/DeliveryBroker/DeliveryBroker.cpp rename from services/tunnelbroker/docker-server/contents/server/src/DeliveryBroker/DeliveryBroker.cpp rename to services/tunnelbroker/src/DeliveryBroker/DeliveryBroker.cpp diff --git a/services/tunnelbroker/docker-server/contents/server/src/DeliveryBroker/DeliveryBrokerEntites.h b/services/tunnelbroker/src/DeliveryBroker/DeliveryBrokerEntites.h rename from services/tunnelbroker/docker-server/contents/server/src/DeliveryBroker/DeliveryBrokerEntites.h rename to services/tunnelbroker/src/DeliveryBroker/DeliveryBrokerEntites.h diff --git a/services/tunnelbroker/docker-server/contents/server/src/Service/TunnelbrokerServiceImpl.h b/services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.h rename from services/tunnelbroker/docker-server/contents/server/src/Service/TunnelbrokerServiceImpl.h rename to services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.h diff --git a/services/tunnelbroker/docker-server/contents/server/src/Service/TunnelbrokerServiceImpl.cpp b/services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp rename from services/tunnelbroker/docker-server/contents/server/src/Service/TunnelbrokerServiceImpl.cpp rename to services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp diff --git a/services/tunnelbroker/docker-server/contents/server/src/Tools/AwsTools.h b/services/tunnelbroker/src/Tools/AwsTools.h rename from services/tunnelbroker/docker-server/contents/server/src/Tools/AwsTools.h rename to services/tunnelbroker/src/Tools/AwsTools.h diff --git a/services/tunnelbroker/docker-server/contents/server/src/Tools/AwsTools.cpp b/services/tunnelbroker/src/Tools/AwsTools.cpp rename from services/tunnelbroker/docker-server/contents/server/src/Tools/AwsTools.cpp rename to services/tunnelbroker/src/Tools/AwsTools.cpp diff --git a/services/tunnelbroker/docker-server/contents/server/src/Tools/ConfigManager.h b/services/tunnelbroker/src/Tools/ConfigManager.h rename from services/tunnelbroker/docker-server/contents/server/src/Tools/ConfigManager.h rename to services/tunnelbroker/src/Tools/ConfigManager.h diff --git a/services/tunnelbroker/docker-server/contents/server/src/Tools/ConfigManager.cpp b/services/tunnelbroker/src/Tools/ConfigManager.cpp rename from services/tunnelbroker/docker-server/contents/server/src/Tools/ConfigManager.cpp rename to services/tunnelbroker/src/Tools/ConfigManager.cpp diff --git a/services/tunnelbroker/docker-server/contents/server/src/Tools/CryptoTools.h b/services/tunnelbroker/src/Tools/CryptoTools.h rename from services/tunnelbroker/docker-server/contents/server/src/Tools/CryptoTools.h rename to services/tunnelbroker/src/Tools/CryptoTools.h diff --git a/services/tunnelbroker/docker-server/contents/server/src/Tools/CryptoTools.cpp b/services/tunnelbroker/src/Tools/CryptoTools.cpp rename from services/tunnelbroker/docker-server/contents/server/src/Tools/CryptoTools.cpp rename to services/tunnelbroker/src/Tools/CryptoTools.cpp diff --git a/services/tunnelbroker/docker-server/contents/server/src/Tools/Tools.h b/services/tunnelbroker/src/Tools/Tools.h rename from services/tunnelbroker/docker-server/contents/server/src/Tools/Tools.h rename to services/tunnelbroker/src/Tools/Tools.h diff --git a/services/tunnelbroker/docker-server/contents/server/src/Tools/Tools.cpp b/services/tunnelbroker/src/Tools/Tools.cpp rename from services/tunnelbroker/docker-server/contents/server/src/Tools/Tools.cpp rename to services/tunnelbroker/src/Tools/Tools.cpp diff --git a/services/tunnelbroker/docker-server/contents/server/src/server.cpp b/services/tunnelbroker/src/server.cpp rename from services/tunnelbroker/docker-server/contents/server/src/server.cpp rename to services/tunnelbroker/src/server.cpp diff --git a/services/tunnelbroker/docker-server/contents/server/test/TunnelBrokerTest.cpp b/services/tunnelbroker/test/TunnelBrokerTest.cpp rename from services/tunnelbroker/docker-server/contents/server/test/TunnelBrokerTest.cpp rename to services/tunnelbroker/test/TunnelBrokerTest.cpp