diff --git a/broker/src/asapo_broker/server/server.go b/broker/src/asapo_broker/server/server.go index 1f8fe1ce51c14a516e4bd204b708590a41af403c..cc69db83fe47aa379794d2f3edfde231eb992b5b 100644 --- a/broker/src/asapo_broker/server/server.go +++ b/broker/src/asapo_broker/server/server.go @@ -42,7 +42,7 @@ type discoveryAPI struct { var discoveryService discoveryAPI func (api *discoveryAPI) GetMongoDbAddress() (string, error) { - resp, err := api.Client.Get(api.baseURL + "/mongo") + resp, err := api.Client.Get(api.baseURL + "/asapo-mongodb") if err != nil { return "", err } diff --git a/broker/src/asapo_broker/server/server_test.go b/broker/src/asapo_broker/server/server_test.go index fc602642e576a439fb14f2a5deb305f24a7413cb..39967ed7591e81cb5c6af5fe0dcb401cb1daaced 100644 --- a/broker/src/asapo_broker/server/server_test.go +++ b/broker/src/asapo_broker/server/server_test.go @@ -67,7 +67,7 @@ func TestInitDBWithAutoAddress(t *testing.T) { settings.DatabaseServer = "auto" mock_server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { - assert.Equal(t, req.URL.String(), "/mongo", "request string") + assert.Equal(t, req.URL.String(), "/asapo-mongodb", "request string") rw.Write([]byte(mongo_address)) })) defer mock_server.Close() @@ -85,7 +85,7 @@ func TestInitDBWithAutoAddress(t *testing.T) { func TestReconnectDB(t *testing.T) { mongo_address := "0.0.0.0:0000" mock_server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { - assert.Equal(t, req.URL.String(), "/mongo", "request string") + assert.Equal(t, req.URL.String(), "/asapo-mongodb", "request string") rw.Write([]byte(mongo_address)) })) discoveryService = discoveryAPI{mock_server.Client(), mock_server.URL} diff --git a/config/nomad/authorizer.nmd.in b/config/nomad/authorizer.nmd.in index 8e90882eaf4d9657c05a07466105f70e276133f8..dfd6072465d23f6deff1ba2b1b5694f6c6030be5 100644 --- a/config/nomad/authorizer.nmd.in +++ b/config/nomad/authorizer.nmd.in @@ -25,7 +25,7 @@ job "authorizer" { } service { - name = "authorizer" + name = "asapo-authorizer" port = "authorizer" check { name = "alive" diff --git a/config/nomad/discovery.nmd.in b/config/nomad/discovery.nmd.in index cf39f034849d0e93c1435e3bc4bed6f13cfdfe0f..760aed3c700405ec289b47de69c0dd37c4ba4730 100644 --- a/config/nomad/discovery.nmd.in +++ b/config/nomad/discovery.nmd.in @@ -25,12 +25,12 @@ job "discovery" { } service { - name = "discovery" + name = "asapo-discovery" port = "discovery" check { name = "alive" type = "http" - path = "/receivers" + path = "/asapo-receiver" interval = "10s" timeout = "2s" initial_status = "passing" diff --git a/config/nomad/file_transfer.nmd.in b/config/nomad/file_transfer.nmd.in index 2ff798a51180888984ab5b8660817551bb30f7f4..f9cdd712fecd507fc4ccbd38fea5670bb7e8f914 100644 --- a/config/nomad/file_transfer.nmd.in +++ b/config/nomad/file_transfer.nmd.in @@ -25,7 +25,7 @@ job "file_transfer" { } service { - name = "asapo-fts" + name = "asapo-file-transfer" port = "file_transfer" check { name = "alive" diff --git a/consumer/api/cpp/src/server_data_broker.cpp b/consumer/api/cpp/src/server_data_broker.cpp index 883f32b1e45d86414b6e8c114b30305178b85cce..f8de01a65ede77ce448210c16f58c1fdcf518963 100644 --- a/consumer/api/cpp/src/server_data_broker.cpp +++ b/consumer/api/cpp/src/server_data_broker.cpp @@ -14,8 +14,8 @@ using std::chrono::system_clock; namespace asapo { -const std::string ServerDataBroker::kBrokerServiceName = "broker"; -const std::string ServerDataBroker::kFileTransferServiceName = "fts"; +const std::string ServerDataBroker::kBrokerServiceName = "asapo-broker"; +const std::string ServerDataBroker::kFileTransferServiceName = "asapo-file-transfer"; Error GetNoDataResponseFromJson(const std::string& json_string, ConsumerErrorData* data) { JsonStringParser parser(json_string); @@ -598,7 +598,7 @@ Error ServerDataBroker::UpdateFolderTokenIfNeeded(bool ignore_existing) { RequestInfo ServerDataBroker::CreateFolderTokenRequest() const { RequestInfo ri; ri.host = endpoint_; - ri.api = "/authorizer/folder"; + ri.api = "/asapo-authorizer/folder"; ri.post = true; ri.body = "{\"Folder\":\"" + source_path_ + "\",\"BeamtimeId\":\"" + source_credentials_.beamtime_id + "\",\"Token\":\"" + diff --git a/consumer/api/cpp/unittests/test_server_broker.cpp b/consumer/api/cpp/unittests/test_server_broker.cpp index aba9bfe5ec1833e97f44af4de54150b8eade8247..00e26b4585b2629c5fef5e298a618bc055fc3bdf 100644 --- a/consumer/api/cpp/unittests/test_server_broker.cpp +++ b/consumer/api/cpp/unittests/test_server_broker.cpp @@ -320,7 +320,7 @@ TEST_F(ServerDataBrokerTests, GetImageReturnsWrongResponseFromHttpClient) { } TEST_F(ServerDataBrokerTests, GetImageReturnsIfBrokerAddressNotFound) { - EXPECT_CALL(mock_http_client, Get_t(HasSubstr(expected_server_uri + "/discovery/broker"), _, + EXPECT_CALL(mock_http_client, Get_t(HasSubstr(expected_server_uri + "/discovery/asapo-broker"), _, _)).Times(AtLeast(2)).WillRepeatedly(DoAll( SetArgPointee<1>(HttpCode::NotFound), SetArgPointee<2>(nullptr), @@ -333,7 +333,7 @@ TEST_F(ServerDataBrokerTests, GetImageReturnsIfBrokerAddressNotFound) { } TEST_F(ServerDataBrokerTests, GetImageReturnsIfBrokerUriEmpty) { - EXPECT_CALL(mock_http_client, Get_t(HasSubstr(expected_server_uri + "/discovery/broker"), _, + EXPECT_CALL(mock_http_client, Get_t(HasSubstr(expected_server_uri + "/discovery/asapo-broker"), _, _)).Times(AtLeast(2)).WillRepeatedly(DoAll( SetArgPointee<1>(HttpCode::OK), SetArgPointee<2>(nullptr), @@ -353,7 +353,7 @@ TEST_F(ServerDataBrokerTests, GetDoNotCallBrokerUriIfAlreadyFound) { data_broker->GetNext(&info, expected_group_id, nullptr); Mock::VerifyAndClearExpectations(&mock_http_client); - EXPECT_CALL(mock_http_client, Get_t(HasSubstr(expected_server_uri + "/discovery/broker"), _, _)).Times(0); + EXPECT_CALL(mock_http_client, Get_t(HasSubstr(expected_server_uri + "/discovery/asap-broker"), _, _)).Times(0); MockGet("error_response"); data_broker->GetNext(&info, expected_group_id, nullptr); } @@ -432,7 +432,7 @@ ACTION(AssignArg2) { TEST_F(ServerDataBrokerTests, GetNextRetriesIfConnectionHttpClientErrorUntilTimeout) { - EXPECT_CALL(mock_http_client, Get_t(HasSubstr(expected_server_uri + "/discovery/broker"), _, + EXPECT_CALL(mock_http_client, Get_t(HasSubstr(expected_server_uri + "/discovery/asapo-broker"), _, _)).Times(AtLeast(2)).WillRepeatedly(DoAll( SetArgPointee<1>(HttpCode::OK), SetArgPointee<2>(nullptr), diff --git a/deploy/asapo_services/scripts/asapo-fts.nmd.tpl b/deploy/asapo_services/scripts/asapo-fts.nmd.tpl index b3bd2c3063eb4f92c3651c99ded205bf4a2571f5..9e8f9a2c8bcf098ba6e592960655e401d4098cc3 100644 --- a/deploy/asapo_services/scripts/asapo-fts.nmd.tpl +++ b/deploy/asapo_services/scripts/asapo-fts.nmd.tpl @@ -1,4 +1,4 @@ -job "asapo-fts" { +job "asapo-file-transfer" { datacenters = ["dc1"] affinity { attribute = "$${meta.node_group}" @@ -13,8 +13,8 @@ job "asapo-fts" { auto_revert = false } - group "fts" { - count = ${n_fts} + group "file-transfer" { + count = ${n_file-transfer} restart { attempts = 2 interval = "3m" @@ -22,7 +22,7 @@ job "asapo-fts" { mode = "fail" } - task "fts" { + task "file-transfer" { driver = "docker" user = "${asapo_user}" config { @@ -49,15 +49,15 @@ job "asapo-fts" { resources { network { - port "fts" {} + port "file-transfer" {} } } service { - port = "fts" - name = "asapo-fts" + port = "file-transfer" + name = "asapo-file-transfer" check { - name = "asapo-fts-alive" + name = "asapo-file-transfer-alive" type = "http" path = "/health-check" interval = "10s" @@ -71,7 +71,7 @@ job "asapo-fts" { } template { - source = "${scripts_dir}/fts.json.tpl" + source = "${scripts_dir}/file-transfer.json.tpl" destination = "local/config.json" change_mode = "restart" } diff --git a/deploy/asapo_services/scripts/fts.json.tpl b/deploy/asapo_services/scripts/file-transfer.json.tpl similarity index 100% rename from deploy/asapo_services/scripts/fts.json.tpl rename to deploy/asapo_services/scripts/file-transfer.json.tpl diff --git a/deploy/asapo_services/scripts/nginx.conf.tpl b/deploy/asapo_services/scripts/nginx.conf.tpl index b101534ded41c65dbeb83de86b5ca563826051e1..e0c52d1ed7dfab0791f81cb226e5fa2d81a43d59 100644 --- a/deploy/asapo_services/scripts/nginx.conf.tpl +++ b/deploy/asapo_services/scripts/nginx.conf.tpl @@ -46,8 +46,8 @@ http { proxy_pass http://$elasticsearch_endpoint:{{ env "NOMAD_META_elasticsearch_port" }}$uri$is_args$args; } - location /discovery/ { - rewrite ^/discovery(/.*) $1 break; + location /asapo-discovery/ { + rewrite ^/asapo-discovery(/.*) $1 break; proxy_pass http://$discovery_endpoint:{{ env "NOMAD_META_discovery_port" }}$uri$is_args$args; } @@ -68,8 +68,8 @@ http { proxy_pass http://$grafana_endpoint:{{ env "NOMAD_META_grafana_port" }}$uri$is_args$args; } - location /authorizer/ { - rewrite ^/authorizer(/.*) $1 break; + location /asapo-authorizer/ { + rewrite ^/asapo-authorizer(/.*) $1 break; proxy_pass http://$authorizer_endpoint:{{ env "NOMAD_META_authorizer_port" }}$uri$is_args$args; } diff --git a/producer/api/cpp/src/receiver_discovery_service.cpp b/producer/api/cpp/src/receiver_discovery_service.cpp index 2f10a3152a80d9f53b2cf675be504a9096c23c77..b3526bc3640ea29c28180feb34671c82676708ac 100644 --- a/producer/api/cpp/src/receiver_discovery_service.cpp +++ b/producer/api/cpp/src/receiver_discovery_service.cpp @@ -9,7 +9,7 @@ namespace asapo { -const std::string ReceiverDiscoveryService::kServiceEndpointSuffix = "/discovery/receivers"; +const std::string ReceiverDiscoveryService::kServiceEndpointSuffix = "/discovery/asapo-receiver"; ReceiverDiscoveryService::ReceiverDiscoveryService(std::string endpoint, uint64_t update_frequency_ms): httpclient__{DefaultHttpClient()}, log__{GetDefaultProducerLogger()}, diff --git a/producer/api/cpp/unittests/test_receiver_discovery_service.cpp b/producer/api/cpp/unittests/test_receiver_discovery_service.cpp index ddf55532fccb3dde4cf93292b9c57d677457502f..24ceeb87eeb44efec1b3783d393f21759a6c0f73 100644 --- a/producer/api/cpp/unittests/test_receiver_discovery_service.cpp +++ b/producer/api/cpp/unittests/test_receiver_discovery_service.cpp @@ -48,7 +48,7 @@ class ReceiversStatusTests : public Test { NiceMock<asapo::MockLogger> mock_logger; NiceMock<MockHttpClient>* mock_http_client; - std::string expected_endpoint{"endpoint/discovery/receivers"}; + std::string expected_endpoint{"endpoint/discovery/asapo-receiver"}; ReceiverDiscoveryService status{"endpoint", 20}; void SetUp() override { diff --git a/receiver/src/request_handler_db.cpp b/receiver/src/request_handler_db.cpp index 2b64f85c04f2113fa200dd4c35f5a9b4fc61cf72..d543b9dc7c5d1b916533e58a467700cbce2e2da9 100644 --- a/receiver/src/request_handler_db.cpp +++ b/receiver/src/request_handler_db.cpp @@ -37,7 +37,7 @@ Error RequestHandlerDb::GetDatabaseServerUri(std::string* uri) const { HttpCode code; Error http_err; - *uri = http_client__->Get(GetReceiverConfig()->discovery_server + "/mongo", &code, &http_err); + *uri = http_client__->Get(GetReceiverConfig()->discovery_server + "/asapo-mongodb", &code, &http_err); if (http_err) { log__->Error(std::string{"http error when discover database server "} + " from " + GetReceiverConfig()->discovery_server + " : " + http_err->Explain()); diff --git a/receiver/unittests/test_request_handler_db.cpp b/receiver/unittests/test_request_handler_db.cpp index 1f4dc691c5eb5570574a722020d45f0cca77519a..f1091c3c2e2bb1328898f4eca4a3f710b4a18a3c 100644 --- a/receiver/unittests/test_request_handler_db.cpp +++ b/receiver/unittests/test_request_handler_db.cpp @@ -95,7 +95,7 @@ class DbHandlerTests : public Test { void DbHandlerTests::MockAuthRequest(bool error, HttpCode code) { if (error) { - EXPECT_CALL(mock_http_client, Get_t(expected_discovery_server + "/mongo", _, _)). + EXPECT_CALL(mock_http_client, Get_t(expected_discovery_server + "/asapo-mongodb", _, _)). WillOnce( DoAll(SetArgPointee<2>(new asapo::SimpleError("http error")), Return("") @@ -105,7 +105,7 @@ void DbHandlerTests::MockAuthRequest(bool error, HttpCode code) { HasSubstr(expected_discovery_server)))); } else { - EXPECT_CALL(mock_http_client, Get_t(expected_discovery_server + "/mongo", _, _)). + EXPECT_CALL(mock_http_client, Get_t(expected_discovery_server + "/asapo-mongodb", _, _)). WillOnce( DoAll( SetArgPointee<1>(code), diff --git a/tests/automatic/settings/nginx.conf.tpl b/tests/automatic/settings/nginx.conf.tpl index 782384a118a67119d0970c16cee5283bf2d12f62..b4a518fcd2b9d291c6b4170af53167c00b171e37 100644 --- a/tests/automatic/settings/nginx.conf.tpl +++ b/tests/automatic/settings/nginx.conf.tpl @@ -27,8 +27,8 @@ http { resolver 127.0.0.1:8600 valid=1s; server { listen {{ env "NOMAD_PORT_nginx" }}; - set $discovery_endpoint discovery.service.asapo; - set $authorizer_endpoint authorizer.service.asapo; + set $discovery_endpoint asapo-discovery.service.asapo; + set $authorizer_endpoint asapo-authorizer.service.asapo; set $fluentd_endpoint fluentd.service.asapo; set $kibana_endpoint kibana.service.asapo; set $grafana_endpoint grafana.service.asapo; @@ -45,8 +45,8 @@ http { proxy_pass http://$elasticsearch_endpoint:9200$uri$is_args$args; } - location /discovery/ { - rewrite ^/discovery(/.*) $1 break; + location /asapo-discovery/ { + rewrite ^/asapo-discovery(/.*) $1 break; proxy_pass http://$discovery_endpoint:5006$uri$is_args$args; } @@ -67,8 +67,8 @@ http { proxy_pass http://$grafana_endpoint:3000$uri$is_args$args; } - location /authorizer/ { - rewrite ^/authorizer(/.*) $1 break; + location /asapo-authorizer/ { + rewrite ^/asapo-authorizer(/.*) $1 break; proxy_pass http://$authorizer_endpoint:5007$uri$is_args$args; } diff --git a/tests/automatic/settings/receiver.json.tpl.lin.in b/tests/automatic/settings/receiver.json.tpl.lin.in index b910579330a6849a654cafef00918a119628a8e1..baa9b4b6c0014ee2c7d62045011e0e1787e45a18 100644 --- a/tests/automatic/settings/receiver.json.tpl.lin.in +++ b/tests/automatic/settings/receiver.json.tpl.lin.in @@ -3,7 +3,7 @@ "PerformanceDbServer":"localhost:8086", "PerformanceDbName": "db_test", "DatabaseServer":"auto", - "DiscoveryServer": "localhost:8400/discovery", + "DiscoveryServer": "localhost:8400/asapo-discovery", "DataServer": { "NThreads": 2, "ListenPort": {{ env "NOMAD_PORT_recv_ds" }} @@ -13,7 +13,7 @@ "SizeGB": 1, "ReservedShare": 10 }, - "AuthorizationServer": "localhost:8400/authorizer", + "AuthorizationServer": "localhost:8400/asapo-authorizer", "AuthorizationInterval": 1000, "ListenPort": {{ env "NOMAD_PORT_recv" }}, "Tag": "{{ env "NOMAD_ADDR_recv" }}", diff --git a/tests/automatic/settings/receiver.json.tpl.win.in b/tests/automatic/settings/receiver.json.tpl.win.in index f46bd5bdf5349be12114870036853518059cbd6b..d18f3b98dae872062c717357040db0969196a8ed 100644 --- a/tests/automatic/settings/receiver.json.tpl.win.in +++ b/tests/automatic/settings/receiver.json.tpl.win.in @@ -3,8 +3,8 @@ "PerformanceDbServer":"localhost:8086", "PerformanceDbName": "db_test", "DatabaseServer":"auto", - "DiscoveryServer": "localhost:8400/discovery", - "AuthorizationServer": "localhost:8400/authorizer", + "DiscoveryServer": "localhost:8400/asapo-discovery", + "AuthorizationServer": "localhost:8400/asapo-authorizer", "AuthorizationInterval": 1000, "ListenPort": {{ env "NOMAD_PORT_recv" }}, "DataServer": { diff --git a/tests/manual/maxwell/asapo_test/clean.sh b/tests/manual/maxwell/asapo_test/clean.sh index 3160c9320cd1d85a49365bd683f5ccf2d8fde3ae..d2ad9ba86e8dd43064fc5b58ccb9b5685decab60 100755 --- a/tests/manual/maxwell/asapo_test/clean.sh +++ b/tests/manual/maxwell/asapo_test/clean.sh @@ -1,12 +1,12 @@ export asapo_host=`cat asapo_host` -dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/mongo` --eval "db.dropDatabase()" asapo_test_stream -dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/mongo` --eval "db.dropDatabase()" asapo_test_stream0 -dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/mongo` --eval "db.dropDatabase()" asapo_test_stream1 -dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/mongo` --eval "db.dropDatabase()" asapo_test_stream2 -dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/mongo` --eval "db.dropDatabase()" asapo_test_stream3 -dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/mongo` --eval "db.dropDatabase()" asapo_test_stream4 -dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/mongo` --eval "db.dropDatabase()" asapo_test_stream5 -dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/mongo` --eval "db.dropDatabase()" asapo_test_stream6 -dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/mongo` --eval "db.dropDatabase()" asapo_test_stream7 -dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/mongo` --eval "db.dropDatabase()" asapo_test_stream8 +dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/asapo-mongodb` --eval "db.dropDatabase()" asapo_test_stream +dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/asapo-mongodb` --eval "db.dropDatabase()" asapo_test_stream0 +dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/asapo-mongodb` --eval "db.dropDatabase()" asapo_test_stream1 +dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/asapo-mongodb` --eval "db.dropDatabase()" asapo_test_stream2 +dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/asapo-mongodb` --eval "db.dropDatabase()" asapo_test_stream3 +dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/asapo-mongodb` --eval "db.dropDatabase()" asapo_test_stream4 +dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/asapo-mongodb` --eval "db.dropDatabase()" asapo_test_stream5 +dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/asapo-mongodb` --eval "db.dropDatabase()" asapo_test_stream6 +dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/asapo-mongodb` --eval "db.dropDatabase()" asapo_test_stream7 +dockerrun -v `pwd`:/tmp/yakubov mongo mongo --host `curl -s $asapo_host:8400/discovery/asapo-mongodb` --eval "db.dropDatabase()" asapo_test_stream8