Skip to content

Commit

Permalink
feat: node18 is now mandatory (#781)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarrosop authored Oct 1, 2023
1 parent 6e8822b commit 7bad17e
Show file tree
Hide file tree
Showing 15 changed files with 86 additions and 34 deletions.
3 changes: 2 additions & 1 deletion cmd/config/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func commandExample(cCtx *cli.Context) error { //nolint:funlen,maintidx
},
Functions: &model.ConfigFunctions{
Node: &model.ConfigFunctionsNode{
Version: ptr(int(16)),
Version: ptr(int(18)),
},
},
Auth: &model.ConfigAuth{
Expand Down Expand Up @@ -266,6 +266,7 @@ func commandExample(cCtx *cli.Context) error { //nolint:funlen,maintidx
Replicas: 1,
},
Settings: &model.ConfigPostgresSettings{
Jit: ptr("off"),
MaxConnections: ptr(int32(100)),
SharedBuffers: ptr("128MB"),
EffectiveCacheSize: ptr("4GB"),
Expand Down
2 changes: 1 addition & 1 deletion cmd/config/testdata/validate/success/nhost/nhost.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ httpPoolSize = 100

[functions]
[functions.node]
version = 16
version = 18

[auth]
version = '0.20.0'
Expand Down
2 changes: 1 addition & 1 deletion cmd/config/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func expectedConfig() *model.ConfigConfig {
Logs: &model.ConfigHasuraLogs{Level: ptr("warn")},
Events: &model.ConfigHasuraEvents{HttpPoolSize: ptr(uint32(100))},
},
Functions: &model.ConfigFunctions{Node: &model.ConfigFunctionsNode{Version: ptr(16)}},
Functions: &model.ConfigFunctions{Node: &model.ConfigFunctionsNode{Version: ptr(18)}},
Auth: &model.ConfigAuth{
Version: ptr("0.20.0"),
Redirections: &model.ConfigAuthRedirections{
Expand Down
14 changes: 2 additions & 12 deletions cmd/dev/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ const (
flagsFunctionsPort = "functions-port"
flagsHasuraPort = "hasura-port"
flagsHasuraConsolePort = "hasura-console-port"
flagsNode18 = "node18"
)

const (
defaultHTTPPort = 443
defaultPostgresPort = 5432
)

func CommandUp() *cli.Command { //nolint:funlen
func CommandUp() *cli.Command {
return &cli.Command{ //nolint:exhaustruct
Name: "up",
Aliases: []string{},
Expand Down Expand Up @@ -89,11 +88,6 @@ func CommandUp() *cli.Command { //nolint:funlen
Usage: "If specified, expose hasura console on this port. Not recommended",
Value: 0,
},
&cli.BoolFlag{ //nolint:exhaustruct
Name: flagsNode18,
Usage: "Use node 18. Defaults to node 16",
Value: false,
},
},
}
}
Expand Down Expand Up @@ -129,7 +123,6 @@ func commandUp(cCtx *cli.Context) error {
Console: cCtx.Uint(flagsHasuraConsolePort),
Functions: cCtx.Uint(flagsFunctionsPort),
},
cCtx.Bool(flagsNode18),
)
}

Expand Down Expand Up @@ -187,7 +180,6 @@ func up( //nolint:funlen
postgresPort uint,
applySeeds bool,
ports dockercompose.ExposePorts,
useNode18 bool,
) error {
ctx, cancel := context.WithCancel(ctx)

Expand Down Expand Up @@ -215,7 +207,6 @@ func up( //nolint:funlen
ce.Path.DotNhostFolder(),
ce.Path.Root(),
ports,
useNode18,
)
if err != nil {
return fmt.Errorf("failed to generate docker-compose.yaml: %w", err)
Expand Down Expand Up @@ -287,12 +278,11 @@ func Up(
postgresPort uint,
applySeeds bool,
ports dockercompose.ExposePorts,
useNode18 bool,
) error {
dc := dockercompose.New(ce.Path.WorkingDir(), ce.Path.DockerCompose(), ce.ProjectName())

if err := up(
ctx, ce, dc, httpPort, useTLS, postgresPort, applySeeds, ports, useNode18,
ctx, ce, dc, httpPort, useTLS, postgresPort, applySeeds, ports,
); err != nil {
ce.Warnln(err.Error())

Expand Down
10 changes: 1 addition & 9 deletions dockercompose/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ func functions( //nolint:funlen
rootFolder string,
jwtSecret string,
port uint,
useNode18 bool,
) *Service {
envVars := map[string]string{
"HASURA_GRAPHQL_ADMIN_SECRET": cfg.Hasura.AdminSecret,
Expand All @@ -319,13 +318,8 @@ func functions( //nolint:funlen
envVars[envVar.GetName()] = envVar.GetValue()
}

image := "nhost/functions:0.1.9"
if useNode18 {
image = "nhost/functions:1.0.0"
}

return &Service{
Image: image,
Image: "nhost/functions:1.0.0",
DependsOn: nil,
EntryPoint: nil,
Command: nil,
Expand Down Expand Up @@ -434,7 +428,6 @@ func ComposeFileFromConfig( //nolint:funlen
dotNhostFolder string,
rootFolder string,
ports ExposePorts,
useNode18 bool,
) (*ComposeFile, error) {
minio, err := minio(dataFolder)
if err != nil {
Expand Down Expand Up @@ -490,7 +483,6 @@ func ComposeFileFromConfig( //nolint:funlen
rootFolder,
jwtSecret,
ports.Functions,
useNode18,
),
"graphql": graphql,
"minio": minio,
Expand Down
2 changes: 1 addition & 1 deletion dockercompose/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func getConfig() *model.ConfigConfig { //nolint:maintidx
},
Functions: &model.ConfigFunctions{
Node: &model.ConfigFunctionsNode{
Version: ptr(16),
Version: ptr(18),
},
},
Hasura: &model.ConfigHasura{
Expand Down
2 changes: 1 addition & 1 deletion examples/myproject/nhost/nhost.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ liveQueriesMultiplexedRefetchInterval = 3000

[functions]
[functions.node]
version = 16
version = 18

[auth]
version = '0.21.2'
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/go-git/go-git/v5 v5.9.0
github.com/google/go-cmp v0.5.9
github.com/hashicorp/go-getter v1.7.2
github.com/nhost/be v0.0.0-20230927103250-70010e0e7eac
github.com/nhost/be v0.0.0-20231001065154-f72edc119cf0
github.com/pelletier/go-toml/v2 v2.0.8
github.com/urfave/cli/v2 v2.25.7
github.com/wI2L/jsondiff v0.4.0
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,8 @@ github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo=
github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8=
github.com/nhost/be v0.0.0-20230926093342-5b218de2929f h1:Ws9TS33VKX3w+36k18utttmAeiwFQQBNwEpTz7vLJYU=
github.com/nhost/be v0.0.0-20230926093342-5b218de2929f/go.mod h1:TX+opGjg0+Q7LflEByl4E8B8hlu1huf4t2TY3YzUA9c=
github.com/nhost/be v0.0.0-20230927103250-70010e0e7eac h1:yCWxfY84DgC5oQYjFJ3s1YJ54jKphlLJlIIIRtXwbv4=
github.com/nhost/be v0.0.0-20230927103250-70010e0e7eac/go.mod h1:TX+opGjg0+Q7LflEByl4E8B8hlu1huf4t2TY3YzUA9c=
github.com/nhost/be v0.0.0-20231001065154-f72edc119cf0 h1:cKSejJFrMjUBamyWotU1fTxU8Y7SCvkRL1bt03uMIyA=
github.com/nhost/be v0.0.0-20231001065154-f72edc119cf0/go.mod h1:TX+opGjg0+Q7LflEByl4E8B8hlu1huf4t2TY3YzUA9c=
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
Expand Down
55 changes: 55 additions & 0 deletions vendor/github.com/nhost/be/services/mimir/model/cuegraph_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/github.com/nhost/be/services/mimir/schema/schema.cue

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7bad17e

Please sign in to comment.