From 544a50aafe4b092c52eb21559f1bc644274a3708 Mon Sep 17 00:00:00 2001 From: Ilja Neumann Date: Wed, 29 Apr 2020 14:34:51 +0200 Subject: [PATCH] Integrate ocis-accounts --- changelog/unreleased/integrate-accounts.md | 6 ++++ go.mod | 1 + go.sum | 18 ++-------- pkg/command/accounts.go | 40 ++++++++++++++++++++++ pkg/config/config.go | 9 +++-- pkg/micro/runtime/runtime.go | 1 + 6 files changed, 57 insertions(+), 18 deletions(-) create mode 100644 changelog/unreleased/integrate-accounts.md create mode 100644 pkg/command/accounts.go diff --git a/changelog/unreleased/integrate-accounts.md b/changelog/unreleased/integrate-accounts.md new file mode 100644 index 00000000000..b09c4e89286 --- /dev/null +++ b/changelog/unreleased/integrate-accounts.md @@ -0,0 +1,6 @@ +Change: Start ocis-accounts with the ocis server command + +Starts ocis-accounts in single binary mode (./ocis server). This service stores the user-account information. + +https://github.com/owncloud/product/issues/25 +https://github.com/owncloud/ocis/pull/239/files diff --git a/go.mod b/go.mod index bef8793dea5..d02942579fa 100644 --- a/go.mod +++ b/go.mod @@ -16,6 +16,7 @@ require ( github.com/micro/micro/v2 v2.0.1-0.20200210100719-f38a1d8d5348 github.com/openzipkin/zipkin-go v0.2.2 github.com/owncloud/flaex v0.2.0 + github.com/owncloud/ocis-accounts v0.1.1 github.com/owncloud/ocis-glauth v0.4.0 github.com/owncloud/ocis-graph v0.0.0-20200318175820-9a5a6e029db7 github.com/owncloud/ocis-graph-explorer v0.0.0-20200210111049-017eeb40dc0c diff --git a/go.sum b/go.sum index 6ce06dbfac2..14d17b14d60 100644 --- a/go.sum +++ b/go.sum @@ -123,8 +123,6 @@ github.com/aws/aws-sdk-go v1.19.45/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpi github.com/aws/aws-sdk-go v1.23.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.25.31/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.28.2/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.30.7 h1:IaXfqtioP6p9SFAnNfsqdNczbR5UNbYqvcZUSsCAdTY= -github.com/aws/aws-sdk-go v1.30.7/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/aws/aws-sdk-go v1.30.12 h1:KrjyosZvkpJjcwMk0RNxMZewQ47v7+ZkbQDXjWsJMs8= github.com/aws/aws-sdk-go v1.30.12/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= @@ -219,13 +217,9 @@ github.com/crewjam/httperr v0.0.0-20190612203328-a946449404da/go.mod h1:+rmNIXRv github.com/crewjam/saml v0.4.0 h1:gvSlboe4BO1APaU2eDdsbql3itRat310Q5qs2Seim2k= github.com/crewjam/saml v0.4.0/go.mod h1:geQUbAAwmTKNJFDzoXaTssZHY26O89PHIm3K3YWjWnI= github.com/cs3org/go-cs3apis v0.0.0-20191128165347-19746c015c83/go.mod h1:IsVGyZrOLUQD48JIhlM/xb3Vz6He5o2+W0ZTfUGY+IU= -github.com/cs3org/go-cs3apis v0.0.0-20200408065125-6e23f3ecec0a h1:+enFdliTCV/aaLAvLmeka/r9wUoEypngV4JD5Gy92Uc= -github.com/cs3org/go-cs3apis v0.0.0-20200408065125-6e23f3ecec0a/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= github.com/cs3org/go-cs3apis v0.0.0-20200423154403-462ce7762d4a h1:+ucCukFjYS+L7Sg3GbXoD0M0Pz6CQEhJ9HC97GHc9TU= github.com/cs3org/go-cs3apis v0.0.0-20200423154403-462ce7762d4a/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= github.com/cs3org/reva v0.0.2-0.20200115110931-4c7513415ec5/go.mod h1:Hk3eCcdhtv4eIhKvRK736fQuOyS1HuHnUcz0Dq6NK1A= -github.com/cs3org/reva v0.1.1-0.20200416050838-5fc8adf27f83 h1:UScjXmYUPW0XSolajvxoBixIRVQRldYPmfeF1TI/CuY= -github.com/cs3org/reva v0.1.1-0.20200416050838-5fc8adf27f83/go.mod h1:baGkmcec/4WxTux30nbIz05RWKaueMGTkDihcVxLp8Y= github.com/cs3org/reva v0.1.1-0.20200427161359-c1549a8110eb h1:NmIewIBHshEpn8q1pezRDoG2B7hRVgnWYLX1XSVjx1E= github.com/cs3org/reva v0.1.1-0.20200427161359-c1549a8110eb/go.mod h1:I20R3mjgLU9y9Ol3pIckY3M948l7mkJORdpfSR9w9tM= github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -499,6 +493,7 @@ github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.3.0 h1:OS12ieG61fsCg5+qLJ+SsW9NicxNkg3b25OyT2yCeUc= github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= +github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= @@ -746,6 +741,8 @@ github.com/owncloud/flaex v0.2.0 h1:3FLf8oyMgA6HLK7w4+VJ5N1oVA8G7MptLCVjfxxIaww= github.com/owncloud/flaex v0.2.0/go.mod h1:jip86t4OVURJTf8CM/0e2qcji/Y4NG3l2lR8kex4JWw= github.com/owncloud/ocis-accounts v0.1.0 h1:6YjvRWNW26QHOqOFONg0HeogxhxaVGS1S2AoCUgzE3M= github.com/owncloud/ocis-accounts v0.1.0/go.mod h1:eoOPfuFCJ23n2csSMzapfjzVhG2kt8sQ2tu/9J+SwsA= +github.com/owncloud/ocis-accounts v0.1.1 h1:WYQ/KLbNZB7EmCZQJTvrySfWFuS0m9oM0gTkyKrjFOM= +github.com/owncloud/ocis-accounts v0.1.1/go.mod h1:2bAek8WWDb7jPNpIzefi2+4jqpI1U6dgpzjyRFX94Zg= github.com/owncloud/ocis-glauth v0.4.0 h1:L+S2UzkJJv5NWBVnTIZObdFz5zvKz8L0crIWbXtTF8o= github.com/owncloud/ocis-glauth v0.4.0/go.mod h1:dZzZdRkssaEiDg3UdlQL+kozVfpyVUhdUd0uGcTdCH8= github.com/owncloud/ocis-graph v0.0.0-20200318175820-9a5a6e029db7 h1:gT0GyIOoR7XtpZ7sIxVJSckcz/nueGB1Cm1xNaflXQ0= @@ -759,13 +756,8 @@ github.com/owncloud/ocis-konnectd v0.3.1 h1:d886SLx6oR2ldNAvJC8TB/0+XnYCQiNFFTGz github.com/owncloud/ocis-konnectd v0.3.1/go.mod h1:kOBYY8P1s2KJRmUc//bThSFtSIH6NO1+6WogmrHcMRY= github.com/owncloud/ocis-ocs v0.0.0-20200318181133-cc66a0531da7 h1:AHKA5xrnSBOdFjVTkaXzCyJl7vhOVklJD/b/T6Ky/oI= github.com/owncloud/ocis-ocs v0.0.0-20200318181133-cc66a0531da7/go.mod h1:W0ry/qPP85Yw/KKd0IoOdjOI914bvzOaEeM9bzRuwaQ= -github.com/owncloud/ocis-phoenix v0.5.0 h1:ZePMjGBz5THBo7SfKgdnSNfaOiNX9IMOhiBhC7pAIJ0= -github.com/owncloud/ocis-phoenix v0.5.0/go.mod h1:4ig0+lfBK60GJLUMbvJdhtftrKEOpdBsGt7DVN/AmoY= -github.com/owncloud/ocis-phoenix v0.5.1-0.20200424121943-652060b9c8d4 h1:NcLpdKVfNeiIqAL5b1lFffuYRklXFSS1kkF22fW/5JQ= -github.com/owncloud/ocis-phoenix v0.5.1-0.20200424121943-652060b9c8d4/go.mod h1:4ig0+lfBK60GJLUMbvJdhtftrKEOpdBsGt7DVN/AmoY= github.com/owncloud/ocis-phoenix v0.6.0 h1:p++botHH6WizAiMXELBTDRw9oVqcjyMliLf5BLgrDxw= github.com/owncloud/ocis-phoenix v0.6.0/go.mod h1:uTJsJV9mTnWmMOgg1YaxUaqmAjH5P+sikp9tZQKSwpM= -github.com/owncloud/ocis-pkg v1.2.1-0.20191217084055-eab942498596 h1:3aMNmuDCIdKsaa4YdVTQEBJMjGz8KiuIB/+xlJUCT3k= github.com/owncloud/ocis-pkg v1.2.1-0.20191217084055-eab942498596/go.mod h1:Wo0QfOmhadh2vNcUoQIsw2yaOT3zeftk+xaOOwP3y88= github.com/owncloud/ocis-pkg v1.3.0 h1:2fkgvfd/spTjschuulYMHRuzxkCGGXae9ocebVYkm74= github.com/owncloud/ocis-pkg v1.3.0/go.mod h1:Wo0QfOmhadh2vNcUoQIsw2yaOT3zeftk+xaOOwP3y88= @@ -777,13 +769,9 @@ github.com/owncloud/ocis-pkg/v2 v2.2.1 h1:LK7WxHYugEFQ9NHTOz0EP8DRjbt51wXhyqruV0 github.com/owncloud/ocis-pkg/v2 v2.2.1/go.mod h1:MXv7QzsYsu4YWuyJxhq1kLLmJa/r5gbqHe1FXulMHaw= github.com/owncloud/ocis-proxy v0.3.1 h1:49weyxHNQjOeWTaf31LlQp5uul8ZoJenfe9o4P4fetU= github.com/owncloud/ocis-proxy v0.3.1/go.mod h1:HwsIKM9etps19bBVwjOX+Jrv9pfDvw3azvaHaxMiBCI= -github.com/owncloud/ocis-reva v0.2.1-0.20200422092105-7d8638a67485 h1:oi/XK5qULuMcMXd/G5FYwFCH2f1UvFZ6rqx1+Rz+MEg= -github.com/owncloud/ocis-reva v0.2.1-0.20200422092105-7d8638a67485/go.mod h1:Rh/DEL4DJFCqVi1dMXR8eGrYQ/Qryy2hZj8HCGl63C8= github.com/owncloud/ocis-reva v0.2.1 h1:4aOOJT7tn9GCeNCM+qr33de2xobW4nAKJUvbb0BpL2k= github.com/owncloud/ocis-reva v0.2.1/go.mod h1:Ew9XgScQzFbdpSZySq1PHVISgd4y03Ms62lFy+mAx2s= github.com/owncloud/ocis-thumbnails v0.0.0-20200318131505-e0ab0b37a5a4/go.mod h1:VmCoxwitTs6oRxIaGz6xridLPwA6ReRMej22jBhkRIM= -github.com/owncloud/ocis-thumbnails v0.1.0 h1:rUzNeu5bKH01WnG/EKJZGy6rnlqZ4tlArDaUwIZK0hM= -github.com/owncloud/ocis-thumbnails v0.1.0/go.mod h1:VmCoxwitTs6oRxIaGz6xridLPwA6ReRMej22jBhkRIM= github.com/owncloud/ocis-thumbnails v0.1.2-0.20200422124828-f92a40879feb h1:eLvwnJ88x0erIsjMEa2b6dI1pBTEz52eMKrBPJfIOLM= github.com/owncloud/ocis-thumbnails v0.1.2-0.20200422124828-f92a40879feb/go.mod h1:N9zPXTyUmQ7vi19Y5EO94MRw19up/3SK3SSX5P3PvFw= github.com/owncloud/ocis-webdav v0.1.0 h1:A7wI6knfIDwvlAMrW+YOmP9gxF7bxAtsgIuFs11+fM4= diff --git a/pkg/command/accounts.go b/pkg/command/accounts.go new file mode 100644 index 00000000000..88b3b6edd23 --- /dev/null +++ b/pkg/command/accounts.go @@ -0,0 +1,40 @@ +package command + +import ( + "github.com/micro/cli/v2" + "github.com/owncloud/ocis-accounts/pkg/command" + svcconfig "github.com/owncloud/ocis-accounts/pkg/config" + "github.com/owncloud/ocis-accounts/pkg/flagset" + "github.com/owncloud/ocis/pkg/config" + "github.com/owncloud/ocis/pkg/register" +) + +// AccountsCommand is the entrypoint for the accounts command. +func AccountsCommand(cfg *config.Config) *cli.Command { + return &cli.Command{ + Name: "accounts", + Usage: "Start accounts server", + Category: "Extensions", + Flags: flagset.ServerWithConfig(cfg.Accounts), + Action: func(c *cli.Context) error { + accountsCommand := command.Server(configureAccounts(cfg)) + if err := accountsCommand.Before(c); err != nil { + return err + } + + return cli.HandleAction(accountsCommand.Action, c) + }, + } +} + +func configureAccounts(cfg *config.Config) *svcconfig.Config { + cfg.Accounts.Log.Level = cfg.Log.Level + cfg.Accounts.Log.Pretty = cfg.Log.Pretty + cfg.Accounts.Log.Color = cfg.Log.Color + + return cfg.Accounts +} + +func init() { + register.AddCommand(AccountsCommand) +} diff --git a/pkg/config/config.go b/pkg/config/config.go index a15eae0479d..d5a2bfe31a1 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -1,6 +1,7 @@ package config import ( + accounts "github.com/owncloud/ocis-accounts/pkg/config" glauth "github.com/owncloud/ocis-glauth/pkg/config" graphExplorer "github.com/owncloud/ocis-graph-explorer/pkg/config" graph "github.com/owncloud/ocis-graph/pkg/config" @@ -58,22 +59,24 @@ type Config struct { GRPC GRPC Tracing Tracing + Accounts *accounts.Config Graph *graph.Config GraphExplorer *graphExplorer.Config + GLAuth *glauth.Config Hello *hello.Config Konnectd *konnectd.Config OCS *ocs.Config Phoenix *phoenix.Config - WebDAV *webdav.Config - Reva *reva.Config - GLAuth *glauth.Config Proxy *proxy.Config + Reva *reva.Config Thumbnails *thumbnails.Config + WebDAV *webdav.Config } // New initializes a new configuration with or without defaults. func New() *Config { return &Config{ + Accounts: accounts.New(), Graph: graph.New(), GraphExplorer: graphExplorer.New(), Hello: hello.New(), diff --git a/pkg/micro/runtime/runtime.go b/pkg/micro/runtime/runtime.go index a38c00b6954..7aa69bc5006 100644 --- a/pkg/micro/runtime/runtime.go +++ b/pkg/micro/runtime/runtime.go @@ -49,6 +49,7 @@ var ( "reva-storage-eos-data", "reva-storage-oc", "reva-storage-oc-data", + "accounts", "glauth", "konnectd", "proxy", // TODO rename this command. It collides with micro's `proxy`