diff --git a/dockercompose/ai_test.go b/dockercompose/ai_test.go index 7f9e9452..3b50d9e7 100644 --- a/dockercompose/ai_test.go +++ b/dockercompose/ai_test.go @@ -37,6 +37,12 @@ func expectedAI() *Service { "dev.graphql.local.nhost.run:host-gateway", "dev.hasura.local.nhost.run:host-gateway", "dev.storage.local.nhost.run:host-gateway", + "local.auth.nhost.run:host-gateway", + "local.db.nhost.run:host-gateway", + "local.functions.nhost.run:host-gateway", + "local.graphql.nhost.run:host-gateway", + "local.hasura.nhost.run:host-gateway", + "local.storage.nhost.run:host-gateway", }, HealthCheck: &HealthCheck{ Test: []string{"CMD", "graphite", "healthcheck"}, diff --git a/dockercompose/auth_test.go b/dockercompose/auth_test.go index 9bdbcb6f..cd9b7188 100644 --- a/dockercompose/auth_test.go +++ b/dockercompose/auth_test.go @@ -140,6 +140,12 @@ func expectedAuth() *Service { "dev.graphql.local.nhost.run:host-gateway", "dev.hasura.local.nhost.run:host-gateway", "dev.storage.local.nhost.run:host-gateway", + "local.auth.nhost.run:host-gateway", + "local.db.nhost.run:host-gateway", + "local.functions.nhost.run:host-gateway", + "local.graphql.nhost.run:host-gateway", + "local.hasura.nhost.run:host-gateway", + "local.storage.nhost.run:host-gateway", }, HealthCheck: &HealthCheck{ Test: []string{"CMD", "wget", "--spider", "-S", "http://localhost:4000/healthz"}, diff --git a/dockercompose/compose.go b/dockercompose/compose.go index 182bcd70..055a9ba1 100644 --- a/dockercompose/compose.go +++ b/dockercompose/compose.go @@ -111,6 +111,15 @@ func extraHosts(subdomain string) []string { subdomain + ".graphql.local.nhost.run:host-gateway", subdomain + ".hasura.local.nhost.run:host-gateway", subdomain + ".storage.local.nhost.run:host-gateway", + // below entries shouldn't be needed unless + // users are hardcoding these subdomains + // adding out of an abundance of caution + "local.auth.nhost.run:host-gateway", + "local.db.nhost.run:host-gateway", + "local.functions.nhost.run:host-gateway", + "local.graphql.nhost.run:host-gateway", + "local.hasura.nhost.run:host-gateway", + "local.storage.nhost.run:host-gateway", } } @@ -354,8 +363,8 @@ func functions( //nolint:funlen "NHOST_HASURA_URL": URL(subdomain, "hasura", httpPort, useTLS) + "/console", "NHOST_STORAGE_URL": URL(subdomain, "storage", httpPort, useTLS) + "/v1", "NHOST_JWT_SECRET": jwtSecret, - "NHOST_REGION": "", - "NHOST_SUBDOMAIN": "local", + "NHOST_REGION": "local", + "NHOST_SUBDOMAIN": subdomain, "NHOST_WEBHOOK_SECRET": cfg.Hasura.WebhookSecret, "GRAPHITE_WEBHOOK_SECRET": cfg.GetAi().GetWebhookSecret(), } diff --git a/dockercompose/graphql.go b/dockercompose/graphql.go index 9076e5e3..7f8dfc88 100644 --- a/dockercompose/graphql.go +++ b/dockercompose/graphql.go @@ -17,8 +17,8 @@ func graphql( //nolint:funlen ) (*Service, error) { envars, err := appconfig.HasuraEnv( cfg, + subdomain, "local", - "", "nhost.run", "postgres://nhost_hasura@postgres:5432/local", useTLS, @@ -107,8 +107,8 @@ func console( //nolint:funlen envars, err := appconfig.HasuraEnv( cfg, + subdomain, "local", - "", "nhost.run", "postgres://nhost_hasura@postgres:5432/local", useTLS, diff --git a/dockercompose/graphql_test.go b/dockercompose/graphql_test.go index b8877770..b9115eff 100644 --- a/dockercompose/graphql_test.go +++ b/dockercompose/graphql_test.go @@ -46,14 +46,14 @@ func expectedGraphql() *Service { "HASURA_GRAPHQL_USE_PREPARED_STATEMENTS": "true", "HASURA_GRAPHQL_WS_READ_COOKIE": "false", "NHOST_ADMIN_SECRET": "adminSecret", - "NHOST_AUTH_URL": "http://local.auth.nhost.run:1337/v1", - "NHOST_FUNCTIONS_URL": "http://local.functions.nhost.run:1337/v1", - "NHOST_GRAPHQL_URL": "http://local.graphql.nhost.run:1337/v1", - "NHOST_HASURA_URL": "http://local.hasura.nhost.run:1337", + "NHOST_AUTH_URL": "http://dev.auth.local.nhost.run:1337/v1", + "NHOST_FUNCTIONS_URL": "http://dev.functions.local.nhost.run:1337/v1", + "NHOST_GRAPHQL_URL": "http://dev.graphql.local.nhost.run:1337/v1", + "NHOST_HASURA_URL": "http://dev.hasura.local.nhost.run:1337", "NHOST_JWT_SECRET": `{"claims_map":{"x-hasura-allowed-roles":{"path":"$.roles"},"x-hasura-default-role":"viewer","x-hasura-org-id":{"default":"public","path":"$.org"},"x-hasura-user-id":{"path":"$.sub"}},"key":"jwtSecretKey","type":"HS256"}`, - "NHOST_REGION": "", - "NHOST_STORAGE_URL": "http://local.storage.nhost.run:1337/v1", - "NHOST_SUBDOMAIN": "local", + "NHOST_REGION": "local", + "NHOST_STORAGE_URL": "http://dev.storage.local.nhost.run:1337/v1", + "NHOST_SUBDOMAIN": "dev", "NHOST_WEBHOOK_SECRET": "webhookSecret", }, ExtraHosts: []string{ @@ -64,6 +64,12 @@ func expectedGraphql() *Service { "dev.graphql.local.nhost.run:host-gateway", "dev.hasura.local.nhost.run:host-gateway", "dev.storage.local.nhost.run:host-gateway", + "local.auth.nhost.run:host-gateway", + "local.db.nhost.run:host-gateway", + "local.functions.nhost.run:host-gateway", + "local.graphql.nhost.run:host-gateway", + "local.hasura.nhost.run:host-gateway", + "local.storage.nhost.run:host-gateway", }, HealthCheck: &HealthCheck{ Test: []string{ @@ -178,14 +184,14 @@ func expectedConsole() *Service { "HASURA_GRAPHQL_USE_PREPARED_STATEMENTS": "true", "HASURA_GRAPHQL_WS_READ_COOKIE": "false", "NHOST_ADMIN_SECRET": "adminSecret", - "NHOST_AUTH_URL": "http://local.auth.nhost.run:1337/v1", - "NHOST_FUNCTIONS_URL": "http://local.functions.nhost.run:1337/v1", - "NHOST_GRAPHQL_URL": "http://local.graphql.nhost.run:1337/v1", - "NHOST_HASURA_URL": "http://local.hasura.nhost.run:1337", + "NHOST_AUTH_URL": "http://dev.auth.local.nhost.run:1337/v1", + "NHOST_FUNCTIONS_URL": "http://dev.functions.local.nhost.run:1337/v1", + "NHOST_GRAPHQL_URL": "http://dev.graphql.local.nhost.run:1337/v1", + "NHOST_HASURA_URL": "http://dev.hasura.local.nhost.run:1337", "NHOST_JWT_SECRET": `{"claims_map":{"x-hasura-allowed-roles":{"path":"$.roles"},"x-hasura-default-role":"viewer","x-hasura-org-id":{"default":"public","path":"$.org"},"x-hasura-user-id":{"path":"$.sub"}},"key":"jwtSecretKey","type":"HS256"}`, //nolint:lll - "NHOST_REGION": "", - "NHOST_STORAGE_URL": "http://local.storage.nhost.run:1337/v1", - "NHOST_SUBDOMAIN": "local", + "NHOST_REGION": "local", + "NHOST_STORAGE_URL": "http://dev.storage.local.nhost.run:1337/v1", + "NHOST_SUBDOMAIN": "dev", "NHOST_WEBHOOK_SECRET": "webhookSecret", }, ExtraHosts: []string{ @@ -196,6 +202,12 @@ func expectedConsole() *Service { "dev.graphql.local.nhost.run:host-gateway", "dev.hasura.local.nhost.run:0.0.0.0", "dev.storage.local.nhost.run:host-gateway", + "local.auth.nhost.run:host-gateway", + "local.db.nhost.run:host-gateway", + "local.functions.nhost.run:host-gateway", + "local.graphql.nhost.run:host-gateway", + "local.hasura.nhost.run:host-gateway", + "local.storage.nhost.run:host-gateway", }, HealthCheck: &HealthCheck{ Test: []string{ diff --git a/dockercompose/postgres_test.go b/dockercompose/postgres_test.go index 9da17576..5bb648be 100644 --- a/dockercompose/postgres_test.go +++ b/dockercompose/postgres_test.go @@ -33,6 +33,12 @@ func expectedPostgres(tmpdir string) *Service { "dev.graphql.local.nhost.run:host-gateway", "dev.hasura.local.nhost.run:host-gateway", "dev.storage.local.nhost.run:host-gateway", + "local.auth.nhost.run:host-gateway", + "local.db.nhost.run:host-gateway", + "local.functions.nhost.run:host-gateway", + "local.graphql.nhost.run:host-gateway", + "local.hasura.nhost.run:host-gateway", + "local.storage.nhost.run:host-gateway", }, HealthCheck: &HealthCheck{ Test: []string{"CMD-SHELL", "pg_isready -U postgres", "-d", "postgres", "-q"}, diff --git a/dockercompose/run_test.go b/dockercompose/run_test.go index 3d98dca0..403e47a9 100644 --- a/dockercompose/run_test.go +++ b/dockercompose/run_test.go @@ -97,6 +97,12 @@ func TestRun(t *testing.T) { "dev.graphql.local.nhost.run:host-gateway", "dev.hasura.local.nhost.run:host-gateway", "dev.storage.local.nhost.run:host-gateway", + "local.auth.nhost.run:host-gateway", + "local.db.nhost.run:host-gateway", + "local.functions.nhost.run:host-gateway", + "local.graphql.nhost.run:host-gateway", + "local.hasura.nhost.run:host-gateway", + "local.storage.nhost.run:host-gateway", }, Labels: map[string]string{}, Ports: []Port{ diff --git a/dockercompose/storage_test.go b/dockercompose/storage_test.go index 2410ba14..911720df 100644 --- a/dockercompose/storage_test.go +++ b/dockercompose/storage_test.go @@ -41,6 +41,12 @@ func expectedStorage() *Service { "dev.graphql.local.nhost.run:host-gateway", "dev.hasura.local.nhost.run:host-gateway", "dev.storage.local.nhost.run:host-gateway", + "local.auth.nhost.run:host-gateway", + "local.db.nhost.run:host-gateway", + "local.functions.nhost.run:host-gateway", + "local.graphql.nhost.run:host-gateway", + "local.hasura.nhost.run:host-gateway", + "local.storage.nhost.run:host-gateway", }, HealthCheck: nil, Labels: map[string]string{