diff --git a/changelog/unreleased/remove-meshdirectory.md b/changelog/unreleased/remove-meshdirectory.md new file mode 100644 index 0000000000..c3460de296 --- /dev/null +++ b/changelog/unreleased/remove-meshdirectory.md @@ -0,0 +1,8 @@ +Change: Remove meshdirectory http service + +As of meshdirectory-web version 2.0.0, it is now +implemented and deployed as a completely separate app, +independent from Reva. We removed any deprecated +meshdirectory-related code from Reva. + +https://github.com/cs3org/reva/pull/3581 \ No newline at end of file diff --git a/examples/meshdirectory/groups.demo.json b/examples/meshdirectory/groups.demo.json deleted file mode 100644 index 42fd1af0c2..0000000000 --- a/examples/meshdirectory/groups.demo.json +++ /dev/null @@ -1,140 +0,0 @@ -[ - { - "id": { - "opaque_id": "sailing-lovers", - "idp": "http://localhost:20080" - }, - "group_name": "sailing-lovers", - "mail": "sailing-lovers@example.org", - "display_name": "Sailing Lovers", - "gid_number": 123, - "members": [ - { - "id": { - "opaque_id": "4c510ada-c86b-4815-8820-42cdf82c3d51", - "idp": "http://localhost:20080" - } - } - ] - }, - { - "id": { - "opaque_id": "violin-haters", - "idp": "http://localhost:20080" - }, - "group_name": "violin-haters", - "mail": "violin-haters@example.org", - "display_name": "Violin Haters", - "gid_number": 456, - "members": [ - { - "id": { - "opaque_id": "4c510ada-c86b-4815-8820-42cdf82c3d51", - "idp": "http://localhost:20080" - } - } - ] - }, - { - "id": { - "opaque_id": "radium-lovers", - "idp": "http://localhost:20080" - }, - "group_name": "radium-lovers", - "mail": "radium-lovers@example.org", - "display_name": "Radium Lovers", - "gid_number": 789, - "members": [ - { - "id": { - "opaque_id": "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c", - "idp": "http://localhost:20080" - } - } - ] - }, - { - "id": { - "opaque_id": "polonium-lovers", - "idp": "http://localhost:20080" - }, - "group_name": "polonium-lovers", - "mail": "polonium-lovers@example.org", - "display_name": "Polonium Lovers", - "gid_number": 987, - "members": [ - { - "id": { - "opaque_id": "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c", - "idp": "http://localhost:20080" - } - } - ] - }, - { - "id": { - "opaque_id": "quantum-lovers", - "idp": "http://localhost:20080" - }, - "group_name": "quantum-lovers", - "mail": "quantum-lovers@example.org", - "display_name": "Quantum Lovers", - "gid_number": 654, - "members": [ - { - "id": { - "opaque_id": "932b4540-8d16-481e-8ef4-588e4b6b151c", - "idp": "http://localhost:20080" - } - } - ] - }, - { - "id": { - "opaque_id": "philosophy-haters", - "idp": "http://localhost:20080" - }, - "group_name": "philosophy-haters", - "mail": "philosophy-haters@example.org", - "display_name": "Philosophy Haters", - "gid_number": 321, - "members": [ - { - "id": { - "opaque_id": "932b4540-8d16-481e-8ef4-588e4b6b151c", - "idp": "http://localhost:20080" - } - } - ] - }, - { - "id": { - "opaque_id": "physics-lovers", - "idp": "http://localhost:20080" - }, - "group_name": "physics-lovers", - "mail": "physics-lovers@example.org", - "display_name": "Physics Lovers", - "gid_number": 101, - "members": [ - { - "id": { - "opaque_id": "4c510ada-c86b-4815-8820-42cdf82c3d51", - "idp": "http://localhost:20080" - } - }, - { - "id": { - "opaque_id": "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c", - "idp": "http://localhost:20080" - } - }, - { - "id": { - "opaque_id": "932b4540-8d16-481e-8ef4-588e4b6b151c", - "idp": "http://localhost:20080" - } - } - ] - } -] diff --git a/examples/meshdirectory/meshdirectory.toml b/examples/meshdirectory/meshdirectory.toml deleted file mode 100644 index 1bea8c36e0..0000000000 --- a/examples/meshdirectory/meshdirectory.toml +++ /dev/null @@ -1,68 +0,0 @@ -# services to enable -[grpc.services.gateway] -[grpc.services.storageregistry] -[grpc.services.storageprovider] -[grpc.services.authregistry] -[grpc.services.usershareprovider] -[grpc.services.publicshareprovider] -[grpc.services.ocmcore] -driver = "json" - -[grpc.services.ocmcore.drivers.json] -file = "/var/tmp/reva/shares_server_1.json" - -[grpc.services.ocminvitemanager] -driver = "json" - -[grpc.services.ocmshareprovider] -driver = "json" - -[grpc.services.ocmshareprovider.drivers.json] -file = "/var/tmp/reva/shares_server_1.json" - -[http.services.datagateway] -[http.services.dataprovider] -[http.services.prometheus] -[http.services.ocmd] -[http.services.ocmprovider] -[http.services.ocdav] -[http.services.ocs] - -[grpc.services.authprovider] -auth_manager = "json" - -[grpc.services.authprovider.auth_managers.json] -users = "users.demo.json" - -[grpc.services.userprovider] -driver = "json" -[grpc.services.groupprovider] -driver = "json" - -[grpc.services.groupprovider.drivers.json] -groups = "groups.demo.json" - -[grpc.services.userprovider.drivers.json] -users = "users.demo.json" - -[grpc.services.ocmproviderauthorizer] -driver = "mentix" - -[http.middlewares.providerauthorizer] -driver = "mentix" - -[http.middlewares.providerauthorizer.drivers.mentix] -url = "https://localhost:19001/api/mentix/cs3" -insecure = false -timeout = 10 -refresh = 900 - -[grpc.services.ocmproviderauthorizer.drivers.mentix] -url = "https://localhost:19001/api/mentix/cs3" -verify_request_hostname = true -insecure = false -timeout = 10 -refresh = 900 - -[http.services.meshdirectory] -mesh_directory_url = 'http://localhost:19001/meshdir/' diff --git a/examples/meshdirectory/providers.demo.json b/examples/meshdirectory/providers.demo.json deleted file mode 100644 index e3674f7658..0000000000 --- a/examples/meshdirectory/providers.demo.json +++ /dev/null @@ -1,164 +0,0 @@ -[ - { - "name": "cernbox", - "full_name": "CERNBox", - "organization": "CERN", - "domain": "cern.ch", - "homepage": "https://cernbox.web.cern.ch", - "description": "CERNBox provides cloud data storage to all CERN users.", - "services": [ - { - "endpoint": { - "type": { - "name": "OCM", - "description": "CERNBox Open Cloud Mesh API" - }, - "name": "CERNBox - OCM API", - "path": "https://sciencemesh.cernbox.cern.ch/iop/ocm/", - "is_monitored": true - }, - "api_version": "0.0.1", - "host": "sciencemesh.cernbox.cern.ch" - } - ] - }, - { - "name": "oc-cesnet", - "full_name": "ownCloud@CESNET", - "organization": "CESNET", - "domain": "cesnet.cz", - "homepage": "https://owncloud.cesnet.cz", - "description": "OwnCloud has been designed for individual users.", - "services": [ - { - "endpoint": { - "type": { - "name": "OCM", - "description": "CESNET Open Cloud Mesh API" - }, - "name": "CESNET - OCM API", - "path": "https://sciencemesh.cesnet.cz/ocm/", - "is_monitored": true - }, - "api_version": "0.0.1", - "host": "sciencemesh.cesnet.cz" - } - ] - }, - { - "name": "uni-muenster", - "full_name": "WWU University of Muenster", - "organization": "University of Muenster", - "domain": "uni-muenster.de", - "homepage": "https://uni-muenster.de", - "description": "WWU provides cloud storage to its students, faculty and researchers.", - "services": [ - { - "endpoint": { - "type": { - "name": "OCM", - "description": "WWU Open Cloud Mesh API" - }, - "name": "WWU - OCM API", - "path": "https://sciencemesh-test.uni-muenster.de/ocm/", - "is_monitored": true - }, - "api_version": "0.0.1", - "host": "sciencemesh-test.uni-muenster.de" - } - ] - }, - { - "name": "cubbit", - "full_name": "Cubbit", - "organization": "Cubbit", - "domain": "cubbit.io", - "homepage": "https://cubbit.io", - "description": "Cubbit provides distributed storage over a P2P network.", - "services": [ - { - "endpoint": { - "type": { - "name": "OCM", - "description": "Cubbit Open Cloud Mesh API" - }, - "name": "Cubbit - OCM API", - "path": "https://ocm.cubbit.io/ocm/", - "is_monitored": true - }, - "api_version": "0.0.1", - "host": "ocm.cubbit.io" - } - ] - }, - { - "name": "ailleron", - "full_name": "Ailleron - Software Mind", - "organization": "Ailleron", - "domain": "ailleron.com", - "homepage": "https://ailleron.com", - "description": "Ailleron is a Polish IT company providing software and storage solutions to its clients.", - "services": [ - { - "endpoint": { - "type": { - "name": "OCM", - "description": "Ailleron Open Cloud Mesh API" - }, - "name": "Ailleron - OCM API", - "path": "http://cs3mesh.softwaremind.com:19000/ocm/", - "is_monitored": true - }, - "api_version": "0.0.1", - "host": "cs3mesh.softwaremind.com:19000" - } - ] - }, - { - "name": "surfsara", - "full_name": "Surfsara", - "organization": "Surfsara", - "domain": "surfsara.nl", - "homepage": "https://surfsara.nl", - "description": "OwnCloud has been designed for individual users.", - "services": [ - { - "endpoint": { - "type": { - "name": "OCM", - "description": "Surfsara Open Cloud Mesh API" - }, - "name": "Surfsara - OCM API", - "path": "https://app.cs3mesh-iop.k8s.surfsara.nl/ocm/", - "is_monitored": true - }, - "api_version": "0.0.1", - "host": "app.cs3mesh-iop.k8s.surfsara.nl" - } - ] - }, - { - "name": "switch", - "full_name": "SWITCH", - "organization": "SWITCH", - "domain": "switch.ch", - "homepage": "https://switch.ch", - "description": "SWITCHdrive cloud storage to its students, faculty and researchers.", - "services": [ - { - "endpoint": { - "type": { - "name": "OCM", - "description": "SWITCH Open Cloud Mesh API" - }, - "name": "SWITCH - OCM API", - "path": "https://sciencemesh-test.switch.ch/ocm/", - "is_monitored": true - }, - "api_version": "0.0.1", - "host": "sciencemesh-test.switch.ch" - } - ] - } - -] diff --git a/examples/meshdirectory/users.demo.json b/examples/meshdirectory/users.demo.json deleted file mode 100644 index 893d69b99f..0000000000 --- a/examples/meshdirectory/users.demo.json +++ /dev/null @@ -1,38 +0,0 @@ -[ - { - "id": { - "opaque_id": "4c510ada-c86b-4815-8820-42cdf82c3d51", - "idp": "http://localhost:20080", - "type": 1 - }, - "username": "einstein", - "secret": "relativity", - "mail": "einstein@example.org", - "display_name": "Albert Einstein", - "groups": ["sailing-lovers", "violin-haters", "physics-lovers"] - }, - { - "id": { - "opaque_id": "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c", - "idp": "http://localhost:20080", - "type": 1 - }, - "username": "marie", - "secret": "radioactivity", - "mail": "marie@example.org", - "display_name": "Marie Curie", - "groups": ["radium-lovers", "polonium-lovers", "physics-lovers"] - }, - { - "id": { - "opaque_id": "932b4540-8d16-481e-8ef4-588e4b6b151c", - "idp": "http://localhost:20080", - "type": 1 - }, - "username": "richard", - "secret": "superfluidity", - "mail": "richard@example.org", - "display_name": "Richard Feynman", - "groups": ["quantum-lovers", "philosophy-haters", "physics-lovers"] - } -] diff --git a/go.mod b/go.mod index bcc99beacb..e9533f42ce 100644 --- a/go.mod +++ b/go.mod @@ -50,7 +50,6 @@ require ( github.com/prometheus/alertmanager v0.24.0 github.com/rs/cors v1.8.3 github.com/rs/zerolog v1.28.0 - github.com/sciencemesh/meshdirectory-web v1.0.4 github.com/sethvargo/go-password v0.2.0 github.com/stretchr/testify v1.8.2 github.com/studio-b12/gowebdav v0.0.0-20230203202212-3282f94193f2 diff --git a/go.sum b/go.sum index f35936c818..bac70c99ab 100644 --- a/go.sum +++ b/go.sum @@ -1053,8 +1053,6 @@ github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFo github.com/sacloud/libsacloud v1.36.2/go.mod h1:P7YAOVmnIn3DKHqCZcUKYUXmSwGBm3yS7IBEjKVSrjg= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20210127161313-bd30bebeac4f/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8= -github.com/sciencemesh/meshdirectory-web v1.0.4 h1:1YSctF6PAXhoHUYCaeRTj7rHaF7b3rYrZf2R0VXBIbo= -github.com/sciencemesh/meshdirectory-web v1.0.4/go.mod h1:fJSThTS3xf+sTdL0iXQoaQJssLI7tn7DetHMHUl4SRk= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sethgrid/pester v0.0.0-20190127155807-68a33a018ad0/go.mod h1:Ad7IjTpvzZO8Fl0vh9AzQ+j/jYZfyp2diGwI8m5q+ns= diff --git a/internal/http/services/loader/loader.go b/internal/http/services/loader/loader.go index adf1ad02da..50ad252d9a 100644 --- a/internal/http/services/loader/loader.go +++ b/internal/http/services/loader/loader.go @@ -26,7 +26,6 @@ import ( _ "github.com/cs3org/reva/internal/http/services/dataprovider" _ "github.com/cs3org/reva/internal/http/services/helloworld" _ "github.com/cs3org/reva/internal/http/services/mentix" - _ "github.com/cs3org/reva/internal/http/services/meshdirectory" _ "github.com/cs3org/reva/internal/http/services/metrics" _ "github.com/cs3org/reva/internal/http/services/ocmd" _ "github.com/cs3org/reva/internal/http/services/ocmprovider" diff --git a/internal/http/services/meshdirectory/meshdirectory.go b/internal/http/services/meshdirectory/meshdirectory.go deleted file mode 100644 index 9a1327adc0..0000000000 --- a/internal/http/services/meshdirectory/meshdirectory.go +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2018-2023 CERN -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// In applying this license, CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -package meshdirectory - -import ( - "encoding/json" - "fmt" - "net/http" - - gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1" - providerv1beta1 "github.com/cs3org/go-cs3apis/cs3/ocm/provider/v1beta1" - "github.com/cs3org/reva/internal/http/services/reqres" - "github.com/cs3org/reva/pkg/rgrpc/todo/pool" - "github.com/cs3org/reva/pkg/rhttp/global" - "github.com/cs3org/reva/pkg/rhttp/router" - "github.com/cs3org/reva/pkg/sharedconf" - "github.com/mitchellh/mapstructure" - "github.com/pkg/errors" - "github.com/rs/zerolog" - meshdirectoryweb "github.com/sciencemesh/meshdirectory-web" -) - -func init() { - global.Register("meshdirectory", New) -} - -type config struct { - Prefix string `mapstructure:"prefix"` - GatewaySvc string `mapstructure:"gatewaysvc"` -} - -func (c *config) init() { - c.GatewaySvc = sharedconf.GetGatewaySVC(c.GatewaySvc) - - if c.Prefix == "" { - c.Prefix = "meshdir" - } -} - -type svc struct { - conf *config -} - -func parseConfig(m map[string]interface{}) (*config, error) { - c := &config{} - if err := mapstructure.Decode(m, c); err != nil { - err = errors.Wrap(err, "error decoding conf") - return nil, err - } - return c, nil -} - -// New returns a new Mesh Directory HTTP service. -func New(m map[string]interface{}, log *zerolog.Logger) (global.Service, error) { - c, err := parseConfig(m) - if err != nil { - return nil, err - } - - c.init() - - service := &svc{ - conf: c, - } - return service, nil -} - -// Service prefix. -func (s *svc) Prefix() string { - return s.conf.Prefix -} - -// Unprotected endpoints. -func (s *svc) Unprotected() []string { - return []string{"/"} -} - -// Close performs cleanup. -func (s *svc) Close() error { - return nil -} - -func (s *svc) getClient() (gateway.GatewayAPIClient, error) { - return pool.GetGatewayServiceClient(pool.Endpoint(s.conf.GatewaySvc)) -} - -func (s *svc) serveJSON(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") - - ctx := r.Context() - - gatewayClient, err := s.getClient() - if err != nil { - reqres.WriteError(w, r, reqres.APIErrorServerError, - fmt.Sprintf("error getting grpc client on addr: %v", s.conf.GatewaySvc), err) - return - } - - providers, err := gatewayClient.ListAllProviders(ctx, &providerv1beta1.ListAllProvidersRequest{}) - if err != nil { - reqres.WriteError(w, r, reqres.APIErrorServerError, "error listing all providers", err) - return - } - - jsonResponse, err := json.Marshal(providers.Providers) - if err != nil { - reqres.WriteError(w, r, reqres.APIErrorServerError, "error marshalling providers data", err) - return - } - - // Write response - _, err = w.Write(jsonResponse) - if err != nil { - reqres.WriteError(w, r, reqres.APIErrorServerError, "error writing providers data", err) - return - } - - w.WriteHeader(http.StatusOK) -} - -// HTTP service handler. -func (s *svc) Handler() http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - var head string - head, r.URL.Path = router.ShiftPath(r.URL.Path) - switch head { - case "providers": - s.serveJSON(w, r) - return - default: - r.URL.Path = head + r.URL.Path - meshdirectoryweb.ServeMeshDirectorySPA(w, r) - return - } - }) -}