56 lines
1.4 KiB
Markdown
56 lines
1.4 KiB
Markdown
# Netbox Deployment
|
|
|
|
GitOps deployment for Netbox with Tailscale HTTPS access.
|
|
|
|
## Prerequisites
|
|
|
|
### PostgreSQL Database
|
|
|
|
Connect to your PostgreSQL server and create the database:
|
|
|
|
```sql
|
|
CREATE DATABASE netbox;
|
|
CREATE USER netbox WITH PASSWORD 'your-secure-password';
|
|
GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;
|
|
ALTER DATABASE netbox OWNER TO netbox;
|
|
```
|
|
|
|
### Tailscale Configuration
|
|
|
|
Download the serve configuration (first time only):
|
|
|
|
```bash
|
|
curl -o serve-config.json https://gitea.arnodo.fr/Damien/netbox-deployment/raw/branch/main/serve-config.json
|
|
```
|
|
|
|
Place `serve-config.json` in the stack directory before deployment.
|
|
|
|
### Generate Secret Key
|
|
|
|
```bash
|
|
python3 -c "import secrets; print(secrets.token_urlsafe(50))"
|
|
```
|
|
|
|
## Portainer Environment Variables
|
|
|
|
| Variable | Description |
|
|
|----------|-------------|
|
|
| `TS_AUTHKEY` | Tailscale auth key (reusable, ephemeral recommended) |
|
|
| `DB_PASSWORD` | PostgreSQL password for netbox user |
|
|
| `SECRET_KEY` | Django secret key (generate with command above) |
|
|
| `SUPERUSER_NAME` | Initial admin username |
|
|
| `SUPERUSER_EMAIL` | Initial admin email |
|
|
| `SUPERUSER_PASSWORD` | Initial admin password |
|
|
| `SKIP_SUPERUSER` | Set to `true` after first deployment |
|
|
|
|
## Deployment
|
|
|
|
1. Create a new stack in Portainer
|
|
2. Point to this repository
|
|
3. Configure environment variables
|
|
4. Deploy
|
|
|
|
## Access
|
|
|
|
Once deployed: https://netbox.taila5ad8.ts.net
|