Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose configuration for the reva archiver #2509

Merged
merged 4 commits into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/expose-reva-archiver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Expose the reva archiver in OCIS

The reva archiver can now be accessed through the storage frontend service

https://github.com/owncloud/ocis/pull/2509
8 changes: 8 additions & 0 deletions proxy/pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ func defaultPolicies() []config.Policy {
Endpoint: "/signin/",
Backend: "http://localhost:9130",
},
{
Endpoint: "/archiver/",
Backend: "http://localhost:9140",
},
{
Type: config.RegexRoute,
Endpoint: "/ocs/v[12].php/cloud/(users?|groups)", // we have `user`, `users` and `groups` in ocis-ocs
Expand Down Expand Up @@ -379,6 +383,10 @@ func defaultPolicies() []config.Policy {
Endpoint: "/signin/",
Backend: "http://localhost:9130",
},
{
Endpoint: "/archiver/",
Backend: "http://localhost:9140",
},
{
Endpoint: "/ocs/",
Backend: "https://demo.owncloud.com",
Expand Down
7 changes: 7 additions & 0 deletions storage/pkg/command/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ func frontendConfigFromStruct(c *cli.Context, cfg *config.Config, filesCfg map[s
"timeout": 86400,
"insecure": true,
},
"archiver": map[string]interface{}{
"prefix": cfg.Reva.Frontend.ArchiverPrefix,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is a path, then it is on the same host as the capabilities. But it could be on a dedicated host, eg https://archiver.owncloud.com.

Suggested change
"prefix": cfg.Reva.Frontend.ArchiverPrefix,
"url": cfg.Reva.Frontend.ArchiverURL,

Copy link
Contributor

@pascalwengerter pascalwengerter Sep 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is already a capability, see https://github.com/cs3org/reva/blob/master/internal/http/services/owncloud/ocs/handlers/cloud/capabilities/capabilities.go#L105 and https://github.com/cs3org/reva/blob/master/internal/http/services/owncloud/ocs/data/capabilities.go#L110

Wrong context? The links point to "favorites", and I don't see any reference to the archiver there. The PR in reva implementing the archiver doesn't have any change around capabilities neither.

urgh yes ... sorry I was confused. I think a new files capability archives makes sense. But I would strongly prefer a url endpoint value that can be used to tell clients chere to go without having to hardcode it in the clients. For example

+							"archiver": map[string]interface{}{
+								"endpoint": "https://localhost:9200/archiver",
+								"max_num_files": 5000,
+								"max_size":      1000000,
+							},

Probably the endpoint should be a relative path only? We get the backend URL from a config file already (at least in web client). This way you'd go for something like archiverUrl = config.server + capabilities.files.archiver.endpoint in the frontend? @kulmann

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it should be possible for the rest of the services (datagateway, appprovider, etc) to do the same... so I think we should prioritize consistency in this case.

We could add a comment to rise awareness or adjust the usage string in the command line, although we might need to adjust the strings of the rest of the services.

Copy link
Member

@kulmann kulmann Sep 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No preference from my side. Whatever is easier (not only for implementation, but also for admin who needs to configure it). In the web ui we have both situations already - e.g. the downloadURL comes as absolute URL form the backend while we do most API requests via relative URLS with the server URL from the config.

Copy link
Member

@butonic butonic Sep 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the capabilities, like the /.well-known/openid-configuration endpoint should allow clients to configure themselves. I agree with @jvillafanez regarding consistency. All endpoints should be URLs. That includes relative URLs like just a path: /archiver as well as https://otherhost.test/archiver.

This allows the server to configure clients to use custom implementations of services. All clients should be able to handle absolute and relative URLs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prefix is just a "namespace" for the handlers. There is no full URL in that case...

https://github.com/cs3org/reva/blob/e96fa872a8f569451d1d81d7ddefb6129c6dbd68/pkg/rhttp/rhttp.go#L204-L207

In the capabilities, you will be able to add a full URL, see #2529

"timeout": 86400,
"insecure": true,
"max_num_files": cfg.Reva.Archiver.MaxNumFiles,
"max_size": cfg.Reva.Archiver.MaxSize,
},
"datagateway": map[string]interface{}{
"prefix": cfg.Reva.Frontend.DatagatewayPrefix,
"transfer_shared_secret": cfg.Reva.TransferSecret,
Expand Down
8 changes: 8 additions & 0 deletions storage/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ type FrontendPort struct {
Port

AppProviderPrefix string
ArchiverPrefix string
DatagatewayPrefix string
OCDavPrefix string
OCSPrefix string
Expand Down Expand Up @@ -401,6 +402,12 @@ type OCDav struct {
DavFilesNamespace string
}

// Archiver defines the available archiver configuration.
type Archiver struct {
MaxNumFiles int64
MaxSize int64
}

// Reva defines the available reva configuration.
type Reva struct {
// JWTSecret used to sign jwt tokens between services
Expand All @@ -412,6 +419,7 @@ type Reva struct {
UserGroupRest UserGroupRest
UserOwnCloudSQL UserOwnCloudSQL
OCDav OCDav
Archiver Archiver
Storages StorageConfig
// Ports are used to configure which services to start on which port
Frontend FrontendPort
Expand Down
24 changes: 24 additions & 0 deletions storage/pkg/flagset/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag {
Destination: &cfg.Reva.OCDav.DavFilesNamespace,
},

// Archiver

&cli.Int64Flag{
Name: "archiver-max-num-files",
Value: flags.OverrideDefaultInt64(cfg.Reva.Archiver.MaxNumFiles, 10000),
Usage: "Maximum number of files to be included in the archiver",
EnvVars: []string{"STORAGE_ARCHIVER_MAX_NUM_FILES"},
Destination: &cfg.Reva.Archiver.MaxNumFiles,
},
&cli.Int64Flag{
Name: "archiver-max-size",
Value: flags.OverrideDefaultInt64(cfg.Reva.Archiver.MaxSize, 1073741824), // 1GB
Usage: "Maximum size for the sum of the sizes of all the files included in the archive",
EnvVars: []string{"STORAGE_ARCHIVER_MAX_SIZE"},
Destination: &cfg.Reva.Archiver.MaxSize,
},

// Services

// Frontend
Expand Down Expand Up @@ -98,6 +115,13 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"STORAGE_FRONTEND_APPPROVIDER_PREFIX"},
Destination: &cfg.Reva.Frontend.AppProviderPrefix,
},
&cli.StringFlag{
Name: "archiver-prefix",
Value: flags.OverrideDefaultString(cfg.Reva.Frontend.ArchiverPrefix, "archiver"),
Usage: "archiver prefix",
EnvVars: []string{"STORAGE_FRONTEND_ARCHIVER_PREFIX"},
Destination: &cfg.Reva.Frontend.ArchiverPrefix,
},
&cli.StringFlag{
Name: "datagateway-prefix",
Value: flags.OverrideDefaultString(cfg.Reva.Frontend.DatagatewayPrefix, "data"),
Expand Down