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

Can't set process compose settings on included services (e.g. max restarts on postgres). #1462

Open
AlansCodeLog opened this issue Sep 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@AlansCodeLog
Copy link

Describe the bug
I want to prevent some of the included services from restarting infinitely in case of a mis-configuration. I tried process-managers.process-compose.settings.availability.max_restarts and processes.postgres.process-compose.availability.max_restarts; but neither seem to be working... I tried loading my flake in the repl and looking at outputs.devShells.x86_64-linux.default.config.processes.postgres.process-compose.availability, but it just shows the defaults.

Is this possible? Did I misunderstand how to configure it? I asked over on discord but no answer.

To reproduce
Here's a fresh flake.nix with enough to make postgres fail infinitely.

   {
    inputs = {
      nixpkgs.url = "github:cachix/devenv-nixpkgs/rolling";
      systems.url = "github:nix-systems/default";
      devenv.url = "github:cachix/devenv";
      devenv.inputs.nixpkgs.follows = "nixpkgs";
    };

    nixConfig = {
      extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=";
      extra-substituters = "https://devenv.cachix.org";
    };

    outputs = { self, nixpkgs, devenv, systems, ... } @ inputs:
      let
        forEachSystem = nixpkgs.lib.genAttrs (import systems);
      in
      {
        packages = forEachSystem (system: {
          devenv-up = self.devShells.${system}.default.config.procfileScript;
        });

        devShells = forEachSystem
          (system:
            let
              pkgs = nixpkgs.legacyPackages.${system};
            in
            {
              default = devenv.lib.mkShell {
                inherit inputs pkgs;
                modules = [
                  {
                  process-managers.process-compose.settings.availability.max_restarts= 1;
                    # https://devenv.sh/reference/options/
                    packages = [ pkgs.hello ];

                    enterShell = ''
                      hello
                    '';

                    processes.hello.exec = "hello";
                    processes.postgres.process-compose.availability.max_restarts = 5;
                    services.postgres = {
                      enable = true;
                      settings = {
                        ssl = true;
                      };
                    };
                  }
                ];
              };
            });
      };
  }

Version

1.1.0

@AlansCodeLog AlansCodeLog added the bug Something isn't working label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant