fix: Correct systemd configuration and Debian package setup

- Fix database update service to include config path parameter
- Move ConditionACPower from [Timer] to [Unit] section in timer config
- Add database directory to ReadWritePaths in main service
- Set explicit database path in Debian package config template
- Simplify postinst script to be quiet and use consistent skyview-adsb user
- Update README.Debian with comprehensive systemd service documentation
- Remove confusing dual-user setup in favor of single skyview-adsb user

SystemD Configuration Summary:
- Main service: skyview-adsb.service with database pre-update
- Database service: skyview-database-update.service (oneshot)
- Weekly timer: skyview-database-update.timer (Sunday 3AM with randomization)
- All services use skyview-adsb user consistently
- Database path: /var/lib/skyview-adsb/skyview.db
- Config path: /etc/skyview-adsb/config.json

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2025-08-31 19:59:29 +02:00
commit 779384b748
6 changed files with 169 additions and 123 deletions

View file

@ -18,20 +18,8 @@ case "$1" in
chown skyview-adsb:skyview-adsb /var/lib/skyview-adsb /var/log/skyview-adsb >/dev/null 2>&1 || true chown skyview-adsb:skyview-adsb /var/lib/skyview-adsb /var/log/skyview-adsb >/dev/null 2>&1 || true
chmod 755 /var/lib/skyview-adsb /var/log/skyview-adsb >/dev/null 2>&1 || true chmod 755 /var/lib/skyview-adsb /var/log/skyview-adsb >/dev/null 2>&1 || true
# Create database directory for skyview user (not skyview-adsb) # Database directory is managed by skyview-adsb user
mkdir -p /var/lib/skyview >/dev/null 2>&1 || true # (Database path configured in /etc/skyview-adsb/config.json)
if getent passwd skyview >/dev/null 2>&1; then
chown skyview:skyview /var/lib/skyview >/dev/null 2>&1 || true
else
# Create skyview user for database management
if ! getent group skyview >/dev/null 2>&1; then
addgroup --system --quiet skyview
fi
adduser --system --ingroup skyview --home /var/lib/skyview \
--no-create-home --disabled-password --shell /bin/false --quiet skyview
chown skyview:skyview /var/lib/skyview >/dev/null 2>&1 || true
fi
chmod 755 /var/lib/skyview >/dev/null 2>&1 || true
# Set permissions on config files # Set permissions on config files
if [ -f /etc/skyview-adsb/config.json ]; then if [ -f /etc/skyview-adsb/config.json ]; then
@ -55,18 +43,7 @@ case "$1" in
fi fi
# Initialize database on first install (but don't auto-enable timer) # Initialize database on first install (but don't auto-enable timer)
if [ ! -f /var/lib/skyview/skyview.db ]; then sudo -u skyview-adsb /usr/bin/skyview-data -config /etc/skyview-adsb/config.json update >/dev/null 2>&1 || true
echo "Initializing SkyView database..."
sudo -u skyview /usr/bin/skyview-data update >/dev/null 2>&1 || true
echo "Database initialized with safe (public domain) data."
echo ""
echo "To enable automatic weekly updates:"
echo " systemctl enable --now skyview-database-update.timer"
echo ""
echo "To import additional data sources:"
echo " skyview-data list"
echo " skyview-data import <source>"
fi
;; ;;
esac esac

54
debian/etc/skyview-adsb/config.json vendored Normal file
View file

@ -0,0 +1,54 @@
{
"server": {
"host": "",
"port": 8080
},
"sources": [
{
"id": "primary",
"name": "Primary Receiver",
"host": "localhost",
"port": 30005,
"latitude": 0.0,
"longitude": 0.0,
"altitude": 0.0,
"enabled": true
}
],
"origin": {
"latitude": 0.0,
"longitude": 0.0,
"name": "Receiver Location"
},
"settings": {
"history_limit": 1000,
"stale_timeout": 60,
"update_rate": 1
},
"database": {
"path": "/var/lib/skyview-adsb/skyview.db",
"max_history_days": 7,
"backup_on_upgrade": true,
"max_open_conns": 10,
"max_idle_conns": 5
},
"callsign": {
"enabled": true,
"cache_hours": 24,
"privacy_mode": false,
"sources": {
"openflights_airlines": {
"enabled": true,
"priority": 1
},
"openflights_airports": {
"enabled": true,
"priority": 2
},
"ourairports": {
"enabled": true,
"priority": 3
}
}
}
}

View file

@ -39,8 +39,8 @@ RestrictNamespaces=true
# Allow network access # Allow network access
PrivateNetwork=false PrivateNetwork=false
# Allow writing to log directory # Allow writing to log and database directories
ReadWritePaths=/var/log/skyview-adsb ReadWritePaths=/var/log/skyview-adsb /var/lib/skyview-adsb
# Capabilities # Capabilities
CapabilityBoundingSet=CAP_NET_BIND_SERVICE CapabilityBoundingSet=CAP_NET_BIND_SERVICE

View file

@ -8,7 +8,7 @@ Wants=network-online.target
Type=oneshot Type=oneshot
User=skyview-adsb User=skyview-adsb
Group=skyview-adsb Group=skyview-adsb
ExecStart=/usr/bin/skyview-data update ExecStart=/usr/bin/skyview-data -config /etc/skyview-adsb/config.json update
StandardOutput=journal StandardOutput=journal
StandardError=journal StandardError=journal

View file

@ -2,6 +2,8 @@
Description=SkyView Database Update Timer Description=SkyView Database Update Timer
Documentation=man:skyview-data(1) Documentation=man:skyview-data(1)
Requires=skyview-database-update.service Requires=skyview-database-update.service
# Don't start if system is on battery (laptops)
ConditionACPower=true
[Timer] [Timer]
# Run weekly on Sunday at 3 AM # Run weekly on Sunday at 3 AM
@ -10,8 +12,6 @@ OnCalendar=Sun 03:00
RandomizedDelaySec=3600 RandomizedDelaySec=3600
# Start immediately if system was down during scheduled time # Start immediately if system was down during scheduled time
Persistent=true Persistent=true
# Don't start if system is on battery (laptops)
ConditionACPower=true
[Install] [Install]
WantedBy=timers.target WantedBy=timers.target

View file

@ -1,125 +1,140 @@
SkyView for Debian SkyView for Debian
================== ==================
SkyView is a multi-source ADS-B aircraft tracker that connects to dump1090 Beast SkyView is a multi-source ADS-B aircraft tracker with comprehensive database integration
format TCP streams and provides a web-based interface for aircraft tracking. for enhanced aviation data and callsign lookup functionality.
Configuration Post-Installation Setup
------------ -----------------------
The main configuration file is located at: After installation, SkyView automatically:
/etc/skyview/config.json - Creates skyview-adsb user and required directories
- Initializes SQLite database with aviation data sources
- Configures systemd services
This file contains: Required Configuration
- Server configuration (port, host) ----------------------
- List of dump1090 sources to connect to
- Application settings
Example configuration for multiple receivers: Edit the main configuration file:
/etc/skyview-adsb/config.json
```json Update at minimum:
{ - Source coordinates (latitude/longitude) for your ADS-B receiver locations
"server": { - Origin coordinates for map center
"host": "", - ADS-B receiver connection details (host/port)
"port": 8080
}, See /usr/share/doc/skyview-adsb/CONFIGURATION.md for complete configuration options.
"sources": [
{
"id": "site1",
"name": "Site 1 Receiver",
"host": "192.168.1.100",
"port": 30005,
"latitude": 51.4700,
"longitude": -0.4600,
"altitude": 50.0,
"enabled": true
},
{
"id": "site2",
"name": "Site 2 Receiver",
"host": "192.168.1.101",
"port": 30005,
"latitude": 51.4800,
"longitude": -0.4500,
"altitude": 45.0,
"enabled": true
}
],
"settings": {
"history_limit": 1000,
"stale_timeout": 60,
"update_rate": 1
}
}
```
Service Management Service Management
----------------- ------------------
SkyView runs as a systemd service. Use these commands to manage it: SkyView includes two systemd services:
# Start the service Main Service:
sudo systemctl start skyview sudo systemctl start skyview-adsb
sudo systemctl enable skyview-adsb # Auto-start on boot
sudo systemctl status skyview-adsb
sudo journalctl -u skyview-adsb -f # View logs
# Stop the service Database Update Service (runs weekly):
sudo systemctl stop skyview sudo systemctl start skyview-database-update # Manual update
sudo systemctl enable --now skyview-database-update.timer # Enable weekly updates
sudo systemctl status skyview-database-update.timer
# Restart the service Database Management
sudo systemctl restart skyview -------------------
# Enable auto-start on boot View database status:
sudo systemctl enable skyview skyview-data -config /etc/skyview-adsb/config.json status
# Disable auto-start on boot Update aviation databases:
sudo systemctl disable skyview skyview-data -config /etc/skyview-adsb/config.json update
# Check service status Optimize database storage:
sudo systemctl status skyview skyview-data -config /etc/skyview-adsb/config.json optimize
# View logs List available data sources:
sudo journalctl -u skyview -f skyview-data -config /etc/skyview-adsb/config.json list
Web Interface Web Interface
------------ -------------
Once started, the web interface is available at: Access the web interface at: http://localhost:8080
http://localhost:8080
The interface provides: Features include:
- Real-time aircraft tracking map - Real-time aircraft tracking map
- Aircraft table with filtering and sorting - Enhanced callsign information with airline details
- Statistics dashboard - Database status monitoring at /database
- Coverage and signal strength visualization - Aircraft history and trail visualization
- 3D radar view (optional) - Coverage and signal strength analysis
- 3D radar view
External Data Sources
---------------------
SkyView includes three aviation databases:
- OpenFlights Airlines (~6,162 airlines)
- OpenFlights Airports (~7,698 airports)
- OurAirports (~83,557 airports worldwide)
Privacy Mode: Set "privacy_mode": true in config to disable external data loading.
Files and Directories Files and Directories
-------------------- ---------------------
/usr/bin/skyview - Main executable Executables:
/etc/skyview/config.json - Configuration file /usr/bin/skyview - Main ADS-B tracker service
/var/lib/skyview/ - Application data directory /usr/bin/skyview-data - Database management utility
/var/log/skyview/ - Log files /usr/bin/beast-dump - Raw ADS-B data analysis tool
/lib/systemd/system/skyview.service - Systemd service file
Configuration:
/etc/skyview-adsb/config.json - Main configuration file
Data:
/var/lib/skyview-adsb/ - Application and database directory
/var/log/skyview-adsb/ - Log files
Services:
/lib/systemd/system/skyview-adsb.service - Main service
/lib/systemd/system/skyview-database-update.service - Database updater
/lib/systemd/system/skyview-database-update.timer - Weekly update timer
Documentation:
/usr/share/doc/skyview-adsb/CONFIGURATION.md - Complete configuration guide
/usr/share/doc/skyview-adsb/DATABASE.md - Database schema reference
Security Security
-------- --------
SkyView runs as the unprivileged 'skyview' user for security. The service has SkyView runs as the unprivileged 'skyview-adsb' user with comprehensive systemd security hardening:
restricted capabilities and filesystem access. - NoNewPrivileges, ProtectSystem=strict, ProtectHome=true
- Private temporary directories and device access restrictions
- Restricted namespaces and capabilities
Troubleshooting Troubleshooting
-------------- ---------------
1. Check service status: 1. Check main service status:
sudo systemctl status skyview sudo systemctl status skyview-adsb
2. View recent logs: 2. View recent logs:
sudo journalctl -u skyview --no-pager -l sudo journalctl -u skyview-adsb --no-pager -l
3. Test configuration: 3. Test database connectivity:
sudo -u skyview /usr/bin/skyview -config /etc/skyview/config.json skyview-data -config /etc/skyview-adsb/config.json status
4. Check network connectivity to dump1090 sources: 4. Manual database update:
telnet <host> <port> sudo -u skyview-adsb skyview-data -config /etc/skyview-adsb/config.json update
For more information, visit: https://github.com/skyview/skyview 5. Check ADS-B source connectivity:
telnet <receiver_host> <receiver_port>
6. View database information in web interface:
http://localhost:8080/database
For complete documentation, see:
- /usr/share/doc/skyview-adsb/CONFIGURATION.md
- /usr/share/doc/skyview-adsb/DATABASE.md
- man skyview(1), man skyview-data(1), man beast-dump(1)
Project repository: https://kode.naiv.no/olemd/skyview