devbox icon indicating copy to clipboard operation
devbox copied to clipboard

[Feature]: mongodb plugin

Open andr-ec opened this issue 2 years ago • 4 comments

Is your feature request related to a problem you're trying to solve? Please describe. It would be great to have a plugin for mongodb

Describe the solution you'd like There's plugins for other databases: https://www.jetpack.io/devbox/docs/devbox_examples/databases/postgres/ A plugin for mongodb would be great as well.

Describe alternatives you've considered devbox add mongodb

Additional context

andr-ec avatar Jul 31 '23 21:07 andr-ec

Hey @andr-ec

We now have a mongodb plugin available in our Plugins Repo:https://github.com/jetpack-io/devbox-plugins/tree/main/mongodb

You can add the mongodb plugin directly from github by adding the following line to the include section of your devbox.json:

"include": [
    "github:jetpack-io/devbox-plugins?dir=mongodb"
],

Please try this out and let me know if this works for you!

Lagoja avatar Aug 10 '23 17:08 Lagoja

@Lagoja I added that section to the devbox.json and I'm getting an error:

DEVBOX_DEBUG=1 devbox install
2023/08/14 13:11:00 findProjectDir: path is 
2023/08/14 13:11:00 finding devbox.json in dir: /home/andre/Documents/qreate-server
2023/08/14 13:11:00 findProjectDir: path is 
2023/08/14 13:11:00 finding devbox.json in dir: /home/andre/Documents/qreate-server
[DEBUG] 2023/08/14 13:11:00 go.jetpack.io/devbox/internal/boxcli/midcobra/debug.go:51: Debug mode enabled.
[DEBUG] 2023/08/14 13:11:00 go.jetpack.io/devbox/internal/impl/dir.go:22: findProjectDir: path is 
[DEBUG] 2023/08/14 13:11:00 go.jetpack.io/devbox/internal/impl/dir.go:66: finding devbox.json in dir: /home/andre/Documents/qreate-server
Ensuring packages are installed.
[DEBUG] 2023/08/14 13:11:00 go.jetpack.io/devbox/internal/nix/search.go:95: running command: /run/current-system/sw/bin/nix search --json path:/home/andre/Documents/qreate-server#yarn --extra-experimental-features ca-derivations --option experimental-features nix-command flakes
[DEBUG] 2023/08/14 13:13:33 go.jetpack.io/devbox/internal/nix/search.go:95: running command: /run/current-system/sw/bin/nix search --json path:/home/andre/Documents/qreate-server#packages.x86_64-linux.yarn --extra-experimental-features ca-derivations --option experimental-features nix-command flakes
[DEBUG] 2023/08/14 13:15:25 go.jetpack.io/devbox/internal/plugin/plugin.go:99: Creating files for package "python3@latest" create files
[DEBUG] 2023/08/14 13:15:25 go.jetpack.io/devbox/internal/plugin/plugin.go:99: Creating files for package &{"jetpack-io/devbox-plugins?dir=mongodb" "jetpack-io" "devbox-plugins" "master" "mongodb"} create files
[DEBUG] 2023/08/14 13:15:25 go.jetpack.io/devbox/internal/plugin/plugin.go:135: Creating file "/home/andre/Documents/qreate-server/.devbox/virtenv/jetpack-io-devbox-plugins/process-compose.yaml" from contentPath: "config/process-compose.yaml"
[DEBUG] 2023/08/14 13:15:25 go.jetpack.io/devbox/internal/nix/search.go:95: running command: /run/current-system/sw/bin/nix search --json path:/home/andre/Documents/qreate-server#yarn --extra-experimental-features ca-derivations --option experimental-features nix-command flakes
Reinitialized existing Git repository in /home/andre/Documents/qreate-server/.devbox/gen/flake/.git/
[DEBUG] 2023/08/14 13:16:29 go.jetpack.io/devbox/internal/impl/devbox.go:764: current environment PATH is: /home/andre/.vscode-server/bin/6c3e3dba23e8fadc360aed75ce363ba185c49794/bin/remote-cli:/run/wrappers/bin:/home/andre/.nix-profile/bin:/etc/profiles/per-user/andre/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/home/andre/.config/zsh/plugins/zsh-syntax-highlighting:/home/andre/.config/zsh/plugins/zsh-autopair:/home/andre/.zsh/plugins/zsh-syntax-highlighting:/home/andre/.zsh/plugins/zsh-autopair
[DEBUG] 2023/08/14 13:16:29 go.jetpack.io/devbox/internal/nix/nix.go:72: Running print-dev-env cmd: /run/current-system/sw/bin/nix print-dev-env /home/andre/Documents/qreate-server/.devbox/gen/flake/flake.nix --extra-experimental-features ca-derivations --option experimental-features nix-command flakes --json
Error: Command: /run/current-system/sw/bin/nix print-dev-env /home/andre/Documents/qreate-server/.devbox/gen/flake/flake.nix --extra-experimental-features ca-derivations --option experimental-features nix-command flakes --json: exit status 102

[DEBUG] 2023/08/14 13:17:14 go.jetpack.io/devbox/internal/boxcli/midcobra/debug.go:72: Command stderr: path '/home/andre/Documents/qreate-server/.devbox/gen/flake/flake.nix' does not contain a 'flake.nix', searching up
warning: Git tree '/home/andre/Documents/qreate-server/.devbox/gen/flake' is dirty
error: NAR hash mismatch in input 'path:/home/andre/Documents/qreate-server?lastModified=1691606282&narHash=sha256-qm0FbeIoigD3bsP4csVknM5N+eKqyjJPE36FgYBvBYo=' (/nix/store/aqkvf97326ikq8vnzzynjgc79qagzl34-source), expected 'sha256-qm0FbeIoigD3bsP4csVknM5N+eKqyjJPE36FgYBvBYo=', got 'sha256-wQcJETInp112oWfapBalPcdQCOaQVKSgvm0XDD5wDv4='
(use '--show-trace' to show detailed location information)

[DEBUG] 2023/08/14 13:17:14 go.jetpack.io/devbox/internal/boxcli/midcobra/debug.go:74: 
ExecutionID:54cde6ad60834472999e7984c53999d0
exit status 102
Command: /run/current-system/sw/bin/nix print-dev-env /home/andre/Documents/qreate-server/.devbox/gen/flake/flake.nix --extra-experimental-features ca-derivations --option experimental-features nix-command flakes --json
go.jetpack.io/devbox/internal/nix.(*Nix).PrintDevEnv
        go.jetpack.io/devbox/internal/nix/nix.go:77
go.jetpack.io/devbox/internal/impl.(*Devbox).computeNixEnv
        go.jetpack.io/devbox/internal/impl/devbox.go:776
go.jetpack.io/devbox/internal/impl.(*Devbox).ensurePackagesAreInstalled
        go.jetpack.io/devbox/internal/impl/packages.go:212
go.jetpack.io/devbox/internal/impl.(*Devbox).PrintEnv
        go.jetpack.io/devbox/internal/impl/devbox.go:288
go.jetpack.io/devbox/internal/impl.(*Devbox).Install
        go.jetpack.io/devbox/internal/impl/devbox.go:267
go.jetpack.io/devbox/internal/boxcli.installCmdFunc
        go.jetpack.io/devbox/internal/boxcli/install.go:42
go.jetpack.io/devbox/internal/boxcli.installCmd.func1
        go.jetpack.io/devbox/internal/boxcli/install.go:24
github.com/spf13/cobra.(*Command).execute
        github.com/spf13/[email protected]/command.go:916
github.com/spf13/cobra.(*Command).ExecuteC
        github.com/spf13/[email protected]/command.go:1044
github.com/spf13/cobra.(*Command).Execute
        github.com/spf13/[email protected]/command.go:968
go.jetpack.io/devbox/internal/boxcli/midcobra.(*midcobraExecutable).Execute
        go.jetpack.io/devbox/internal/boxcli/midcobra/midcobra.go:61
go.jetpack.io/devbox/internal/boxcli.Execute
        go.jetpack.io/devbox/internal/boxcli/root.go:103
go.jetpack.io/devbox/internal/boxcli.Main
        go.jetpack.io/devbox/internal/boxcli/root.go:124
main.main
        go.jetpack.io/devbox/cmd/devbox/main.go:11
runtime.main
        runtime/proc.go:250
runtime.goexit
        runtime/asm_amd64.s:1598
[DEBUG] 2023/08/14 13:17:14 go.jetpack.io/devbox/internal/impl/dir.go:22: findProjectDir: path is 
[DEBUG] 2023/08/14 13:17:14 go.jetpack.io/devbox/internal/impl/dir.go:66: finding devbox.json in dir: /home/andre/Documents/qreate-server

andr-ec avatar Aug 14 '23 19:08 andr-ec

I ran it again and then it worked. Looks like if I change the devbox.json, it fails the first time then works the second time. that looks like it's a separate issue

Though it looks like it creates the service now, but it looks like it fails:

bash: line 1: mongod: command not found
bash: line 1: mongod: command not found
bash: line 1: mongod: command not found
bash: line 1: mongod: command not found
bash: line 1: mongod: command not found
bash: line 1: mongod: command not found

The STATUS in process-compose says Completed.

For some context, in my case I'm trying to use it with an existing process-compose.yaml. are there any special instructions to make that work? I've only defined another service which will need to depend on mongodb.

andr-ec avatar Aug 14 '23 22:08 andr-ec

If anyone finds this, you also need to add the mongodb package:

  "packages": [
    "[email protected]",
    "[email protected]", // optional
    ]

On MacOS, 6.0.16 does not work. Neither does any version < 6 if you are using Apple Silicon M1

svallory avatar Jul 24 '24 19:07 svallory