Skip to content

Surprising behaviors with ecosystem file #11

@diwakergupta

Description

@diwakergupta

I'm trying to use pmdaemon to run multiple bun apps. Here's what my ecosystem file looks like:

{
  "apps": [
    {
      "name": "app1",
      "cwd": "path/to/app1",
      "script": "bun",
      "args": ["src/index.ts"],
      "port": "4001",
      "env": {
        "NODE_ENV": "production"
      }
    },
    {
      "name": "app2",
      "cwd": "path/to/app2",
      "script": "bun",
      "args": ["index.ts"],
      "port": "4002",
      "env": {
        "NODE_ENV": "production"
      }
    }
  ]
}

I also have a systemd unit file to run pmdaemon automatically on system boot. Looks like this:

[Unit]
Description=PMDaemon Process Manager

[Service]
Type=forking
ExecStart=/path/to/pmdaemon start --config /path/to/ecosystem.json
ExecReload=/path/to//pmdaemon reload all
Restart=always

[Install]
WantedBy=default.target

I'm running into a lot of surprising behavior, both inconsistent with the docs and my general expectations. Here are just a few:

  • After initial setup, pmdaemon --config ... start works. I expected that, correspondingly, stop would also stop all services. But that fails with: error: the following required arguments were not provided: <IDENTIFIER>. Expected behavior: if start starts all services, stop should also stop all services.
  • If I manually stop each service, and then call start again, that fails with: Failed to start process 'app1': Process already exists: app1. Expected behavior: one should be able to start - stop - start - stop services
  • The only way work around I found for the above state was to delete the services (again, one at a time) and call start again. Expectation: delete should have consistent behavior with start when using an ecosystem file, unless a specific identifier is explicitly provided
  • This behavior persists across reboots. For instance, say I have a running system with 2 services managed by pmdaemon. The system is rebooted. But pmdaemon fails on reboot with the same process already exists error. I verified that the PIDs listed via status are non-existent. Expectation: pmdaemon restarts services as expected on a reboot

Overall this is a very promising project and I'm excited for a better alternative to pm2, but right now all these weird behaviors make it very unpredictable and difficult to use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions