Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devenv up with process-compose unable to start on macOS #1578

Open
cyphase opened this issue Nov 7, 2024 · 15 comments
Open

devenv up with process-compose unable to start on macOS #1578

cyphase opened this issue Nov 7, 2024 · 15 comments
Labels
bug Something isn't working macos Affects systems running macOS

Comments

@cyphase
Copy link

cyphase commented Nov 7, 2024

Describe the bug
A new colleague tried (less than an hour ago) to devenv up on macOS and got this error:

(devenv) Colleagues-MacBook-Pro:project_dir colleague$ devenv up
• Building processes ...
• Using Cachix: devenv
these 2 derivations will be built:
/nix/store/l9zcxbyzmpwi52m38nfzgk3g1h054snx-process-compose.yaml.drv
/nix/store/lv36znwsz5s7ihav11j24py15qbk8vh0-devenv-up.drv
building '/nix/store/l9zcxbyzmpwi52m38nfzgk3g1h054snx-process-compose.yaml.drv'
building '/nix/store/lv36znwsz5s7ihav11j24py15qbk8vh0-devenv-up.drv'
✔ Building processes in 3.6s.
• Starting processes ...
• Building shell ...
✔ Building shell in 0.1s.
Running tasks devenv:enterShell
Succeeded devenv:pre-commit:install 48ms
Succeeded devenv:enterShell 15ms
2 Succeeded 65.19ms

{"level":"warn","error":"open /Users/colleague/Library/Application Support/process-compose/settings.yaml: no such file or directory","time":"2024-11-07T14:46:08-05:00","message":"Error reading settings file /Users/colleague/Library/Application Support/process-compose/settings.yaml"}
24-11-07 14:46:08.464 FTL start UDS http server on /tmp/nix-shell.ppHu99/devenv-d16d6f7/pc.sock failed error="listen unix /tmp/nix-shell.ppHu99/devenv-d16d6f7/pc.sock: bind: no such file or directory"
(devenv) Colleagues-MacBook-Pro:project_dir colleague$

Prior similar issue: #1153

To reproduce
I don't have all the details at the moment, nor a Mac to try it on. So for now:

  1. Follow Getting Started guide to install Nix and devenv
  2. devenv shell, which works after making the user trusted in nix.conf
  3. devenv up gives the error shown above

Version

I would guess 1.3.1, since Nix and devenv were both freshly installed less than an hour ago.

@cyphase cyphase added the bug Something isn't working label Nov 7, 2024
@sandydoo sandydoo added the macos Affects systems running macOS label Nov 7, 2024
@sandydoo
Copy link
Member

sandydoo commented Nov 7, 2024

Huh, I wonder why this is popping back up again.

Is your colleague using flakes or plain devenv?

@cyphase
Copy link
Author

cyphase commented Nov 7, 2024

I'm guessing plain devenv (nix-env -iA devenv -f https://github.com/NixOS/nixpkgs/tarball/nixpkgs-unstable), but I suppose it's conceivable (if unlikely) they ran nix profile install --accept-flake-config nixpkgs#devenv from https://devenv.sh/getting-started/. I'll check and get back to you.

@cyphase
Copy link
Author

cyphase commented Nov 7, 2024

Would process.managers.process-compose.unixSocket.path facilitate a good workaround?

If not that, process.managers.process-compose.unixSocket.enable sounds like it would, though perhaps at the cost of some non-zero increase in attack surface.

https://devenv.sh/supported-process-managers/process-compose/

@sandydoo
Copy link
Member

sandydoo commented Nov 8, 2024

The issue here is that the path to devenv's runtime directory has been mangled by nix develop between launching the shell and the processes. nix-shell.ppHu99 is not supposed to be in that path. The process-compose error is a symptom of this issue.

You could try running the devenv commands with --refresh-eval-cache, in case this is a caching issue.

@vele-dan-alexandru
Copy link

vele-dan-alexandru commented Nov 18, 2024

Ran into this issue as well.

{"level":"warn","error":"open /Library/Application Support/process-compose/settings.yaml: no such file or directory","time":"2024-11-18T12:20:29+02:00","message":"Error reading settings file /Library/Application Support/process-compose/settings.yaml"}
panic: exit status 1

goroutine 23 [running]:
github.com/f1bonacc1/process-compose/src/tui.SetupTui({0x104b7af40?, 0x140000d1ea0?}, {0x14000061f70, 0x3, 0x0?})
	github.com/f1bonacc1/process-compose/src/tui/view.go:505 +0x174
github.com/f1bonacc1/process-compose/src/cmd.startTui({0x104b7af40, 0x140000d1ea0})
	github.com/f1bonacc1/process-compose/src/cmd/project_runner.go:89 +0x188
created by github.com/f1bonacc1/process-compose/src/cmd.runTui in goroutine 1
	github.com/f1bonacc1/process-compose/src/cmd/project_runner.go:73 +0x68

devenv 1.3.1 NOT using flake but i have this set impure: true in devenv.yaml as i need it for older openssl-1.1.1w.

Also ran command with --refresh-eval-cache but nothing changed.

Anyone found a workaround for this?

@sandydoo
Copy link
Member

Ran into this issue as well.

{"level":"warn","error":"open /Library/Application Support/process-compose/settings.yaml: no such file or directory","time":"2024-11-18T12:20:29+02:00","message":"Error reading settings file /Library/Application Support/process-compose/settings.yaml"}
panic: exit status 1

goroutine 23 [running]:
github.com/f1bonacc1/process-compose/src/tui.SetupTui({0x104b7af40?, 0x140000d1ea0?}, {0x14000061f70, 0x3, 0x0?})
	github.com/f1bonacc1/process-compose/src/tui/view.go:505 +0x174
github.com/f1bonacc1/process-compose/src/cmd.startTui({0x104b7af40, 0x140000d1ea0})
	github.com/f1bonacc1/process-compose/src/cmd/project_runner.go:89 +0x188
created by github.com/f1bonacc1/process-compose/src/cmd.runTui in goroutine 1
	github.com/f1bonacc1/process-compose/src/cmd/project_runner.go:73 +0x68

devenv 1.3.1 NOT using flake but i have this set impure: true in devenv.yaml as i need it for older openssl-1.1.1w.

Also ran command with --refresh-eval-cache but nothing changed.

Anyone found a workaround for this?

Not the same issue at all. Your process-compose has crashed for some reason. I would suggest opening a separate issue with all of the relevant details.

@dwt
Copy link

dwt commented Nov 23, 2024

Maybe I'm having the same issue?

❯ devenv --refresh-eval-cache up
• Building processes ...
• Using Cachix: devenv
✔ Building processes in 3.2s.
• Starting processes ...
• Building shell ...
✔ Building shell in 1.4s.
Running tasks     devenv:enterShell
Succeeded         devenv:enterShell 16ms
1 Succeeded                         17.20ms

{"level":"warn","error":"open /Users/dwt/Library/Application Support/process-compose/settings.yaml: no such file or directory","time":"2024-11-23T22:22:18+01:00","message":"Error reading settings file /Users/dwt/Library/Application Support/process-compose/settings.yaml"}

At least it looks very similar?

❯ devenv version
devenv 1.3.1 (aarch64-darwin)

Any other information I can provide?

process-compose seems to be installed by nix:

type process-compose
process-compose is /nix/store/92vxs9yvnjaiiwqr2m77vzcb5qnanwgm-process-compose-1.2.0/bin/process-compose

@sandydoo
Copy link
Member

@dwt, if you're talking about the warning, then it can safely be ignored. I think it was even fixed upstream.

@jkoppel
Copy link

jkoppel commented Nov 25, 2024

Same issue here. From devenv up --refresh-eval-cache.

{"level":"warn","error":"open /Users/jkoppel/Library/Application Support/process-compose/settings.yaml: no such file or directory","time":"2024-11-25T21:55:36+08:00","message":"Error reading settings file /Users/jkoppel/Library/Application Support/process-compose/settings.yaml"}
24-11-25 21:55:36.650 FTL start UDS http server on /var/folders/lb/691gtkqj3gs3ldsxlrdlphm40000gp/T/devenv-8b80667/pc.sock failed error="listen unix /var/folders/lb/691gtkqj3gs3ldsxlrdlphm40000gp/T/devenv-8b80667/pc.sock: bind: no such file or directory"

(base) [jkoppel@MacBook-Pro-173:~/uptospeed-code]$ devenv version (11-25 21:54)
devenv 1.3.0 (x86_64-darwin)

@sandydoo
Copy link
Member

Same issue here. From devenv up --refresh-eval-cache.

{"level":"warn","error":"open /Users/jkoppel/Library/Application Support/process-compose/settings.yaml: no such file or directory","time":"2024-11-25T21:55:36+08:00","message":"Error reading settings file /Users/jkoppel/Library/Application Support/process-compose/settings.yaml"} 24-11-25 21:55:36.650 FTL start UDS http server on /var/folders/lb/691gtkqj3gs3ldsxlrdlphm40000gp/T/devenv-8b80667/pc.sock failed error="listen unix /var/folders/lb/691gtkqj3gs3ldsxlrdlphm40000gp/T/devenv-8b80667/pc.sock: bind: no such file or directory"

(base) [jkoppel@MacBook-Pro-173:~/uptospeed-code]$ devenv version (11-25 21:54)
devenv 1.3.0 (x86_64-darwin)

Still slightly different 🤔 The path looks correct, unlike the one from the OP. Any specific instructions to try to replicate this?

@jkoppel
Copy link

jkoppel commented Nov 25, 2024

Just devenv up. Relevant portion:

  processes = let
    logServices = builtins.listToAttrs (map (log: {
      name = "${log}-logs";
      value = {
        exec = "docker logs -f uptospeed-${log}-1";
        process-compose = {
          availability.restart = "always";
          depends_on.docker-compose = {
            condition = "service_healthy";
          };
          namespace = "logs";
        };
      };
    }) [ "qdrant" "portkey" "minio" "langfuse-server" "backoffice-db" "meilisearch" ]);
  in {
    frontend = {
      exec = "npm run start-fe";
      process-compose = {
          working_dir = "typescript/tour-agent-mkii";
          availability.restart = "always";
      };
    };

    backend = {
      exec = "watchOrNot 'npm run start-be-watch' 'npm run start-be'";
      process-compose = {
          working_dir = "typescript/tour-agent-mkii";
          availability.restart = "always";
      };
    };

    vscode-frontend = {
      exec = "npm run watch";
      process-compose = {
          working_dir = "typescript/vscode/webview-ui";
          availability.restart = "always";
      };
    };

    vscode-backend = {
      exec = "npm run watch";
      process-compose = {
          working_dir = "typescript/vscode";
          availability.restart = "always";
      };
    };

    rusty = {
      exec = "cargo-run-with-mode";
      process-compose = {
          working_dir = "rust/crunchy";
          availability.restart = "always";
      };
    };

    langfuse-proxy = {
      exec = "watchOrNot 'npm run start' 'npm run start-watch'";
      process-compose = {
          working_dir = "typescript/crunchy-langfuse";
          availability.restart = "always";
      };
    };

    docker-compose = {
      exec = "docker compose -f docker-compose.dev.yml -p uptospeed up";
      process-compose = {
          working_dir = ".";
          availability.restart = "always";
          shutdown = {
            command = "docker compose -f docker-compose.dev.yml down";
            timeout_seconds = 30;
          };
      };
    };

  } // logServices;

@dwt
Copy link

dwt commented Nov 26, 2024

This devenv reproduced the problem for me:

{ pkgs, lib, config, inputs, ... }:

{
  # https://devenv.sh/basics/
  # https://devenv.sh/packages/
  packages = [
    pkgs.git
  ] ++ lib.optionals pkgs.stdenv.isDarwin [
    pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
  ];

  # https://devenv.sh/languages/
  languages.rust.enable = true;

  # https://devenv.sh/processes/
  processes.cargo-watch.exec = "cargo-watch";

  # https://devenv.sh/scripts/
  scripts.install.exec = ''
    cargo install --path .
  '';

  enterShell = ''
  '';

  # https://devenv.sh/tasks/
  # https://devenv.sh/tests/
  enterTest = ''
    # echo "Running tests"
    # git --version | grep --color=auto "${pkgs.git.version}"
  '';
  # See full reference at https://devenv.sh/reference/options/
}

Regarding the warning: The problem is not the warning, though I guessed it to be related to the bug. The problem is that process-compose just stops about a few seconds after startup.

@sandydoo
Copy link
Member

sandydoo commented Nov 28, 2024

The problem is that process-compose just stops about a few seconds after startup.
processes.cargo-watch.exec = "cargo-watch";

@dwt, isn't this supposed to be cargo watch? You might also need to add pkgs.cargo-watch to packages. So I would check that this command works in the first place.

If this is the only process and it fails, process-compose will immediately exit. I don't think there's a setting to change this behaviour. To print all logs to the console, you can disable the TUI with process.managers.process-compose.tui.enable = false.

@dwt
Copy link

dwt commented Dec 4, 2024

@sandydoo Actually both cargo-watch and cargo watch work - as soon as you add the pkgs.cargo-watch. :-(

Sorry, I don't know my way around a rust project yet, so I didn't know.

In my defense, this came straight from the template that is generated when you call devenv init:

  # https://devenv.sh/processes/
  # processes.cargo-watch.exec = "cargo-watch";
{ pkgs, lib, config, inputs, ... }:

{
  # https://devenv.sh/basics/
  env.GREET = "devenv";

  # https://devenv.sh/packages/
  packages = [ pkgs.git ];

  # https://devenv.sh/languages/
  # languages.rust.enable = true;

  # https://devenv.sh/processes/
  # processes.cargo-watch.exec = "cargo-watch";

  # https://devenv.sh/services/
  # services.postgres.enable = true;

  # https://devenv.sh/scripts/
  scripts.hello.exec = ''
    echo hello from $GREET
  '';

  enterShell = ''
    hello
    git --version
  '';

  # https://devenv.sh/tasks/
  # tasks = {
  #   "myproj:setup".exec = "mytool build";
  #   "devenv:enterShell".after = [ "myproj:setup" ];
  # };

  # https://devenv.sh/tests/
  enterTest = ''
    echo "Running tests"
    git --version | grep --color=auto "${pkgs.git.version}"
  '';

  # https://devenv.sh/pre-commit-hooks/
  # pre-commit.hooks.shellcheck.enable = true;

  # See full reference at https://devenv.sh/reference/options/
}

So maybe it could be a good idea, to change that default to also include # pkgs.cargo-watch in packages?

Something like this:

  # https://devenv.sh/packages/
  packages = [
    pkgs.git
    # pkgs.cargo-watch
  ];

That way the error would be easier to spot and resolve for new devenv users.

@rhulha
Copy link

rhulha commented Dec 10, 2024

fresh ubtunu 24.2

.config/process-compose/settings.yaml: no such file or directory
solution: create empty file
FTL start UDS http server on /tmp/nix-shell.ppHu99/devenv-d16d6f7/pc.sock failed
solution: just create another empty file and then it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working macos Affects systems running macOS
Projects
None yet
Development

No branches or pull requests

6 participants