diff --git a/services/docker-compose.yml b/services/docker-compose.yml index b601bea33..ffdec7be9 100644 --- a/services/docker-compose.yml +++ b/services/docker-compose.yml @@ -1,97 +1,98 @@ version: "3.9" networks: services-net: name: services-net volumes: localstack: services: # tunnelbroker tunnelbroker-server: depends_on: - localstack - rabbitmq build: dockerfile: services/tunnelbroker/Dockerfile context: ../ args: - COMM_TEST_SERVICES=${COMM_TEST_SERVICES} image: commapp/tunnelbroker-server:0.2 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 + - ./tunnelbroker/tunnelbroker-dev.ini:/root/tunnelbroker/tunnelbroker-dev.ini:ro # backup backup-server: depends_on: - localstack networks: - services-net build: 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 ports: - "${COMM_SERVICES_PORT_BACKUP}:50051" volumes: - $HOME/.aws/credentials:/root/.aws/credentials:ro # blob blob-server: depends_on: - localstack 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 ports: - "${COMM_SERVICES_PORT_BLOB}:50051" volumes: - $HOME/.aws/credentials:/root/.aws/credentials:ro # identity identity-server: depends_on: - localstack networks: - services-net build: dockerfile: services/identity/Dockerfile context: ../ image: commapp/identity-server:0.1 ports: - "${COMM_SERVICES_PORT_IDENTITY}:50051" # localstack localstack: image: localstack/localstack hostname: localstack ports: - "4566:4566" environment: - SERVICES=s3,dynamodb - DATA_DIR=/tmp/localstack - HOSTNAME_EXTERNAL=localstack volumes: - localstack:/tmp/localstack networks: - services-net # RabbitMQ rabbitmq: image: rabbitmq:3-management hostname: rabbitmq ports: - "5672:5672" - "5671:5671" - "15672:15672" environment: - RABBITMQ_DEFAULT_USER=comm - RABBITMQ_DEFAULT_PASS=comm networks: - services-net diff --git a/services/tunnelbroker/src/Constants.h b/services/tunnelbroker/src/Constants.h index cccaefe17..04cecb97e 100644 --- a/services/tunnelbroker/src/Constants.h +++ b/services/tunnelbroker/src/Constants.h @@ -1,57 +1,59 @@ #pragma once #include #include #include namespace comm { namespace network { // AWS DynamoDB const std::string DEVICE_SESSIONS_TABLE_NAME = "tunnelbroker-device-sessions"; const std::string DEVICE_SESSIONS_VERIFICATION_MESSAGES_TABLE_NAME = "tunnelbroker-verification-messages"; const std::string DEVICE_PUBLIC_KEY_TABLE_NAME = "tunnelbroker-public-keys"; const std::string MESSAGES_TABLE_NAME = "tunnelbroker-messages"; // Sessions const size_t SIGNATURE_REQUEST_LENGTH = 64; const size_t SESSION_ID_LENGTH = 64; const size_t SESSION_RECORD_TTL = 30 * 24 * 3600; // 30 days const size_t SESSION_SIGN_RECORD_TTL = 24 * 3600; // 24 hours const std::regex SESSION_ID_FORMAT_REGEX( "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"); // gRPC Server const std::string SERVER_LISTEN_ADDRESS = "0.0.0.0:50051"; // AMQP (RabbitMQ) const std::string AMQP_FANOUT_EXCHANGE_NAME = "allBrokers"; // Message broker queue message TTL const size_t AMQP_MESSAGE_TTL = 300 * 1000; // 5 min // queue TTL in case of no consumers (tunnelbroker is down) const size_t AMQP_QUEUE_TTL = 24 * 3600 * 1000; // 24 hours // routing message headers name const std::string AMQP_HEADER_FROM_DEVICEID = "fromDeviceID"; const std::string AMQP_HEADER_TO_DEVICEID = "toDeviceID"; const std::string AMQP_HEADER_MESSAGEID = "messageID"; const int64_t AMQP_SHORTEST_RECONNECTION_ATTEMPT_INTERVAL = 1000 * 60; // 1 min // DeviceID const size_t DEVICEID_CHAR_LENGTH = 64; const std::regex DEVICEID_FORMAT_REGEX( "^(ks|mobile|web):[a-zA-Z0-9]{" + std::to_string(DEVICEID_CHAR_LENGTH) + "}$"); // Config const std::string CONFIG_FILE_PATH = std::string(std::getenv("HOME")) + "/tunnelbroker/tunnelbroker.ini"; +const std::string DEV_CONFIG_FILE_PATH = + std::string(std::getenv("HOME")) + "/tunnelbroker/tunnelbroker-dev.ini"; // DeliveryBroker const size_t DELIVERY_BROKER_MAX_QUEUE_SIZE = 100; // Database messages TTL const size_t MESSAGE_RECORD_TTL = 300 * 24 * 60 * 60; // 300 days } // namespace network } // namespace comm diff --git a/services/tunnelbroker/tunnelbroker-dev.ini b/services/tunnelbroker/tunnelbroker-dev.ini new file mode 100644 index 000000000..8076a7f70 --- /dev/null +++ b/services/tunnelbroker/tunnelbroker-dev.ini @@ -0,0 +1,11 @@ +[tunnelbroker] +instance-id = tunnelbroker1 +[keyserver] +default_keyserver_id = ks:256 +[amqp] +uri = amqp://comm:comm@rabbitmq/ +[dynamodb] +sessions_table_name = tunnelbroker-device-sessions-test +sessions_verification_table_name = tunnelbroker-verification-messages-test +sessions_public_key_table_name = tunnelbroker-public-keys-test +messages_table_name = tunnelbroker-messages-test