mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-03-03 06:27:17 -05:00
fix hello deployment
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
set -e
|
||||
|
||||
mkdir -p /var/tmp/ocis/.config/
|
||||
cp /config/proxy-config.json /var/tmp/ocis/.config/proxy-config.json
|
||||
cp /config/web-config.dist.json /var/tmp/ocis/.config/web-config.json
|
||||
sed -i 's/ocis.owncloud.test/'${OCIS_DOMAIN:-ocis.owncloud.test}'/g' /var/tmp/ocis/.config/web-config.json
|
||||
|
||||
@@ -26,8 +25,4 @@ ocis accounts update --password $STORAGE_LDAP_BIND_PASSWORD $REVA_USER_UUID
|
||||
echo "default secrets changed"
|
||||
echo "##################################################"
|
||||
|
||||
ocis kill proxy
|
||||
sleep 10
|
||||
ocis proxy server # workaround for loading proxy configuration
|
||||
|
||||
wait # wait for oCIS to exit
|
||||
|
||||
@@ -52,7 +52,8 @@ services:
|
||||
environment:
|
||||
OCIS_URL: https://${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
OCIS_DOMAIN: ${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
OCIS_LOG_LEVEL: ${OCIS_LOG_LEVEL:-error} # make oCIS less verbose
|
||||
#OCIS_LOG_LEVEL: ${OCIS_LOG_LEVEL:-error} # make oCIS less verbose
|
||||
PROXY_LOG_LEVEL: debug
|
||||
PROXY_OIDC_INSECURE: "${INSECURE:-false}" # needed if Traefik is using self generated certificates
|
||||
PROXY_TLS: "false" # do not use SSL between Traefik and oCIS
|
||||
# change default secrets
|
||||
@@ -63,14 +64,12 @@ services:
|
||||
OCIS_MACHINE_AUTH_API_KEY: ${OCIS_MACHINE_AUTH_API_KEY:-change-me-please}
|
||||
# web ui
|
||||
WEB_UI_CONFIG: "/var/tmp/ocis/.config/web-config.json"
|
||||
# proxy
|
||||
PROXY_CONFIG_FILE: "/var/tmp/ocis/.config/proxy-config.json"
|
||||
# make settings service available to oCIS Hello
|
||||
SETTINGS_GRPC_ADDR: 0.0.0.0:9191
|
||||
volumes:
|
||||
- ./config/ocis/entrypoint-override.sh:/entrypoint-override.sh
|
||||
- ./config/ocis/web-config.dist.json:/config/web-config.dist.json
|
||||
- ./config/ocis/proxy-config.json:/config/proxy-config.json
|
||||
- ./config/ocis/proxy.json:/etc/ocis/proxy.json
|
||||
- ocis-data:/var/lib/ocis
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
|
||||
var (
|
||||
defaultLocations = []string{
|
||||
filepath.Join(os.Getenv("HOME"), "/.ocis/config"),
|
||||
"/etc/ocis",
|
||||
filepath.Join(os.Getenv("HOME"), "/.ocis/config/"),
|
||||
"/etc/ocis/",
|
||||
".config/",
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,6 @@ type Cache struct {
|
||||
type Config struct {
|
||||
OcisURL string
|
||||
|
||||
File string `mapstructure:"file"`
|
||||
Log shared.Log `mapstructure:"log"`
|
||||
Debug Debug `mapstructure:"debug"`
|
||||
HTTP HTTP `mapstructure:"http"`
|
||||
@@ -203,8 +202,7 @@ func New() *Config {
|
||||
// DefaultConfig are values stored in the flag set, but moved to a struct.
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
File: "",
|
||||
Log: shared.Log{}, // logging config is inherited.
|
||||
Log: shared.Log{}, // logging config is inherited.
|
||||
Debug: Debug{
|
||||
Addr: "0.0.0.0:9205",
|
||||
Token: "",
|
||||
@@ -253,6 +251,165 @@ func DefaultConfig() *Config {
|
||||
//AutoprovisionAccounts: false,
|
||||
//EnableBasicAuth: false,
|
||||
//InsecureBackends: false,
|
||||
Context: nil,
|
||||
Context: nil,
|
||||
Policies: defaultPolicies(),
|
||||
}
|
||||
}
|
||||
|
||||
func defaultPolicies() []Policy {
|
||||
return []Policy{
|
||||
{
|
||||
Name: "ocis",
|
||||
Routes: []Route{
|
||||
{
|
||||
Endpoint: "/",
|
||||
Backend: "http://localhost:9100",
|
||||
},
|
||||
{
|
||||
Endpoint: "/.well-known/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/konnect/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/signin/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/archiver",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Type: RegexRoute,
|
||||
Endpoint: "/ocs/v[12].php/cloud/(users?|groups)", // we have `user`, `users` and `groups` in ocis-ocs
|
||||
Backend: "http://localhost:9110",
|
||||
},
|
||||
{
|
||||
Endpoint: "/ocs/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Type: QueryRoute,
|
||||
Endpoint: "/remote.php/?preview=1",
|
||||
Backend: "http://localhost:9115",
|
||||
},
|
||||
{
|
||||
Endpoint: "/remote.php/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/dav/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/webdav/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/status.php",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/index.php/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/data",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/app/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/graph/",
|
||||
Backend: "http://localhost:9120",
|
||||
},
|
||||
{
|
||||
Endpoint: "/graph-explorer",
|
||||
Backend: "http://localhost:9135",
|
||||
},
|
||||
// if we were using the go micro api gateway we could look up the endpoint in the registry dynamically
|
||||
{
|
||||
Endpoint: "/api/v0/accounts",
|
||||
Backend: "http://localhost:9181",
|
||||
},
|
||||
// TODO the lookup needs a better mechanism
|
||||
{
|
||||
Endpoint: "/accounts.js",
|
||||
Backend: "http://localhost:9181",
|
||||
},
|
||||
{
|
||||
Endpoint: "/api/v0/settings",
|
||||
Backend: "http://localhost:9190",
|
||||
},
|
||||
{
|
||||
Endpoint: "/settings.js",
|
||||
Backend: "http://localhost:9190",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "oc10",
|
||||
Routes: []Route{
|
||||
{
|
||||
Endpoint: "/",
|
||||
Backend: "http://localhost:9100",
|
||||
},
|
||||
{
|
||||
Endpoint: "/.well-known/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/konnect/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/signin/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/archiver",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/ocs/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/remote.php/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/dav/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/webdav/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/status.php",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/index.php/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/data",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,11 +52,6 @@ func structMappings(cfg *Config) []shared.EnvBinding {
|
||||
Destination: &cfg.Debug.Addr,
|
||||
},
|
||||
|
||||
{
|
||||
EnvVars: []string{"PROXY_CONFIG_FILE"},
|
||||
Destination: &cfg.File,
|
||||
},
|
||||
|
||||
// Tracing
|
||||
{
|
||||
EnvVars: []string{"PROXY_TRACING_ENABLED", "OCIS_TRACING_ENABLED"},
|
||||
|
||||
@@ -62,13 +62,6 @@ func NewMultiHostReverseProxy(opts ...Option) *MultiHostReverseProxy {
|
||||
},
|
||||
}
|
||||
|
||||
if options.Config.Policies == nil {
|
||||
rp.logger.Info().Str("source", "runtime").Msg("Policies")
|
||||
options.Config.Policies = defaultPolicies()
|
||||
} else {
|
||||
rp.logger.Info().Str("source", "file").Str("src", options.Config.File).Msg("policies")
|
||||
}
|
||||
|
||||
if options.Config.PolicySelector == nil {
|
||||
firstPolicy := options.Config.Policies[0].Name
|
||||
rp.logger.Warn().Str("policy", firstPolicy).Msg("policy-selector not configured. Will always use first policy")
|
||||
@@ -263,161 +256,3 @@ func (p *MultiHostReverseProxy) regexRouteMatcher(pattern string, target url.URL
|
||||
func (p *MultiHostReverseProxy) prefixRouteMatcher(prefix string, target url.URL) bool {
|
||||
return strings.HasPrefix(target.Path, prefix) && prefix != "/"
|
||||
}
|
||||
|
||||
func defaultPolicies() []config.Policy {
|
||||
return []config.Policy{
|
||||
{
|
||||
Name: "ocis",
|
||||
Routes: []config.Route{
|
||||
{
|
||||
Endpoint: "/",
|
||||
Backend: "http://localhost:9100",
|
||||
},
|
||||
{
|
||||
Endpoint: "/.well-known/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/konnect/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
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
|
||||
Backend: "http://localhost:9110",
|
||||
},
|
||||
{
|
||||
Endpoint: "/ocs/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Type: config.QueryRoute,
|
||||
Endpoint: "/remote.php/?preview=1",
|
||||
Backend: "http://localhost:9115",
|
||||
},
|
||||
{
|
||||
Endpoint: "/remote.php/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/dav/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/webdav/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/status.php",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/index.php/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/data",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/app/",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/graph/",
|
||||
Backend: "http://localhost:9120",
|
||||
},
|
||||
{
|
||||
Endpoint: "/graph-explorer",
|
||||
Backend: "http://localhost:9135",
|
||||
},
|
||||
// if we were using the go micro api gateway we could look up the endpoint in the registry dynamically
|
||||
{
|
||||
Endpoint: "/api/v0/accounts",
|
||||
Backend: "http://localhost:9181",
|
||||
},
|
||||
// TODO the lookup needs a better mechanism
|
||||
{
|
||||
Endpoint: "/accounts.js",
|
||||
Backend: "http://localhost:9181",
|
||||
},
|
||||
{
|
||||
Endpoint: "/api/v0/settings",
|
||||
Backend: "http://localhost:9190",
|
||||
},
|
||||
{
|
||||
Endpoint: "/settings.js",
|
||||
Backend: "http://localhost:9190",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "oc10",
|
||||
Routes: []config.Route{
|
||||
{
|
||||
Endpoint: "/",
|
||||
Backend: "http://localhost:9100",
|
||||
},
|
||||
{
|
||||
Endpoint: "/.well-known/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/konnect/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/signin/",
|
||||
Backend: "http://localhost:9130",
|
||||
},
|
||||
{
|
||||
Endpoint: "/archiver",
|
||||
Backend: "http://localhost:9140",
|
||||
},
|
||||
{
|
||||
Endpoint: "/ocs/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/remote.php/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/dav/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/webdav/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/status.php",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/index.php/",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
{
|
||||
Endpoint: "/data",
|
||||
Backend: "https://demo.owncloud.com",
|
||||
ApacheVHost: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +215,6 @@ func (tc *testCase) expectProxyTo(strURL string) testCase {
|
||||
|
||||
func testConfig(policy []config.Policy) *config.Config {
|
||||
return &config.Config{
|
||||
File: "",
|
||||
Log: shared.Log{},
|
||||
Debug: config.Debug{},
|
||||
HTTP: config.HTTP{},
|
||||
|
||||
@@ -13,7 +13,7 @@ type matchertest struct {
|
||||
}
|
||||
|
||||
func TestPrefixRouteMatcher(t *testing.T) {
|
||||
cfg := config.New()
|
||||
cfg := config.DefaultConfig()
|
||||
p := NewMultiHostReverseProxy(Config(cfg))
|
||||
|
||||
table := []matchertest{
|
||||
|
||||
Reference in New Issue
Block a user