- Docker Engine 20.10+
- Docker Compose 2.0+
- Git
- 4GB RAM minimum
- 10GB disk space
git clone <repository-url>
cd splunk_weberhook_serviceNow# Copy the example environment file
cp .env.example .envEdit .env with your settings:
# Database
POSTGRES_DB=webhook_admin
POSTGRES_USER=webhook_user
POSTGRES_PASSWORD=WebhookAdmin2024!
POSTGRES_PORT=5433
# Security (REQUIRED - generate new values!)
ENCRYPTION_KEY=your-32-byte-base64-key
JWT_SECRET=your-jwt-secret-key
# Service Ports
CONFIG_API_PORT=8000
WEBHOOK_PORT=5001
ADMIN_UI_PORT=3000
# CORS (add your domains)
CORS_ORIGINS=http://localhost:3000
# Admin UI API URL
NEXT_PUBLIC_API_URL=http://localhost:8000# Generate a secure encryption key
openssl rand -base64 32Copy the output to ENCRYPTION_KEY in your .env file.
# Build all containers (use --no-cache for clean builds)
docker compose build --no-cache
# Start all services
docker compose up -d
# View logs
docker compose logs -f# Check service health
docker compose ps
# Expected output:
# NAME STATUS
# splunk-webhook-db healthy
# splunk-webhook-config-api healthy
# splunk-webhook-service running
# splunk-webhook-admin-ui running- Admin UI: http://localhost:3000
- Config API: http://localhost:8000
- API Docs: http://localhost:8000/docs
- Webhook Endpoint: http://localhost:5001/webhook
- Username: admin
- Password: Admin123!
# SSH to the server
ssh cbeye@192.168.1.213
# Clone or pull latest code
cd /opt/splunk-webhook
git pull origin main
# Update environment file
nano .env
# Rebuild and restart
docker compose down
docker compose build --no-cache
docker compose up -d
# Check status
docker compose ps# .env for remote deployment
POSTGRES_DB=webhook_admin
POSTGRES_USER=webhook_user
POSTGRES_PASSWORD=SecurePassword!
ENCRYPTION_KEY=<generate-new-key>
JWT_SECRET=<generate-new-secret>
# Use server IP for CORS
CORS_ORIGINS=http://192.168.1.213:3000
# API URL for Admin UI
NEXT_PUBLIC_API_URL=http://192.168.1.213:8000| Service | Internal Port | External Port | Description |
|---|---|---|---|
| PostgreSQL | 5432 | 5433 | Database |
| Config API | 8000 | 8000 | REST API |
| Webhook Service | 5000 | 5001 | Webhook processor |
| Admin UI | 3000 | 3000 | Web interface |
┌─────────────┐
│ PostgreSQL │ (starts first)
└──────┬──────┘
│ healthy
▼
┌─────────────┐
│ Config API │ (waits for healthy DB)
└──────┬──────┘
│ started
▼
┌─────────────┐ ┌─────────────┐
│ Webhook │ │ Admin UI │ (both wait for config-api)
│ Service │ │ │
└─────────────┘ └─────────────┘
# Check database is accepting connections
docker exec splunk-webhook-db pg_isready -U webhook_user -d webhook_admin# Health endpoint
curl http://localhost:8000/health# Health endpoint
curl http://localhost:5001/health
# Expected response:
{
"status": "healthy",
"uptime_seconds": 12345
}# All services
docker compose logs -f
# Specific service
docker compose logs -f webhook-service
# Last 100 lines
docker compose logs --tail=100 config-api# Restart single service
docker compose restart config-api
# Restart all services
docker compose restart# Rebuild and restart admin-ui
docker compose build --no-cache admin-ui
docker compose up -d admin-ui# Stop all services
docker compose down
# Stop and remove volumes (WARNING: deletes database!)
docker compose down -v# Connect to PostgreSQL
docker exec -it splunk-webhook-db psql -U webhook_user -d webhook_admin# Create backup
docker exec splunk-webhook-db pg_dump -U webhook_user webhook_admin > backup.sql
# Restore backup
docker exec -i splunk-webhook-db psql -U webhook_user webhook_admin < backup.sql# WARNING: This deletes all data!
docker compose down -v
docker compose up -d# Prune dangling images
docker image prune -f
# Remove all unused images
docker image prune -a -f# Stop services
docker compose down
# Remove volumes
docker volume rm splunk_weberhook_servicenow_postgres_data
# Remove images
docker rmi $(docker images -q splunk_weberhook_servicenow*)-
Change default credentials:
- Update admin password after first login
- Generate unique ENCRYPTION_KEY and JWT_SECRET
-
Network security:
- Use firewall rules to restrict access
- Consider reverse proxy (nginx) with HTTPS
-
Database security:
- Use strong database password
- Restrict database access to internal network
-
Gunicorn workers: Adjust in
webhook-service/Dockerfile:CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5000", "--timeout", "120", "app.main:app"]
-
Database connections: Default pool size is sufficient for most deployments
-
Health endpoints:
- Config API:
GET /health - Webhook Service:
GET /health
- Config API:
-
Logs:
- Enable log aggregation (ELK, Loki, etc.)
- Monitor for errors in webhook_logs table
- Database: Daily backups with pg_dump
- Configuration: Keep .env files in secure location (not in git)
- Volumes: Regular backup of postgres_data volume
In Splunk, configure an alert to send webhooks to this service:
- Go to Settings > Alert Actions
- Create new Webhook action
- Configure:
- URL:
http://<server-ip>:5001/webhook - Method: POST
- Content-Type: application/json
- URL:
Configure Splunk to send alerts in this format:
{
"result": {
"mnemonic": "$result.mnemonic$",
"host": "$result.host$",
"vendor": "$result.vendor$",
"message_text": "$result._raw$"
}
}index=network sourcetype=syslog
| eval mnemonic=case(
match(_raw, "DUP_SRC_IP"), "DUP_SRC_IP",
match(_raw, "LINK-3-UPDOWN"), "LINK_DOWN",
match(_raw, "BGP.*DOWN"), "BGP_PEER_DOWN"
)
| where isnotnull(mnemonic)
| table mnemonic, host, vendor, _raw
| rename _raw as message_text