DEV Community

Cover image for What Happens When Two Deployment Panels Think They Own the Same VPS?
hoagminh
hoagminh

Posted on

What Happens When Two Deployment Panels Think They Own the Same VPS?

Connecting a deployment panel to a VPS is easy.

Give it an address, an SSH key, and permission to install Docker. A few minutes later, the panel can deploy applications, configure Traefik, create networks, and manage volumes.

The uncomfortable question comes later:

What happens when a second panel connects to the same server and believes the same infrastructure belongs to it?

This is not a normal multi-user conflict. Both panels may have root access. Both may believe their database contains the desired state. Both may be capable of “repairing” the server until it matches that state.

One panel updates Traefik. The other changes it back. One removes a container it cannot find in its database. The other recreates it. A cleanup screen sees an unfamiliar volume and offers to delete it.

The individual commands may be correct. The ownership assumption is not.

This problem shaped the server-ownership mechanism in Nitrobase.

Nitrobase has only recently launched and is still in Beta. The goal of this feature is small but important: before changing a managed VPS, establish which Nitrobase instance is allowed to act there—and refuse when the answer points somewhere else.

The dangerous version of “desired state”

A deployment panel normally works from two views of the world:

Panel database                 Actual VPS
--------------                 ----------
App A should run        <-->   containers
domain.example.com      <-->   Traefik routes
database volume exists  <-->   Docker volumes
backup runs nightly     <-->   files and schedules
Enter fullscreen mode Exit fullscreen mode

The panel compares them and performs work to bring the server toward its desired state.

That model works while one control plane is authoritative.

Now add another panel:

Panel Alpha ---------\
                      >---- Same VPS
Panel Beta ----------/
Enter fullscreen mode Exit fullscreen mode

Alpha does not know what Beta deployed. Beta does not know which resources Alpha still needs. Absence from one database does not mean a resource is abandoned.

This creates a rule I now consider fundamental:

“I do not recognize this resource” is not evidence that I may delete it.

An SSH connection does not prove ownership

Successfully connecting as root proves capability, not authority.

An SSH key tells Nitrobase that it can execute commands. It does not tell Nitrobase whether another installation already manages the server.

SSH authentication answers:  “May I enter this machine?”

Ownership answers:           “May this panel manage these resources?”
Enter fullscreen mode Exit fullscreen mode

Those are separate questions, so Nitrobase needs a separate identity.

Each panel installation has an instance ID. Resources created or adopted by that panel carry the ID in several places on the server.

Ownership needs more than one marker

A single marker is fragile because infrastructure has several lifecycles.

A container can be recreated. An application folder can remain after its containers are removed. Traefik can exist while the panel database is temporarily unavailable. Older installations may contain resources created before ownership tracking existed.

Nitrobase records ownership at three levels:

Resource Ownership record
Managed server root instance-id marker file
Traefik and app containers nitrobase.instance Docker label
Application folder Reserved .nitrobase-instance marker

The result is not a perfect distributed consensus system. It is a set of durable signals placed beside the things the panel may later modify or delete.

/etc/nitrobase/
├── instance-id                 -> panel instance
└── apps/
    └── my-app-ab12cd34/
        ├── .nitrobase-instance -> app-folder owner
        ├── compose.yml
        └── data/

Docker container labels:
nitrobase.instance=<instance-id>
Enter fullscreen mode Exit fullscreen mode

The marker filenames are reserved so an application template cannot casually replace or mount over them.

The check happens before the change

An ownership warning shown after a bootstrap has already rewritten proxy configuration would be too late.

Before Nitrobase bootstraps a server, it probes the managed-root marker and the Traefik ownership label. If either contains another instance ID, the operation is refused before the first server-changing step.

Connect to VPS
     |
Read root marker + Traefik label
     |
     +-- no foreign owner --> continue
     |
     +-- foreign owner ----> refuse
Enter fullscreen mode Exit fullscreen mode

The same ownership boundary is used for later operations that can alter the server, including deployment and routing work.

That detail matters because ownership is not something to check only when a server is first added. A server can be restored from a snapshot, moved between environments, or connected to another panel after its initial bootstrap.

The server remains the source of evidence for who currently claims its Nitrobase-managed root.

What the refusal looks like

Suppose Panel Alpha has instance ID alpha-01 and has already bootstrapped a VPS.

Panel Beta connects using a perfectly valid root SSH key.

Panel Beta expects:  beta-07
Server marker says:  alpha-01

Result: deployment refused
Enter fullscreen mode Exit fullscreen mode

Nitrobase reports that another instance manages the server instead of attempting to merge two control-plane states.

This can feel inconvenient during a migration, but silent coexistence would be worse. If both panels can independently update the reverse proxy, routes, networks, and application folders, there is no reliable definition of “current.”

Refusal turns an ambiguous infrastructure state into an explicit administrative decision.

Takeover should not be an accidental side effect

There are legitimate reasons to move authority:

  • the old panel was lost;
  • its database was restored into a fresh installation;
  • a staging panel is being promoted;
  • an administrator intentionally replaces one control plane with another.

But “I have the SSH key” is still not enough evidence to perform a takeover automatically.

The safe sequence is closer to this:

1. Stop the old panel permanently
2. Recover or verify its desired state
3. Confirm which applications exist on the VPS
4. Explicitly transfer ownership
5. Let the new panel converge the server
Enter fullscreen mode Exit fullscreen mode

Nitrobase supports an explicit takeover path during bootstrap. It is a deliberate exception to the normal refusal, not a fallback triggered merely because the new panel cannot understand the old marker.

The distinction protects against a common operational mistake: using a fresh panel to “inspect” an existing server and accidentally converting inspection into control.

App resources need their own identity too

The server-level marker answers who manages the Nitrobase root and Traefik. Cleanup needs a more specific answer: who created this application folder and its containers?

Nitrobase adds the instance label to containers through the Compose transformation it already applies during deployment. It also writes the instance marker into the top of each application folder.

This lets an orphan scan classify resources into three groups:

Classification Meaning Automatic wipe allowed?
self Owned by this panel instance Only with other safety checks
foreign Another instance ID is present No
unknown No valid owner is recorded No by default

The unknown category is especially important.

Unknown may mean:

  • the app was created before ownership markers existed;
  • the folder was copied manually;
  • a marker was removed;
  • another tool created similar resources;
  • the current panel has incomplete evidence.

None of those meanings imply “safe to delete.”

Known to be mine      -> potentially manageable
Known to be foreign   -> leave it alone
Unknown               -> also leave it alone
Enter fullscreen mode Exit fullscreen mode

Uncertainty is treated as a reason to preserve data.

Why volumes inherit ownership from the project

It might seem simpler to place an instance label directly on every Docker volume.

Nitrobase deliberately avoids relying on that.

Docker volume labels are effectively immutable in the lifecycle that Compose expects. Changing them can lead Compose to request recreation of the volume—the exact behavior an ownership migration must avoid when the volume contains application data.

Instead, a named volume is associated with its Compose project, and the project ownership is derived from the application folder and labelled containers.

App folder marker ----\
                       >---- Compose project ---- named volumes
Container labels -----/
Enter fullscreen mode Exit fullscreen mode

This is less visually direct than labelling every object, but it avoids turning metadata repair into a data-loss operation.

The safest ownership system is not the one with the most labels. It is the one that does not destroy data while trying to improve its labels.

Cleanup is where ownership becomes real

Ownership metadata is easy to describe when deploying. Its value becomes visible when deleting.

Nitrobase's orphan view can find application folders, labelled containers, and volumes that no longer correspond to an app in the current panel database.

But it does not equate “not in my database” with “mine to wipe.”

Before removing an orphan, Nitrobase checks again:

  1. the resource is still absent from the panel's known applications;
  2. its owner classification is allowed;
  3. no container in that project is currently running;
  4. the administrator typed the required confirmation;
  5. the state has not changed between the preview and the actual job.

Foreign resources are refused.

Resources with no recorded owner require a stronger, instance-administrator-only path and an explicit phrase. The interface warns that they may belong to another panel or predate ownership markers.

Even then, this is a human risk decision—not proof manufactured by the software.

Labels are not a security boundary against root

It is important not to oversell this mechanism.

An administrator with root access can edit marker files, recreate containers, or change Docker labels. A malicious second panel with unrestricted root access could ignore every ownership signal.

The mechanism is designed to prevent accidental control-plane conflict and unsafe cleanup between cooperative Nitrobase installations.

It does not defend a server from an attacker who already controls the host.

Protects against:
  ✓ accidental double management
  ✓ mistaken cleanup by another Nitrobase panel
  ✓ treating unknown resources as disposable

Does not protect against:
  ✗ malicious root access
  ✗ manual deletion outside Nitrobase
  ✗ forged or edited ownership markers
Enter fullscreen mode Exit fullscreen mode

The security boundary remains the VPS and its root credentials. Ownership markers add operational safety inside that boundary.

Recovery and ownership are connected

This feature also explains why restoring a control plane is more than importing a database.

The restored panel must know whether it is the continuation of the old instance or a new authority trying to take over. If two copies of the same panel become active, both may have the same desired state and credentials.

That creates a split-brain problem even when their database contents initially match.

The recovery process should therefore include:

old panel stopped
        +
restored control-plane state
        +
verified instance identity
        +
explicit resume on the new machine
        =
one active authority
Enter fullscreen mode Exit fullscreen mode

Server ownership is one layer of that process. It prevents an unrelated fresh instance from quietly claiming the same infrastructure, while recovery controls prevent two copies of the same instance from acting simultaneously.

My checklist before connecting an existing VPS

  • [ ] Is another Nitrobase panel still running?
  • [ ] Does the server already contain /etc/nitrobase data?
  • [ ] Who created the current Traefik container?
  • [ ] Are the application folders represented in the panel database?
  • [ ] Am I restoring the old panel or creating a genuinely new one?
  • [ ] Have I stopped the old control plane before a takeover?
  • [ ] Are off-site backups available before changing ownership?
  • [ ] Do any resources have an unknown owner?
  • [ ] Have I verified unknown volumes before considering cleanup?
  • [ ] Is this an inspection task or an authorization to manage?

That final question is easy to overlook. Connecting to a machine should not automatically mean adopting everything on it.

The problem this feature is trying to solve

Self-hosting gives users control over their servers and data. A management panel should reduce repetitive operations without quietly assuming that every object visible through SSH belongs to it.

Nitrobase's ownership markers try to make that assumption explicit:

Panel identity
      |
      +-- marks server root
      +-- labels containers
      +-- marks app folders
      |
      v
future operations can ask:
“Is this actually mine to change?”
Enter fullscreen mode Exit fullscreen mode

There are more edge cases to test during Beta—older installations, partially completed takeovers, manually copied application folders, server snapshots, and recovery from lost control-plane state.

But the principle I want to preserve is simple:

Infrastructure access is not infrastructure ownership, and uncertainty is not permission to delete.

Sometimes the safest deployment feature is the one that refuses to deploy.

Nitrobase source code: https://github.com/AydenGroup/nitrobase

Top comments (0)