Skip to main content

Maintenance

The Maintenance category covers operational settings for maintaining your Hawkra instance, including maintenance mode, Nmap scanning tools, health monitoring, and backup strategies.

Maintenance Mode Settings

SettingKeyTypeDefaultDescription
Maintenance Modemaintenance_modeBooleanfalseDisplays a maintenance notification to all users when enabled
Maintenance Messagemaintenance_messageStringEmptyCustom message shown during maintenance (e.g., Scheduled maintenance. ETA: 2:00 PM UTC.)

Installing Nmap

Navigate to Admin > Settings > Scanning and click Install Nmap. Nmap persists across container restarts but may need reinstalling after image rebuilds.

note

By clicking Install, you acknowledge that you have reviewed and agree to comply with the Nmap Public Source License terms. Hawkra does not bundle Nmap directly — it is installed on-demand from the OS package repository.

Health Checks and Monitoring

cd /opt/hawkra && docker compose -f docker-compose.selfhosted.yml logs backend
cd /opt/hawkra && docker compose -f docker-compose.selfhosted.yml logs -f backend
cd /opt/hawkra && docker compose -f docker-compose.selfhosted.yml logs --since 1h backend
cd /opt/hawkra && docker compose -f docker-compose.selfhosted.yml ps

Backup Recommendations

Regular backups are essential for disaster recovery. A complete Hawkra backup includes three components:

1. Database Volume

The PostgreSQL database contains all your workspace data, user accounts, vulnerabilities, assets, notes, and configuration settings.

# Create a database dump
cd /opt/hawkra && docker compose -f docker-compose.selfhosted.yml exec -T postgres pg_dump -U hawkra hawkra > backup_$(date +%Y%m%d_%H%M%S).sql

# Restore from a dump
cd /opt/hawkra && docker compose -f docker-compose.selfhosted.yml exec -T postgres psql -U hawkra hawkra < backup_20260303_120000.sql
caution

Stop write-heavy operations before taking a database backup to ensure consistency. For production environments, consider using PostgreSQL's continuous archiving (WAL archiving) for point-in-time recovery.

2. File Storage Volume

If using local storage (the default), uploaded files are stored in the file_storage Docker volume.

# Find the volume mount point
docker volume inspect hawkra_file_storage --format '{{ .Mountpoint }}'

# Back up the volume
sudo tar -czf file_storage_backup_$(date +%Y%m%d_%H%M%S).tar.gz -C $(docker volume inspect hawkra_file_storage --format '{{ .Mountpoint }}') .

If using S3 storage, your files are already stored externally. Ensure your S3 bucket has its own backup or versioning policy.

3. Environment Configuration

Back up your .env file, which contains critical secrets:

cp /opt/hawkra/.env /opt/hawkra/.env.backup_$(date +%Y%m%d)

Automated Backup Script

Here is an example script that backs up all three components:

#!/bin/bash
set -euo pipefail

HAWKRA_DIR="/opt/hawkra"
COMPOSE_FILE="docker-compose.selfhosted.yml"
BACKUP_DIR="$HAWKRA_DIR/backups"
TIMESTAMP=$(date +%Y%m%d_%H%M%S)

mkdir -p "$BACKUP_DIR"

# Database
cd "$HAWKRA_DIR" && docker compose -f "$COMPOSE_FILE" exec -T postgres pg_dump -U hawkra hawkra > "$BACKUP_DIR/db_$TIMESTAMP.sql"

# File storage
VOLUME_PATH=$(docker volume inspect hawkra_file_storage --format '{{ .Mountpoint }}')
tar -czf "$BACKUP_DIR/files_$TIMESTAMP.tar.gz" -C "$VOLUME_PATH" .

# Backend config (encryption keys)
CONFIG_PATH=$(docker volume inspect hawkra_backend_config --format '{{ .Mountpoint }}')
tar -czf "$BACKUP_DIR/backend_config_$TIMESTAMP.tar.gz" -C "$CONFIG_PATH" .

# Environment file
cp "$HAWKRA_DIR/.env" "$BACKUP_DIR/env_$TIMESTAMP"

# Cleanup backups older than 30 days
find "$BACKUP_DIR" -type f -mtime +30 -delete

echo "Backup completed: $TIMESTAMP"

Schedule this with cron to run daily:

# Edit crontab
crontab -e

# Add this line to run at 2:00 AM daily
0 2 * * * /opt/hawkra/backup.sh >> /var/log/hawkra-backup.log 2>&1