diff --git a/changelog/unreleased/expose-reva-archiver.md b/changelog/unreleased/expose-reva-archiver.md new file mode 100644 index 000000000..0beb0bdf2 --- /dev/null +++ b/changelog/unreleased/expose-reva-archiver.md @@ -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 diff --git a/proxy/pkg/proxy/proxy.go b/proxy/pkg/proxy/proxy.go index 0d8aea603..e1b729df8 100644 --- a/proxy/pkg/proxy/proxy.go +++ b/proxy/pkg/proxy/proxy.go @@ -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 @@ -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", diff --git a/storage/pkg/command/frontend.go b/storage/pkg/command/frontend.go index 54be10196..36d424a79 100644 --- a/storage/pkg/command/frontend.go +++ b/storage/pkg/command/frontend.go @@ -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, + "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, diff --git a/storage/pkg/config/config.go b/storage/pkg/config/config.go index 7abaa3e3d..4b374a292 100644 --- a/storage/pkg/config/config.go +++ b/storage/pkg/config/config.go @@ -139,6 +139,7 @@ type FrontendPort struct { Port AppProviderPrefix string + ArchiverPrefix string DatagatewayPrefix string OCDavPrefix string OCSPrefix string @@ -410,6 +411,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 @@ -421,6 +428,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 diff --git a/storage/pkg/flagset/frontend.go b/storage/pkg/flagset/frontend.go index aeebbb2aa..71faba423 100644 --- a/storage/pkg/flagset/frontend.go +++ b/storage/pkg/flagset/frontend.go @@ -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 @@ -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"),