diff --git a/services/backup/.dockerignore b/services/backup/.dockerignore new file mode 100644 index 000000000..33d495689 --- /dev/null +++ b/services/backup/.dockerignore @@ -0,0 +1,2 @@ +docker/ +Dockerfile diff --git a/services/backup/docker-server/contents/server/CMakeLists.txt b/services/backup/CMakeLists.txt similarity index 100% rename from services/backup/docker-server/contents/server/CMakeLists.txt rename to services/backup/CMakeLists.txt diff --git a/services/backup/Dockerfile b/services/backup/Dockerfile new file mode 100644 index 000000000..914c278b8 --- /dev/null +++ b/services/backup/Dockerfile @@ -0,0 +1,21 @@ +FROM commapp/services-base:1.1 + +RUN apt-get update && \ + apt-get install -y uuid-dev && \ + rm -rf /var/lib/apt/lists/* + +ARG COMM_TEST_SERVICES +ARG COMM_SERVICES_DEV_MODE + +ENV COMM_TEST_SERVICES=${COMM_TEST_SERVICES} +ENV COMM_SERVICES_DEV_MODE=${COMM_SERVICES_DEV_MODE} + +WORKDIR /transferred + +COPY native/cpp/CommonCpp/grpc/protos/backup.proto native/cpp/CommonCpp/grpc/protos/blob.proto protos/ +COPY services/backup/docker/ scripts/ +COPY services/backup/ . + +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/backup/docker-server/contents/server/cmake-components/folly.cmake b/services/backup/cmake-components/folly.cmake similarity index 100% rename from services/backup/docker-server/contents/server/cmake-components/folly.cmake rename to services/backup/cmake-components/folly.cmake diff --git a/services/backup/docker-server/contents/server/cmake-components/grpc.cmake b/services/backup/cmake-components/grpc.cmake similarity index 100% rename from services/backup/docker-server/contents/server/cmake-components/grpc.cmake rename to services/backup/cmake-components/grpc.cmake diff --git a/services/backup/docker-base/Dockerfile b/services/backup/docker-base/Dockerfile deleted file mode 100644 index 32d0f1789..000000000 --- a/services/backup/docker-base/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM commapp/services-base:1.1 - -ENV SHELL=/bin/bash - -RUN apt-get update && apt-get install -y uuid-dev && rm -rf /var/lib/apt/lists/* - -CMD /bin/bash diff --git a/services/backup/docker-server/Dockerfile b/services/backup/docker-server/Dockerfile deleted file mode 100644 index b4e059172..000000000 --- a/services/backup/docker-server/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM commapp/backup-base:1.2 - -ARG COMM_TEST_SERVICES -ARG COMM_SERVICES_DEV_MODE - -ENV SHELL=/bin/bash -ENV COMM_TEST_SERVICES=${COMM_TEST_SERVICES} -ENV COMM_SERVICES_DEV_MODE=${COMM_SERVICES_DEV_MODE} - -COPY services/backup/docker-server/contents /transferred -COPY native/cpp/CommonCpp/grpc/protos/backup.proto /transferred/server/protos/backup.proto -COPY native/cpp/CommonCpp/grpc/protos/blob.proto /transferred/server/protos/blob.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/backup/docker-server/contents/run_server.sh b/services/backup/docker-server/contents/run_server.sh deleted file mode 100755 index 3b9ef6c07..000000000 --- a/services/backup/docker-server/contents/run_server.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -set -e - -/transferred/server/cmake/build/bin/backup diff --git a/services/backup/docker-server/contents/run_tests.sh b/services/backup/docker-server/contents/run_tests.sh deleted file mode 100755 index 1e4de081f..000000000 --- a/services/backup/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/backup/docker-server/contents/server/build.sh b/services/backup/docker/build.sh similarity index 100% rename from services/backup/docker-server/contents/server/build.sh rename to services/backup/docker/build.sh diff --git a/services/backup/docker-server/contents/build_server.sh b/services/backup/docker/build_server.sh similarity index 83% rename from services/backup/docker-server/contents/build_server.sh rename to services/backup/docker/build_server.sh index b99faa771..9ed5c8706 100755 --- a/services/backup/docker-server/contents/build_server.sh +++ b/services/backup/docker/build_server.sh @@ -1,27 +1,23 @@ #!/bin/bash set -e # 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 ln -s /usr/lib/folly ln -s /usr/lib/glog ln -s /usr/lib/double-conversion popd # lib rm -rf _generated mkdir _generated rm -rf cmake/build mkdir -p cmake/build -./generate.sh -./build.sh - -popd # /transferred/server +scripts/generate.sh +scripts/build.sh diff --git a/services/backup/docker-server/contents/server/generate.sh b/services/backup/docker/generate.sh similarity index 100% rename from services/backup/docker-server/contents/server/generate.sh rename to services/backup/docker/generate.sh diff --git a/services/backup/docker/run_server.sh b/services/backup/docker/run_server.sh new file mode 100755 index 000000000..0cbd90677 --- /dev/null +++ b/services/backup/docker/run_server.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +set -e + +cmake/build/bin/backup diff --git a/services/backup/docker/run_tests.sh b/services/backup/docker/run_tests.sh new file mode 100755 index 000000000..1fae22919 --- /dev/null +++ b/services/backup/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/backup/docker-server/contents/server/src/AwsTools.cpp b/services/backup/src/AwsTools.cpp similarity index 100% rename from services/backup/docker-server/contents/server/src/AwsTools.cpp rename to services/backup/src/AwsTools.cpp diff --git a/services/backup/docker-server/contents/server/src/AwsTools.h b/services/backup/src/AwsTools.h similarity index 100% rename from services/backup/docker-server/contents/server/src/AwsTools.h rename to services/backup/src/AwsTools.h diff --git a/services/backup/docker-server/contents/server/src/BackupServiceImpl.cpp b/services/backup/src/BackupServiceImpl.cpp similarity index 100% rename from services/backup/docker-server/contents/server/src/BackupServiceImpl.cpp rename to services/backup/src/BackupServiceImpl.cpp diff --git a/services/backup/docker-server/contents/server/src/BackupServiceImpl.h b/services/backup/src/BackupServiceImpl.h similarity index 100% rename from services/backup/docker-server/contents/server/src/BackupServiceImpl.h rename to services/backup/src/BackupServiceImpl.h diff --git a/services/backup/docker-server/contents/server/src/Constants.h b/services/backup/src/Constants.h similarity index 100% rename from services/backup/docker-server/contents/server/src/Constants.h rename to services/backup/src/Constants.h diff --git a/services/backup/docker-server/contents/server/src/DatabaseEntities/BackupItem.cpp b/services/backup/src/DatabaseEntities/BackupItem.cpp similarity index 100% rename from services/backup/docker-server/contents/server/src/DatabaseEntities/BackupItem.cpp rename to services/backup/src/DatabaseEntities/BackupItem.cpp diff --git a/services/backup/docker-server/contents/server/src/DatabaseEntities/BackupItem.h b/services/backup/src/DatabaseEntities/BackupItem.h similarity index 100% rename from services/backup/docker-server/contents/server/src/DatabaseEntities/BackupItem.h rename to services/backup/src/DatabaseEntities/BackupItem.h diff --git a/services/backup/docker-server/contents/server/src/DatabaseEntities/DatabaseEntitiesTools.h b/services/backup/src/DatabaseEntities/DatabaseEntitiesTools.h similarity index 100% rename from services/backup/docker-server/contents/server/src/DatabaseEntities/DatabaseEntitiesTools.h rename to services/backup/src/DatabaseEntities/DatabaseEntitiesTools.h diff --git a/services/backup/docker-server/contents/server/src/DatabaseEntities/Item.h b/services/backup/src/DatabaseEntities/Item.h similarity index 100% rename from services/backup/docker-server/contents/server/src/DatabaseEntities/Item.h rename to services/backup/src/DatabaseEntities/Item.h diff --git a/services/backup/docker-server/contents/server/src/DatabaseEntities/LogItem.cpp b/services/backup/src/DatabaseEntities/LogItem.cpp similarity index 100% rename from services/backup/docker-server/contents/server/src/DatabaseEntities/LogItem.cpp rename to services/backup/src/DatabaseEntities/LogItem.cpp diff --git a/services/backup/docker-server/contents/server/src/DatabaseEntities/LogItem.h b/services/backup/src/DatabaseEntities/LogItem.h similarity index 100% rename from services/backup/docker-server/contents/server/src/DatabaseEntities/LogItem.h rename to services/backup/src/DatabaseEntities/LogItem.h diff --git a/services/backup/docker-server/contents/server/src/DatabaseManager.cpp b/services/backup/src/DatabaseManager.cpp similarity index 100% rename from services/backup/docker-server/contents/server/src/DatabaseManager.cpp rename to services/backup/src/DatabaseManager.cpp diff --git a/services/backup/docker-server/contents/server/src/DatabaseManager.h b/services/backup/src/DatabaseManager.h similarity index 100% rename from services/backup/docker-server/contents/server/src/DatabaseManager.h rename to services/backup/src/DatabaseManager.h diff --git a/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientBidiReactorBase.h b/services/backup/src/Reactors/client/base-reactors/ClientBidiReactorBase.h similarity index 100% rename from services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientBidiReactorBase.h rename to services/backup/src/Reactors/client/base-reactors/ClientBidiReactorBase.h diff --git a/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientReadReactorBase.h b/services/backup/src/Reactors/client/base-reactors/ClientReadReactorBase.h similarity index 100% rename from services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientReadReactorBase.h rename to services/backup/src/Reactors/client/base-reactors/ClientReadReactorBase.h diff --git a/services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientWriteReactorBase.h b/services/backup/src/Reactors/client/base-reactors/ClientWriteReactorBase.h similarity index 100% rename from services/backup/docker-server/contents/server/src/Reactors/client/base-reactors/ClientWriteReactorBase.h rename to services/backup/src/Reactors/client/base-reactors/ClientWriteReactorBase.h diff --git a/services/backup/docker-server/contents/server/src/Reactors/client/blob/BlobGetClientReactor.h b/services/backup/src/Reactors/client/blob/BlobGetClientReactor.h similarity index 100% rename from services/backup/docker-server/contents/server/src/Reactors/client/blob/BlobGetClientReactor.h rename to services/backup/src/Reactors/client/blob/BlobGetClientReactor.h diff --git a/services/backup/docker-server/contents/server/src/Reactors/client/blob/BlobPutClientReactor.h b/services/backup/src/Reactors/client/blob/BlobPutClientReactor.h similarity index 100% rename from services/backup/docker-server/contents/server/src/Reactors/client/blob/BlobPutClientReactor.h rename to services/backup/src/Reactors/client/blob/BlobPutClientReactor.h diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/CreateNewBackupReactor.h b/services/backup/src/Reactors/server/CreateNewBackupReactor.h similarity index 100% rename from services/backup/docker-server/contents/server/src/Reactors/server/CreateNewBackupReactor.h rename to services/backup/src/Reactors/server/CreateNewBackupReactor.h diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/PullBackupReactor.h b/services/backup/src/Reactors/server/PullBackupReactor.h similarity index 100% rename from services/backup/docker-server/contents/server/src/Reactors/server/PullBackupReactor.h rename to services/backup/src/Reactors/server/PullBackupReactor.h diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/RecoverBackupKeyReactor.h b/services/backup/src/Reactors/server/RecoverBackupKeyReactor.h similarity index 100% rename from services/backup/docker-server/contents/server/src/Reactors/server/RecoverBackupKeyReactor.h rename to services/backup/src/Reactors/server/RecoverBackupKeyReactor.h diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/SendLogReactor.h b/services/backup/src/Reactors/server/SendLogReactor.h similarity index 100% rename from services/backup/docker-server/contents/server/src/Reactors/server/SendLogReactor.h rename to services/backup/src/Reactors/server/SendLogReactor.h diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerBidiReactorBase.h b/services/backup/src/Reactors/server/base-reactors/ServerBidiReactorBase.h similarity index 100% rename from services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerBidiReactorBase.h rename to services/backup/src/Reactors/server/base-reactors/ServerBidiReactorBase.h diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerReadReactorBase.h b/services/backup/src/Reactors/server/base-reactors/ServerReadReactorBase.h similarity index 100% rename from services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerReadReactorBase.h rename to services/backup/src/Reactors/server/base-reactors/ServerReadReactorBase.h diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerWriteReactorBase.h b/services/backup/src/Reactors/server/base-reactors/ServerWriteReactorBase.h similarity index 100% rename from services/backup/docker-server/contents/server/src/Reactors/server/base-reactors/ServerWriteReactorBase.h rename to services/backup/src/Reactors/server/base-reactors/ServerWriteReactorBase.h diff --git a/services/backup/docker-server/contents/server/src/Tools.cpp b/services/backup/src/Tools.cpp similarity index 100% rename from services/backup/docker-server/contents/server/src/Tools.cpp rename to services/backup/src/Tools.cpp diff --git a/services/backup/docker-server/contents/server/src/Tools.h b/services/backup/src/Tools.h similarity index 100% rename from services/backup/docker-server/contents/server/src/Tools.h rename to services/backup/src/Tools.h diff --git a/services/backup/docker-server/contents/server/src/grpc-client/ServiceBlobClient.h b/services/backup/src/grpc-client/ServiceBlobClient.h similarity index 100% rename from services/backup/docker-server/contents/server/src/grpc-client/ServiceBlobClient.h rename to services/backup/src/grpc-client/ServiceBlobClient.h diff --git a/services/backup/docker-server/contents/server/src/server.cpp b/services/backup/src/server.cpp similarity index 100% rename from services/backup/docker-server/contents/server/src/server.cpp rename to services/backup/src/server.cpp diff --git a/services/backup/docker-server/contents/server/test/BackupTest.cpp b/services/backup/test/BackupTest.cpp similarity index 100% rename from services/backup/docker-server/contents/server/test/BackupTest.cpp rename to services/backup/test/BackupTest.cpp diff --git a/services/backup/docker-server/contents/server/test/DatabaseManagerTest.cpp b/services/backup/test/DatabaseManagerTest.cpp similarity index 100% rename from services/backup/docker-server/contents/server/test/DatabaseManagerTest.cpp rename to services/backup/test/DatabaseManagerTest.cpp diff --git a/services/docker-compose.yml b/services/docker-compose.yml index d972f9e33..6b358c41f 100644 --- a/services/docker-compose.yml +++ b/services/docker-compose.yml @@ -1,68 +1,63 @@ version: "3.9" networks: services-net: name: services-net services: # tunnelbroker tunnelbroker-server: build: dockerfile: services/tunnelbroker/Dockerfile context: ../ args: - COMM_TEST_SERVICES=${COMM_TEST_SERVICES} image: commapp/tunnelbroker-server:0.2 container_name: tunnelbroker-server ports: - "${COMM_SERVICES_PORT_TUNNELBROKER}:50051" volumes: - $HOME/.aws/config:/root/.aws/config:ro - $HOME/.aws/credentials:/root/.aws/credentials:ro - ./tunnelbroker/tunnelbroker.ini:/root/tunnelbroker/tunnelbroker.ini:ro # backup - backup-base: - build: - dockerfile: services/backup/docker-base/Dockerfile - context: ../ - image: commapp/backup-base:1.2 backup-server: networks: - services-net build: - dockerfile: services/backup/docker-server/Dockerfile + dockerfile: services/backup/Dockerfile context: ../ args: - COMM_TEST_SERVICES=${COMM_TEST_SERVICES} - COMM_SERVICES_DEV_MODE=${COMM_SERVICES_DEV_MODE} image: commapp/backup-server:0.1 container_name: backup-server ports: - "${COMM_SERVICES_PORT_BACKUP}:50051" volumes: - $HOME/.aws/credentials:/root/.aws/credentials:ro # blob blob-server: networks: - services-net build: dockerfile: services/blob/Dockerfile context: ../ args: - COMM_TEST_SERVICES=${COMM_TEST_SERVICES} - COMM_SERVICES_DEV_MODE=${COMM_SERVICES_DEV_MODE} image: commapp/blob-server:0.1 container_name: blob-server ports: - "${COMM_SERVICES_PORT_BLOB}:50051" volumes: - $HOME/.aws/credentials:/root/.aws/credentials:ro # identity identity-server: networks: - services-net build: dockerfile: services/identity/Dockerfile context: ../ image: commapp/identity-server:0.1 container_name: identity-server ports: - "${COMM_SERVICES_PORT_IDENTITY}:50051"