Implement pboss daemon start|stop|restart|status · Issue #41 · Procboss/pboss · GitHub
Skip to content

Implement pboss daemon start|stop|restart|status #41

Closed

Description

@ra-sun-god

The daemon lifecycle commands are currently documented but not implemented:

pboss daemon start
pboss daemon stop
pboss daemon restart
pboss daemon status

Let's implement them properly.

Requirements

1. Implement daemon lifecycle commands

Implement:

  • pboss daemon start
  • pboss daemon stop
  • pboss daemon restart
  • pboss daemon status

status should be able to tell the user whether the daemon is running and provide relevant information such as its PID and running pboss version.

2. Respect installed startup scripts

If pboss startup scripts have been installed, the daemon commands must also manage the corresponding startup service.

For example:

pboss daemon start

should start the daemon through the installed startup mechanism.

pboss daemon stop

should stop it.

pboss daemon restart

should restart it.

The important part is that daemon restart must not leave an old startup-managed daemon running while starting another daemon process.

This should work with whatever startup mechanism pboss has installed on the platform.

3. Reload the daemon after pboss upgrades

When pboss is upgraded, the currently running daemon may still be executing the old pboss code.

For example:

bun upgrade pboss

can update the installed pboss package while the existing daemon continues running the previous version.

After an upgrade, the user should run:

pboss daemon restart

to stop the old daemon and start it using the newly installed pboss code.

4. Track the version actually running in the daemon

We need a reliable way to determine whether the running daemon is using the currently installed pboss version.

For example:

Installed version: 1.3.0
Daemon version:    1.2.0
Status:            outdated

versus:

Installed version: 1.3.0
Daemon version:    1.3.0
Status:            running

The daemon should record its version when it starts so pboss daemon status can determine what version is actually running.

It would also be useful to track the runtime information, since pboss is runtime-agnostic:

pboss version
runtime
runtime version
PID
startup time

5. Detect stale daemons after runtime/package upgrades

The version tracking should also handle cases where the runtime itself is upgraded.

For example:

bun upgrade

could update the Bun installation while an existing pboss daemon is still running using the previous installation/code.

The daemon should therefore be able to identify that the currently running process is no longer using the current pboss installation/runtime.

Example

After upgrading pboss:

$ pboss daemon status

Daemon:    running
PID:       12345
pboss:     1.2.0
Installed: 1.3.0
Status:    outdated

A newer pboss version is installed.
Run `pboss daemon restart` to apply the update.

Then:

$ pboss daemon restart

Daemon restarted successfully.

PID:       12789
pboss:     1.3.0
Status:    running

Goal

The daemon lifecycle should be predictable and explicit:

start
stop
restart
status

A pboss upgrade should never leave users unknowingly running an old daemon. The daemon and any installed startup service must always stay in sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions