-
Notifications
You must be signed in to change notification settings - Fork 187
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
add OCIS_URL env var #1148
add OCIS_URL env var #1148
Conversation
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
@@ -167,7 +167,7 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag { | |||
&cli.StringFlag{ | |||
Name: "iss", | |||
Usage: "OIDC issuer URL", | |||
EnvVars: []string{"KONNECTD_ISS"}, | |||
EnvVars: []string{"KONNECTD_ISS", "OCIS_URL"}, // KONNECTD_ISS takes precedence over OCIS_URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs pick up only the first environment variable. What should we do about this? Document it differently or do a PR to https://github.com/owncloud/flaex?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR to flaex is the correct fix IMO. Cc @IljaN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good 👍
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
@@ -167,7 +167,7 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag { | |||
&cli.StringFlag{ | |||
Name: "iss", | |||
Usage: "OIDC issuer URL", | |||
EnvVars: []string{"KONNECTD_ISS"}, | |||
EnvVars: []string{"KONNECTD_ISS", "OCIS_URL"}, // KONNECTD_ISS takes precedence over OCIS_URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While digging through the code I noticed, that this enables easy configuration for environment variable only. This will not picked up if you run ocis --ocis-url https://ocis.owncloud.test server
.
For that to work something like for OCIS_LOG_LEVEL
must be done. This is implemented like this:
ocis/ocis/pkg/command/accounts.go
Lines 41 to 60 in d089586
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 | |
cfg.Accounts.Server.Version = version.String | |
if cfg.Tracing.Enabled { | |
cfg.Accounts.Tracing.Enabled = cfg.Tracing.Enabled | |
cfg.Accounts.Tracing.Type = cfg.Tracing.Type | |
cfg.Accounts.Tracing.Endpoint = cfg.Tracing.Endpoint | |
cfg.Accounts.Tracing.Collector = cfg.Tracing.Collector | |
} | |
if cfg.TokenManager.JWTSecret != "" { | |
cfg.Accounts.TokenManager.JWTSecret = cfg.TokenManager.JWTSecret | |
cfg.Accounts.Repo.CS3.JWTSecret = cfg.TokenManager.JWTSecret | |
} | |
return cfg.Accounts | |
} |
I'm not sure which is the way to go because it also has downsides. In this example OCIS_LOG_LEVEL
will always win, even if your provide a lower ACCOUNTS_LOG_LEVEL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. the downside is known but accepted because the ocis binary is a poor mans orchestrator. I would argue that in eg docker compose deployments we should run the services in their own docker containers, which is why the multi repo setup was building a docker container for every service ... dunno if we still do that ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll add the --ocis-url
flag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scratch that ... I thought we could add a --ocis-url
flag to the ocis server command and use configure<Service>()
to apply it to the service config, similar to the log level and pretty flags. But that would introduce specific code that only handles this flag, which seems a little brittle to me. @IljaN mentioned that there might be something in the urfave/cli / micro/cli flags to define a flag that can be reused. So I'd postpone a --ocis-url
cli flag until later.
Co-authored-by: Artur Neumann <[email protected]>
Tests are happy except move ... 👀 |
this might be also related to owncloud/product#15 |
hm the publicstorage dies on startup:
|
…ing it Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
ok, this should turn out green 🤞 @dragotin please try a remote deployment a la |
Kudos, SonarCloud Quality Gate passed! |
We introduced a new environment variable
OCIS_URL
that exects a URL including protocol, host and optionally port to configure all the different services. These existing environment variables still take precedence, but will also fall back toOCIS_URL
:STORAGE_LDAP_IDP
,STORAGE_OIDC_ISSUER
,PROXY_OIDC_ISSUER
,STORAGE_FRONTEND_PUBLIC_URL
,KONNECTD_ISS
,WEB_OIDC_AUTHORITY
,WEB_UI_CONFIG_SERVER
.Some environment variables are now built dynamically if they are not set:
STORAGE_DATAGATEWAY_PUBLIC_URL
defaults to<STORAGE_FRONTEND_PUBLIC_URL>/data
, also falling back toOCIS_URL
WEB_OIDC_METADATA_URL
defaults to<WEB_OIDC_AUTHORITY>/.well-known/openid-configuration
, also falling back toOCIS_URL
Furthermore, the built in konnectd will generate an
identifier-registration.yaml
that uses theKONNECTD_ISS
in the allowedredirect_uris
andorigins
. It simplifies the defaulthttps:/localhost:9200
and remote deployment withOCIS_URL
which is evaluated as a fallback ifKONNECTD_ISS
is not set.An OCIS server can now be started on a remote machine as easy as
OCIS_URL=https://cloud.ocis.test PROXY_HTTP_ADDR=0.0.0.0:443 ocis server
.Note that the
OCIS_DOMAIN
environment variable is not used by ocis, but by the docker containers.TODO
set🤔 hmmm no .. could be done in a subsequent PR. keepingPROXY_HTTP_ADDR
based onOCIS_URL
? for now runningOCIS_URL="https://cloud.ocis.test" PROXY_HTTP_ADDR=0.0.0.0:443 ocis server
should start the proxy on the https port and configure all URLs to use itOCIS_URL
andPROXY_HTTP_ADDR
separate allows putting a traefik in between...cc @dragotin