Hopp til hovedinnhold

Self-Hosted Installation

This guide walks you through deploying the NetRecon platform on your own server using Docker Compose.

Prerequisites

  • A Linux server (Ubuntu 22.04+ recommended) or Windows Server with Docker
  • Docker v24.0+ and Docker Compose v2.20+
  • A domain name pointed to your server (e.g., netrecon.yourcompany.com)
  • TLS certificate for your domain (or use Let's Encrypt)
  • At least 4 GB RAM and 40 GB disk space

Linux VPS Installation

Step 1: Install Docker

# Update system
sudo apt update && sudo apt upgrade -y

# Install Docker
curl -fsSL https://get.docker.com | sudo sh

# Add your user to the docker group
sudo usermod -aG docker $USER

# Install Docker Compose plugin
sudo apt install docker-compose-plugin -y

# Verify installation
docker --version
docker compose version

Step 2: Create the Project Directory

sudo mkdir -p /opt/netrecon
cd /opt/netrecon

Step 3: Create the Environment File

sudo tee /opt/netrecon/.env << 'EOF'
# NetRecon Self-Hosted Configuration
NETRECON_DOMAIN=netrecon.yourcompany.com
NETRECON_EMAIL=admin@yourcompany.com

# PostgreSQL
POSTGRES_USER=netrecon
POSTGRES_PASSWORD=CHANGE_ME_TO_A_STRONG_PASSWORD
POSTGRES_DB=netrecon

# Redis
REDIS_PASSWORD=CHANGE_ME_TO_A_STRONG_PASSWORD

# JWT Secret (generate with: openssl rand -hex 32)
JWT_SECRET=CHANGE_ME_TO_A_RANDOM_HEX_STRING

# Agent Registry
AGENT_REGISTRY_SECRET=CHANGE_ME_TO_A_RANDOM_HEX_STRING
AGENT_JWT_SECRET=CHANGE_ME_TO_A_RANDOM_HEX_STRING

# Email (SMTP)
SMTP_HOST=smtp.yourcompany.com
SMTP_PORT=587
SMTP_USER=noreply@yourcompany.com
SMTP_PASSWORD=CHANGE_ME
SMTP_FROM=NetRecon <noreply@yourcompany.com>

# License
LICENSE_KEY=your-license-key
EOF
warning

Change all placeholder passwords and secrets before deploying. Use openssl rand -hex 32 to generate secure random values.

Step 4: Create the Docker Compose File

sudo tee /opt/netrecon/docker-compose.yml << 'YAML'
version: "3.9"

services:
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
interval: 10s
timeout: 5s
retries: 5

redis:
image: redis:7-alpine
restart: unless-stopped
command: redis-server --requirepass ${REDIS_PASSWORD}
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 10s
timeout: 5s
retries: 5

api-gateway:
image: netrecon/api-gateway:latest
restart: unless-stopped
ports:
- "8000:8000"
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379/0
JWT_SECRET: ${JWT_SECRET}
LICENSE_KEY: ${LICENSE_KEY}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy

vault-server:
image: netrecon/vault-server:latest
restart: unless-stopped
ports:
- "8001:8001"
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy

license-server:
image: netrecon/license-server:latest
restart: unless-stopped
ports:
- "8002:8002"
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
LICENSE_KEY: ${LICENSE_KEY}
depends_on:
postgres:
condition: service_healthy

email-service:
image: netrecon/email-service:latest
restart: unless-stopped
ports:
- "8003:8003"
environment:
SMTP_HOST: ${SMTP_HOST}
SMTP_PORT: ${SMTP_PORT}
SMTP_USER: ${SMTP_USER}
SMTP_PASSWORD: ${SMTP_PASSWORD}
SMTP_FROM: ${SMTP_FROM}

notification-service:
image: netrecon/notification-service:latest
restart: unless-stopped
ports:
- "8004:8004"
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379/1
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy

update-server:
image: netrecon/update-server:latest
restart: unless-stopped
ports:
- "8005:8005"
volumes:
- update_data:/data/updates

agent-registry:
image: netrecon/agent-registry:latest
restart: unless-stopped
ports:
- "8006:8006"
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
AGENT_REGISTRY_SECRET: ${AGENT_REGISTRY_SECRET}
AGENT_JWT_SECRET: ${AGENT_JWT_SECRET}
depends_on:
postgres:
condition: service_healthy

warranty-service:
image: netrecon/warranty-service:latest
restart: unless-stopped
ports:
- "8007:8007"
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
depends_on:
postgres:
condition: service_healthy

cmod-service:
image: netrecon/cmod-service:latest
restart: unless-stopped
ports:
- "8008:8008"
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379/2
depends_on:
postgres:
condition: service_healthy

ipam-service:
image: netrecon/ipam-service:latest
restart: unless-stopped
ports:
- "8009:8009"
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
depends_on:
postgres:
condition: service_healthy

nginx:
image: nginx:alpine
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./certs:/etc/nginx/certs:ro
depends_on:
- api-gateway

volumes:
postgres_data:
redis_data:
update_data:
YAML

Step 5: Create the Nginx Configuration

sudo tee /opt/netrecon/nginx.conf << 'CONF'
events {
worker_connections 1024;
}

http {
upstream api_gateway {
server api-gateway:8000;
}

server {
listen 80;
server_name ${NETRECON_DOMAIN};
return 301 https://$host$request_uri;
}

server {
listen 443 ssl;
server_name ${NETRECON_DOMAIN};

ssl_certificate /etc/nginx/certs/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;

location / {
proxy_pass http://api_gateway;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

location /ws {
proxy_pass http://api_gateway;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
}
CONF

Step 6: Set Up TLS Certificates

Option A: Let's Encrypt (recommended for internet-facing servers)

sudo apt install certbot -y
sudo certbot certonly --standalone -d netrecon.yourcompany.com

# Copy certificates
sudo mkdir -p /opt/netrecon/certs
sudo cp /etc/letsencrypt/live/netrecon.yourcompany.com/fullchain.pem /opt/netrecon/certs/
sudo cp /etc/letsencrypt/live/netrecon.yourcompany.com/privkey.pem /opt/netrecon/certs/

Option B: Self-signed certificate (for internal/testing)

sudo mkdir -p /opt/netrecon/certs
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /opt/netrecon/certs/privkey.pem \
-out /opt/netrecon/certs/fullchain.pem \
-subj "/CN=netrecon.yourcompany.com"

Step 7: Deploy

cd /opt/netrecon
sudo docker compose up -d

Verify all services are running:

sudo docker compose ps

Step 8: Access the Dashboard

Open your browser and navigate to:

https://netrecon.yourcompany.com

Create the initial admin account on first access.

Windows Server Installation

Step 1: Install Docker Desktop

  1. Download Docker Desktop from docker.com
  2. Install with WSL2 backend enabled
  3. Restart the server

Step 2: Follow Linux Steps

The Docker Compose setup is identical. Open PowerShell and follow Steps 2-8 above, adjusting paths:

mkdir C:\netrecon
cd C:\netrecon
# Create .env and docker-compose.yml as above
docker compose up -d

Post-Installation

Database Migrations

Migrations run automatically on first start. To manually trigger:

docker compose exec api-gateway python manage.py migrate

Backup Configuration

Set up daily PostgreSQL backups:

# Add to crontab
echo "0 2 * * * docker compose -f /opt/netrecon/docker-compose.yml exec -T postgres pg_dump -U netrecon netrecon | gzip > /opt/netrecon/backups/db-\$(date +\%Y\%m\%d).sql.gz" | sudo crontab -

Monitoring

Check service health:

# All services status
docker compose ps

# Service logs
docker compose logs -f api-gateway

# Resource usage
docker stats

Updating

cd /opt/netrecon

# Pull latest images
docker compose pull

# Restart with new images
docker compose up -d

# Verify
docker compose ps

Troubleshooting

Services fail to start

# Check logs for the failing service
docker compose logs <service-name>

# Common issue: PostgreSQL not ready yet
# Solution: wait and retry, or increase healthcheck retries

Cannot access the dashboard

  • Verify port 443 is open in your firewall
  • Check that certificates exist in the certs directory
  • Verify the domain DNS points to your server

Database connection errors

  • Verify PostgreSQL is healthy: docker compose exec postgres pg_isready
  • Check credentials in .env match across all services

FAQ

Q: Can I use an external PostgreSQL database? A: Yes. Remove the postgres service from docker-compose.yml and update the DATABASE_URL environment variable to point to your external database.

Q: How do I scale for high availability? A: For HA deployments, use Kubernetes with the provided Helm charts. Docker Compose is suitable for single-server deployments.

Q: Can I use a different reverse proxy (e.g., Traefik, Caddy)? A: Yes. Replace the Nginx service with your preferred reverse proxy. Ensure it forwards to the API Gateway on port 8000 and supports WebSocket upgrades.

For additional help, contact support@netreconapp.com.