devenv icon indicating copy to clipboard operation
devenv copied to clipboard

`devenv up` with process-compose unable to start on macOS

Open cyphase opened this issue 1 year ago • 16 comments

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 avatar Nov 07 '24 20:11 cyphase

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

Is your colleague using flakes or plain devenv?

sandydoo avatar Nov 07 '24 21:11 sandydoo

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 avatar Nov 07 '24 22:11 cyphase

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/

cyphase avatar Nov 07 '24 22:11 cyphase

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.

sandydoo avatar Nov 08 '24 13:11 sandydoo

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?

vele-dan-alexandru avatar Nov 18 '24 10:11 vele-dan-alexandru

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.

sandydoo avatar Nov 19 '24 21:11 sandydoo

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

dwt avatar Nov 23 '24 21:11 dwt

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

sandydoo avatar Nov 23 '24 21:11 sandydoo

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)

jkoppel avatar Nov 25 '24 13:11 jkoppel

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?

sandydoo avatar Nov 25 '24 14:11 sandydoo

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;

jkoppel avatar Nov 25 '24 14:11 jkoppel

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.

dwt avatar Nov 26 '24 08:11 dwt

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.

sandydoo avatar Nov 28 '24 21:11 sandydoo

@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.

dwt avatar Dec 04 '24 19:12 dwt

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

rhulha avatar Dec 10 '24 15:12 rhulha

I'm getting

25-01-29 19:10:45.929 FTL Unable to create configuration directory for process compose error="mkdir /Library/Application Support/process-compose: permission denied"

https://github.com/F1bonacc1/process-compose/issues/302

dacevedo12 avatar Jan 30 '25 00:01 dacevedo12