Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 69 additions & 23 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,54 @@ x-daemonless:
user: "bsd"
upstream_binary: true
notes: "Needs PostgreSQL 15+ and Redis. Migrations run automatically at start."

networking:
netbox: default
"*": private
hostnames:
postgres: DB_HOST
redis: REDIS_HOST

appjail:
director:
options:
- alias:
- ip4_inherit:
depends_on:
- name: postgres
image: ghcr.io/daemonless/postgres:18
template: postgres-template.conf
env:
POSTGRES_DB: "!ENV '${DB_NAME}'"
POSTGRES_USER: "!ENV '${DB_USER}'"
POSTGRES_PASSWORD: "!ENV '${DB_PASSWORD}'"
volumes:
db_data: /var/lib/postgresql/data
- name: redis
image: ghcr.io/daemonless/redis:latest
docs:
env:
ALLOWED_HOSTS: "Space-separated hostnames (default *)"
CSRF_TRUSTED_ORIGINS: "Space-separated origins, e.g. https://netbox.example.com"
DB_HOST: "PostgreSQL host"
DB_NAME: "Database name"
DB_USER: "Database user"
NETBOX_CONFIG_PATH: "Path to store NetBox secrets, media and scripts"
DB_DATA_LOCATION: "Path to store PostgreSQL data files"
DB_HOST:
desc: "Where NetBox finds PostgreSQL (set automatically for the built-in database; 127.0.0.1 on host networking)"
level: advanced
optional: true
DB_NAME:
desc: "PostgreSQL database name"
level: advanced
optional: true
DB_USER:
desc: "PostgreSQL user"
level: advanced
optional: true
DB_PASSWORD: "Database password (or DB_PASSWORD_FILE)"
REDIS_HOST: "Redis host"
REDIS_HOST:
desc: "Where NetBox finds Redis (set automatically for the built-in Redis; 127.0.0.1 on host networking)"
level: advanced
optional: true
NETBOX_SECRET_KEY: "Optional; auto-generated into /config/secret_key"
NETBOX_API_TOKEN_PEPPER: "Optional; auto-generated into /config/api_token_pepper"
SUPERUSER_NAME: "Optional first-run admin user"
Expand All @@ -34,36 +73,43 @@ services:
netbox:
image: ghcr.io/daemonless/netbox:latest
container_name: netbox
network_mode: host
depends_on: [postgres, redis]
restart: unless-stopped
environment:
- PUID=1000
- PGID=1000
- TZ=UTC
- DB_HOST=postgres
- DB_PASSWORD=changeme
- REDIS_HOST=redis
- SUPERUSER_NAME=admin
- SUPERUSER_PASSWORD=changeme
- GRANIAN_WORKERS=4
- TZ=${TZ:-UTC}
- DB_HOST=${DB_HOST:-127.0.0.1}
- DB_NAME=${DB_NAME:-netbox}
- DB_USER=${DB_USER:-netbox}
- DB_PASSWORD=${DB_PASSWORD}
- REDIS_HOST=${REDIS_HOST:-127.0.0.1}
- SUPERUSER_NAME=${SUPERUSER_NAME:-admin}
- SUPERUSER_PASSWORD=${SUPERUSER_PASSWORD}
- GRANIAN_WORKERS=${GRANIAN_WORKERS:-4}
# - GRANIAN_WORKERS_LIFETIME=12h
volumes:
- /containers/netbox:/config
- ${NETBOX_CONFIG_PATH}:/config
ports:
- 8080:8080
depends_on: [postgres, redis]
restart: always

postgres: # placeholder: any PostgreSQL 15+ FreeBSD image
postgres:
image: ghcr.io/daemonless/postgres:18
environment:
- POSTGRES_DB=netbox
- POSTGRES_USER=netbox
- POSTGRES_PASSWORD=changeme
container_name: netbox-postgres
network_mode: host
restart: unless-stopped
annotations:
org.freebsd.jail.allow.sysvipc: "true"
environment:
- POSTGRES_DB=${DB_NAME:-netbox}
- POSTGRES_USER=${DB_USER:-netbox}
- POSTGRES_PASSWORD=${DB_PASSWORD}
volumes:
- /containers/netbox/postgres:/var/lib/postgresql/data
restart: always
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data

redis: # placeholder: any Redis/Valkey FreeBSD image
redis:
image: ghcr.io/daemonless/redis:latest
restart: always
container_name: netbox-redis
network_mode: host
restart: unless-stopped
15 changes: 15 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# NetBox for FreeBSD (Daemonless)
# Copy to .env and edit.

# Host paths for persistent storage
NETBOX_CONFIG_PATH=/containers/netbox/config
DB_DATA_LOCATION=/containers/netbox/postgres

# Database password and first-run admin (change both before first start)
DB_NAME=netbox
DB_USER=netbox
DB_PASSWORD=changeme
SUPERUSER_NAME=admin
SUPERUSER_PASSWORD=changeme

TZ=UTC
14 changes: 14 additions & 0 deletions postgres-template.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# postgres-template.conf -- jail template for the PostgreSQL sidecar (AppJail)
#
# PostgreSQL needs System V shared memory. allow.sysvipc is a no-op on
# FreeBSD 15; the jail gets its own SysV IPC namespace instead.
exec.start: "/bin/sh /etc/rc"
exec.stop: "/bin/sh /etc/rc.shutdown jail"
mount.devfs
persist
# host networking (ip4_inherit is a no-op in AppJail 5.5.0; the parameters are not)
ip4: inherit
ip6: inherit
sysvmsg: new
sysvsem: new
sysvshm: new
Loading