diff --git a/services/backup/.dockerignore b/services/backup/.dockerignore new file mode 100644 --- /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 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 --- /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 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 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 --- 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 --- 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 --- 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 --- 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 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 rename from services/backup/docker-server/contents/build_server.sh rename to services/backup/docker/build_server.sh --- a/services/backup/docker-server/contents/build_server.sh +++ b/services/backup/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 @@ -21,7 +19,5 @@ 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 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 --- /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 --- /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.h b/services/backup/src/AwsTools.h 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/AwsTools.cpp b/services/backup/src/AwsTools.cpp 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/BackupServiceImpl.h b/services/backup/src/BackupServiceImpl.h 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/BackupServiceImpl.cpp b/services/backup/src/BackupServiceImpl.cpp 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/Constants.h b/services/backup/src/Constants.h 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.h b/services/backup/src/DatabaseEntities/BackupItem.h 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/BackupItem.cpp b/services/backup/src/DatabaseEntities/BackupItem.cpp 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/DatabaseEntitiesTools.h b/services/backup/src/DatabaseEntities/DatabaseEntitiesTools.h 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 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.h b/services/backup/src/DatabaseEntities/LogItem.h 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/DatabaseEntities/LogItem.cpp b/services/backup/src/DatabaseEntities/LogItem.cpp 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/DatabaseManager.h b/services/backup/src/DatabaseManager.h 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/DatabaseManager.cpp b/services/backup/src/DatabaseManager.cpp 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/Reactors/client/base-reactors/ClientBidiReactorBase.h b/services/backup/src/Reactors/client/base-reactors/ClientBidiReactorBase.h 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 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 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 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 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 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 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 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 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 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 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 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.h b/services/backup/src/Tools.h 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/Tools.cpp b/services/backup/src/Tools.cpp 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/grpc-client/ServiceBlobClient.h b/services/backup/src/grpc-client/ServiceBlobClient.h 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 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 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 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 --- a/services/docker-compose.yml +++ b/services/docker-compose.yml @@ -19,16 +19,11 @@ - $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}