PHPackages                             ancalagon/netbox-podman - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. ancalagon/netbox-podman

ActiveLibrary[Testing &amp; Quality](/categories/testing)

ancalagon/netbox-podman
=======================

Podman Quadlet deployment for NetBox — one-command bootstrap for integration testing

v0.0.10(2mo ago)141MITShell

Since Feb 9Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/bmairlot/netbox-podman)[ Packagist](https://packagist.org/packages/ancalagon/netbox-podman)[ Docs](https://github.com/bmairlot/netbox-podman)[ RSS](/packages/ancalagon-netbox-podman/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (5)Used By (1)

NetBox Podman Quadlet
=====================

[](#netbox-podman-quadlet)

A rootless [Podman](https://podman.io/) deployment of [NetBox](https://github.com/netbox-community/netbox) using **Quadlet** (systemd-native container management). One command spins up a fully working NetBox instance with random credentials -- ideal for local development, integration testing, and CI pipelines.

This project is designed to work as a **test fixture** for the [`ancalagon/netbox`](https://packagist.org/packages/ancalagon/netbox) PHP library, but is equally useful as a standalone NetBox deployment on any Linux system with Podman.

Prerequisites
-------------

[](#prerequisites)

- **Podman** (rootless mode) with Quadlet support (Podman 4.4+)
- **systemd** user session (`systemctl --user` must work)
- **openssl** (for secret generation)

Quick Start
-----------

[](#quick-start)

```
# Spin up a fresh NetBox instance on localhost:
./bootstrap.sh --bind=127.0.0.1

# Bind to a specific IP (e.g. for remote access or CI):
./bootstrap.sh --bind=192.168.1.10

# Machine-readable output for test harnesses:
CONFIG=$(./bootstrap.sh --bind=127.0.0.1 --json)

# Tear down everything when done:
./teardown.sh

# Tear down but keep data (DB, Valkey, media) for faster re-bootstrap:
./teardown.sh --keep-data

# Re-bootstrap reusing existing data volumes:
./bootstrap.sh --bind=127.0.0.1 --keep-data
```

The first run will pull container images and run Django migrations, which may take a few minutes. Subsequent runs are faster -- especially with `--keep-data`, which preserves volumes so migrations are skipped entirely.

### bootstrap.sh

[](#bootstrapsh)

OptionDescription`--bind=ADDRESS`**Required.** Reachable IP address to bind published ports to`--json`Output connection details as JSON to stdout (progress goes to stderr)`--keep-data`Preserve existing volumes (DB, Valkey, media) for faster startup`-h`, `--help`Show usage helpThe script will:

1. Tear down any existing NetBox stack (calls `teardown.sh`)
2. Generate random secrets (DB, Valkey, Django secret key, API token pepper, admin password)
3. Resolve `{{PLACEHOLDER}}` tokens in template files into a `generated/` directory
4. Install Quadlet units to `~/.config/containers/systemd/`
5. Start the pod and wait for all health checks to pass
6. Create an `admin` superuser and print login credentials

### teardown.sh

[](#teardownsh)

OptionDescription`--keep-data`Keep volumes intact (DB, Valkey, media) for faster re-bootstrap`-h`, `--help`Show usage helpBy default, stops all services and removes containers, pods, volumes, the Podman network, installed Quadlet units, and the `generated/` directory. With `--keep-data`, volumes are preserved so the next `./bootstrap.sh` skips migrations and starts much faster.

### JSON Output

[](#json-output)

When using `--json`, the output contains everything a test harness needs:

```
{
  "url": "http://0.0.0.0:8000",
  "username": "admin",
  "password": "...",
  "api_url": "http://0.0.0.0:8000/api",
  "db_host": "netbox-postgres",
  "db_port": 5432,
  "db_name": "netbox",
  "db_user": "netbox",
  "db_password": "...",
  "valkey_host": "netbox-valkey",
  "valkey_port": 6380,
  "valkey_password": "...",
  "valkey_cache_host": "netbox-valkey-cache",
  "valkey_cache_port": 6379,
  "valkey_cache_password": "...",
  "secret_key": "...",
  "api_token_pepper": "..."
}
```

Usage with Composer (PHP Integration Testing)
---------------------------------------------

[](#usage-with-composer-php-integration-testing)

This repository can be added as a Composer dev dependency to provide a disposable NetBox instance for PHPUnit tests:

```
composer require --dev ancalagon/netbox-podman
```

Composer will symlink `bootstrap.sh` and `teardown.sh` into `vendor/bin/`, so they are available on your `$PATH` when using Composer scripts.

### Example: PHPUnit bootstrap file

[](#example-phpunit-bootstrap-file)

Create a `tests/bootstrap.php` that starts NetBox before the test suite runs:

```
