NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.75k stars 13.87k forks source link

dgraph-alpha.service is broken #210746

Open KaiLemke opened 1 year ago

KaiLemke commented 1 year ago

Describe the bug

Setting up dgraph using the options services.dgraph.* results in a functioning dgraph-zero.service and a broken dgraph-alpha.service.

It seems to me dgraph is complaining about having the acl flag which is not available / appliacble for the OSS version. But the flag is not set nor are there setting or variables for ACLs.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Run sudo nixos-container create dgraph --flake 'gitlab:dgrow/dgraph.nix/5821e5bd78a39b09a5840e2877e6dbb0b5d6f398#container'
  2. Run sudo nixos-container start dgraph
  3. Run sudo nixos-container root-login dgraph
  4. Inspect dgraph-zero.service and dgraph-alpha.service

I also tried without services.settings and services.dgraph.*.host and explicitly setting --acl "" without effect.

Expected behavior

dgraph-alpha.service starts - at least if the only setting is services.dgraph.enable.

Screenshots

│[root@nixos:~]# systemctl status dgraph-alpha.service --no-pager                                                                                                            │
│× dgraph-alpha.service - Dgraph native GraphQL database with a graph backend. Alpha serves data                                                                             │
│     Loaded: loaded (/etc/systemd/system/dgraph-alpha.service; enabled; preset: enabled)                                                                                    │
│     Active: failed (Result: exit-code) since Sat 2023-01-14 15:50:15 CET; 2min 0s ago                                                                                      │
│   Duration: 1.680s                                                                                                                                                         │
│    Process: 547 ExecStart=/nix/store/ap20fmyxk9yw2xp1m4w4cdx1wyan7w6m-dgraph/bin/dgraph alpha --config /nix/store/60mj6qdggdyvymmjnfcvl5f2wzzgbr95-config.json --my 0.0.0.0│
│:7080 --zero 0.0.0.0:5080 (code=exited, status=1/FAILURE)                                                                                                                   │
│   Main PID: 547 (code=exited, status=1/FAILURE)                                                                                                                            │
│        CPU: 1.697s                                                                                                                                                         │
│                                                                                                                                                                            │
│Jan 14 15:50:15 nixos systemd[1]: dgraph-alpha.service: Scheduled restart job, restart counter is at 5.                                                                     │
│Jan 14 15:50:15 nixos systemd[1]: Stopped Dgraph native GraphQL database with a graph backend. Alpha serves data.                                                           │
│Jan 14 15:50:15 nixos systemd[1]: dgraph-alpha.service: Consumed 1.697s CPU time.                                                                                           │
│Jan 14 15:50:15 nixos systemd[1]: dgraph-alpha.service: Start request repeated too quickly.                                                                                 │
│Jan 14 15:50:15 nixos systemd[1]: dgraph-alpha.service: Failed with result 'exit-code'.                                                                                     │
│Jan 14 15:50:15 nixos systemd[1]: Failed to start Dgraph native GraphQL database with a graph backend. Al…es data.                                                          │
│Hint: Some lines were ellipsized, use -l to show in full.                                                                                                                   │
│                                                                                                                                                                            │
│[root@nixos:~]# /nix/store/ap20fmyxk9yw2xp1m4w4cdx1wyan7w6m-dgraph/bin/dgraph alpha --config /nix/store/60mj6qdggdyvymmjnfcvl5f2wzzgbr95-config.json --my 0.0.0.0:7080 --zer│
│o 0.0.0.0:5080                                                                                                                                                              │
│[Sentry] 2023/01/14 15:52:37 Integration installed: ContextifyFrames                                                                                                        │
│[Sentry] 2023/01/14 15:52:37 Integration installed: Environment                                                                                                             │
│[Sentry] 2023/01/14 15:52:37 Integration installed: Modules                                                                                                                 │
│[Sentry] 2023/01/14 15:52:37 Integration installed: IgnoreErrors                                                                                                            │
│[Sentry] 2023/01/14 15:52:38 Integration installed: ContextifyFrames                                                                                                        │
│[Sentry] 2023/01/14 15:52:38 Integration installed: Environment                                                                                                             │
│[Sentry] 2023/01/14 15:52:38 Integration installed: Modules                                                                                                                 │
│[Sentry] 2023/01/14 15:52:38 Integration installed: IgnoreErrors                                                                                                            │
│I0114 15:52:38.553426     613 sentry_integration.go:48] This instance of Dgraph will send anonymous reports of panics back to Dgraph Labs via Sentry. No confidential inform│
│ation is sent. These reports help improve Dgraph. To opt-out, restart your instance with the --telemetry "sentry=false;" flag. For more info, see https://dgraph.io/docs/how│
│to/#data-handling.                                                                                                                                                          │
│[Sentry] 2023/01/14 15:52:38 Sending fatal event [ca69f68c038242bcb50bbc63fc3a554f] to o318308.ingest.sentry.io project: 1805390                                            │
│2023/01/14 15:52:38 flags: acl / encryption is an enterprise-only feature                                                                                                   │
│                                                                                                                                                                            │
│github.com/dgraph-io/dgraph/x.Check                                                                                                                                         │
│        github.com/dgraph-io/dgraph/x/error.go:42                                                                                                                           │
│github.com/dgraph-io/dgraph/dgraph/cmd/alpha.run                                                                                                                            │
│        github.com/dgraph-io/dgraph/dgraph/cmd/alpha/run.go:659                                                                                                             │
│github.com/dgraph-io/dgraph/dgraph/cmd/alpha.init.0.func1                                                                                                                   │
│        github.com/dgraph-io/dgraph/dgraph/cmd/alpha/run.go:95                                                                                                              │
│github.com/spf13/cobra.(*Command).execute                                                                                                                                   │
│        github.com/spf13/cobra@v0.0.5/command.go:830                                                                                                                        │
│github.com/spf13/cobra.(*Command).ExecuteC                                                                                                                                  │
│        github.com/spf13/cobra@v0.0.5/command.go:914                                                                                                                        │
│github.com/spf13/cobra.(*Command).Execute                                                                                                                                   │
│        github.com/spf13/cobra@v0.0.5/command.go:864                                                                                                                        │
│github.com/dgraph-io/dgraph/dgraph/cmd.Execute                                                                                                                              │
│        github.com/dgraph-io/dgraph/dgraph/cmd/root.go:78                                                                                                                   │
│main.main                                                                                                                                                                   │
│        github.com/dgraph-io/dgraph/dgraph/main.go:99                                                                                                                       │
│runtime.main                                                                                                                                                                │
│        runtime/proc.go:250                                                                                                                                                 │
│runtime.goexit                                                                                                                                                              │
│        runtime/asm_amd64.s:1594                                                                                                                                            │
│                                                                                                                                                                            │
│[root@nixos:~]# cat /nix/store/nix/store/60mj6qdggdyvymmjnfcvl5f2wzzgbr95-config.json                                                                                       │
│cat: /nix/store/nix/store/60mj6qdggdyvymmjnfcvl5f2wzzgbr95-config.json: No such file or directory                                                                           │
│                                                                                                                                                                            │
│[root@nixos:~]# cat /nix/store/60mj6qdggdyvymmjnfcvl5f2wzzgbr95-config.json                                                                                                 │
│{                                                                                                                                                                           │
│  "badger": {                                                                                                                                                               │
│    "compression": "zstd:3"                                                                                                                                                 │
│  },                                                                                                                                                                        │
│  "security": {                                                                                                                                                             │
│    "whitelist": "127.0.0.1,localhost,10.233.1.1"                                                                                                                           │
│  }                                                                                                                                                                         │
│}                                                                                                                                                                           │
│                                                                                                                                                                            │
│[root@nixos:~]# /nix/store/ap20fmyxk9yw2xp1m4w4cdx1wyan7w6m-dgraph/bin/dgraph version                                                                                       │
│Dgraph version   : 22.0.1-oss                                                                                                                                               │
│Dgraph codename  :                                                                                                                                                          │
│Dgraph SHA-256   : 6058f6b0803e2b6c4af2d7e276bf6b333b28ac5af954138a00ef42b903346228                                                                                         │
│Commit SHA-1     :                                                                                                                                                          │
│Commit timestamp :                                                                                                                                                          │
│Branch           :                                                                                                                                                          │
│Go version       : go1.19.4                                                                                                                                                 │
│jemalloc enabled : false                                                                                                                                                    │
│                                                                                                                                                                            │
│For Dgraph official documentation, visit https://dgraph.io/docs.                                                                                                            │
│For discussions about Dgraph     , visit https://discuss.dgraph.io.                                                                                                         │
│For fully-managed Dgraph Cloud   , visit https://dgraph.io/cloud.                                                                                                           │

Notify maintainers

@sigma (package maintainer) @happysalada (module maintainer) @pennae (last module editor)

Metadata

nix-info -m                                                                                                            01/14/2023 08:03:09 PM│
│error: getting status of '/home/kai/src/nixpkgs-mozilla/rust-overlay.nix': No such file or directory                                                                        │
│ - system: `0`                                                                                                                                                              │
│ - host os: `Linux 5.15.86, NixOS, 22.11 (Raccoon), 22.11.20230113.e285dd0`                                                                                                 │
│ - multi-user?: `no`                                                                                                                                                        │
│ - sandbox: `yes`                                                                                                                                                           │
│ - version: `nix-env (Nix) 2.11.1`                                                                                                                                          │
│ - channels(root): `"home-manager-22.05.tar.gz, home-manager-21.11-21.11.tar.gz, nixos-22.05, nixos-21.11-21.11"`                                                           │
│ - channels(kai): `"home-manager-20.09, nixos-20.09.2497.4a75ca4a4e7"`                                                                                                      │
│ - nixpkgs: `/nix/store/jkl0nk32sz83k6dm15lm8hqv2ack463w-source` 

Yes, I know it's broken, but the system is configured via nix flakes only and I don't have problems with containers usually.

KaiLemke commented 1 year ago

For comparison: If I start a docker container with https://hub.docker.com/layers/dgraph/standalone/v22.0.1/images/sha256-f649c7e17a0c9c7fd5fce4a0b398c3d16a9ed67bbbb59d3096985f204e091435?context=explore, I get no logs about this acl flag and dgraph version looks like this:

root@c642d9fce01c:/dgraph# dgraph version

Dgraph version   : v22.0.1
Dgraph codename  : dgraph
Dgraph SHA-256   : 52c4ae7b827c72a04325af9659642c099faf8f2d7dcb2f2326f777b78cd3b749
Commit SHA-1     : 7fb5291
Commit timestamp : 2022-11-11 04:13:12 +0000
Branch           : release/v22.0.1
Go version       : go1.18.5
jemalloc enabled : true

For Dgraph official documentation, visit https://dgraph.io/docs.
For discussions about Dgraph     , visit https://discuss.dgraph.io.
For fully-managed Dgraph Cloud   , visit https://dgraph.io/cloud.

Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Copyright 2015-2021 Dgraph Labs, Inc.

I get the same failure just running dgraph zero & dgraph alpha with dgraph from nix shell 'nixpkgs/nixos-22.11#dgraph'.

The version from nixos-22.05 worked fine, though the version output differed also:

docker dgraph/standalone:21.12.0:

root@8ecde959ca9a:/dgraph# dgraph version

Dgraph version   : v21.12.0
Dgraph codename  : zion
Dgraph SHA-256   : 078c75df9fa1057447c8c8afc10ea57cb0a29dfb22f9e61d8c334882b4b4eb37
Commit SHA-1     : d62ed5f15
Commit timestamp : 2021-12-02 21:20:09 +0530
Branch           : HEAD
Go version       : go1.17.3
jemalloc enabled : true

For Dgraph official documentation, visit https://dgraph.io/docs.
For discussions about Dgraph     , visit https://discuss.dgraph.io.
For fully-managed Dgraph Cloud   , visit https://dgraph.io/cloud.

Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Copyright 2015-2021 Dgraph Labs, Inc.

nix shell:

/home/kai〉dgraph version                                                                     01/14/2023 08:28:15 PM

Dgraph version   : 21.12.0-oss
Dgraph codename  :
Dgraph SHA-256   : a563adbc35aa085d39b33846b2eb3290594ae441046f5d6ce102968bd36f1c5c
Commit SHA-1     :
Commit timestamp :
Branch           :
Go version       : go1.17.13
jemalloc enabled : false

For Dgraph official documentation, visit https://dgraph.io/docs.
For discussions about Dgraph     , visit https://discuss.dgraph.io.
For fully-managed Dgraph Cloud   , visit https://dgraph.io/cloud.

Licensed under the Apache Public License 2.0.
Copyright 2015-2021 Dgraph Labs, Inc.

What's different in 22.11 is, that the go version is different from the official docker image, in 22.05 not.

happysalada commented 1 year ago

Hey thanks for reporting ! I havent run dgraph in a whike unfortunately. I see two things that could potentially help. Update the version of dgraph to the latest. Check the output of the command journalctl -u dgraph-alpha There might be additional information in there.

KaiLemke commented 1 year ago

Hi, I tried to upgrade to v22.0.2, but the build failed due to a dependency:

@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/65ah74r0hqzajr6cp0z9wswap4xcykn5-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
@nix { "action": "setPhase", "phase": "buildPhase" }
building
Building subPackage ./dgraph
vendor/golang.org/x/sys/unix/syscall.go:83:16: unsafe.Slice requires go1.17 or later (-lang was set to go1.16; check go.mod)
vendor/golang.org/x/sys/unix/syscall_linux.go:2255:9: unsafe.Slice requires go1.17 or later (-lang was set to go1.16; check go.mod)
vendor/golang.org/x/sys/unix/syscall_unix.go:118:7: unsafe.Slice requires go1.17 or later (-lang was set to go1.16; check go.mod)

I'm a bit confused, because go.mod lists golang.org/x/sys v0.0.0-20221010170243-090e33056c14, but https://deps.dev/go/golang.org%2Fx%2Fsys/v0.4.0/versions does not list that version.

Also buildGoModule should use go1.19 - where does the go1.16 come from? I didn't work with buildGoModule before. So sorry, if I'm asking obvious things. ;)

Have you any ideas what's going on here?

KaiLemke commented 1 year ago

For completeness I already started a draft merge request: #212130

happysalada commented 1 year ago

Just as foreign to me. I dont know where this could come from.

I tried searching in yhe dgraph repo to see if it wasnt something set there. Couldnt find anything

I also tried changing the go version in nix to 18 and 17, but same failure.

I wish i knew more about go, but unfortunately, im a rust dev.