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
chmod 755 /var/lib/skyview-adsb /var/log/skyview-adsb >/dev/null 2>&1 || true
# Create database directory for skyview user (not skyview-adsb)
mkdir -p /var/lib/skyview >/dev/null 2>&1 || true
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
# Database directory is managed by skyview-adsb user
# (Database path configured in /etc/skyview-adsb/config.json)
# Set permissions on config files
if [ -f /etc/skyview-adsb/config.json ]; then
@ -55,18 +43,7 @@ case "$1" in
fi
# Initialize database on first install (but don't auto-enable timer)
if [ ! -f /var/lib/skyview/skyview.db ]; then
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
sudo -u skyview-adsb /usr/bin/skyview-data -config /etc/skyview-adsb/config.json update >/dev/null 2>&1 || true
;;
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
PrivateNetwork=false
# Allow writing to log directory
ReadWritePaths=/var/log/skyview-adsb
# Allow writing to log and database directories
ReadWritePaths=/var/log/skyview-adsb /var/lib/skyview-adsb
# Capabilities
CapabilityBoundingSet=CAP_NET_BIND_SERVICE

View file

@ -8,7 +8,7 @@ Wants=network-online.target
Type=oneshot
User=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
StandardError=journal

View file

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

View file

@ -1,125 +1,140 @@
SkyView for Debian
==================
SkyView is a multi-source ADS-B aircraft tracker that connects to dump1090 Beast
format TCP streams and provides a web-based interface for aircraft tracking.
SkyView is a multi-source ADS-B aircraft tracker with comprehensive database integration
for enhanced aviation data and callsign lookup functionality.
Configuration
------------
Post-Installation Setup
-----------------------
The main configuration file is located at:
/etc/skyview/config.json
After installation, SkyView automatically:
- Creates skyview-adsb user and required directories
- Initializes SQLite database with aviation data sources
- Configures systemd services
This file contains:
- Server configuration (port, host)
- List of dump1090 sources to connect to
- Application settings
Required Configuration
----------------------
Example configuration for multiple receivers:
Edit the main configuration file:
/etc/skyview-adsb/config.json
```json
{
"server": {
"host": "",
"port": 8080
},
"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
}
}
```
Update at minimum:
- Source coordinates (latitude/longitude) for your ADS-B receiver locations
- Origin coordinates for map center
- ADS-B receiver connection details (host/port)
See /usr/share/doc/skyview-adsb/CONFIGURATION.md for complete configuration options.
Service Management
-----------------
------------------
SkyView runs as a systemd service. Use these commands to manage it:
SkyView includes two systemd services:
# Start the service
sudo systemctl start skyview
Main Service:
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
sudo systemctl stop skyview
Database Update Service (runs weekly):
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
sudo systemctl restart skyview
Database Management
-------------------
# Enable auto-start on boot
sudo systemctl enable skyview
View database status:
skyview-data -config /etc/skyview-adsb/config.json status
# Disable auto-start on boot
sudo systemctl disable skyview
Update aviation databases:
skyview-data -config /etc/skyview-adsb/config.json update
# Check service status
sudo systemctl status skyview
Optimize database storage:
skyview-data -config /etc/skyview-adsb/config.json optimize
# View logs
sudo journalctl -u skyview -f
List available data sources:
skyview-data -config /etc/skyview-adsb/config.json list
Web Interface
------------
-------------
Once started, the web interface is available at:
http://localhost:8080
Access the web interface at: http://localhost:8080
The interface provides:
Features include:
- Real-time aircraft tracking map
- Aircraft table with filtering and sorting
- Statistics dashboard
- Coverage and signal strength visualization
- 3D radar view (optional)
- Enhanced callsign information with airline details
- Database status monitoring at /database
- Aircraft history and trail visualization
- 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
--------------------
---------------------
/usr/bin/skyview - Main executable
/etc/skyview/config.json - Configuration file
/var/lib/skyview/ - Application data directory
/var/log/skyview/ - Log files
/lib/systemd/system/skyview.service - Systemd service file
Executables:
/usr/bin/skyview - Main ADS-B tracker service
/usr/bin/skyview-data - Database management utility
/usr/bin/beast-dump - Raw ADS-B data analysis tool
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
--------
SkyView runs as the unprivileged 'skyview' user for security. The service has
restricted capabilities and filesystem access.
SkyView runs as the unprivileged 'skyview-adsb' user with comprehensive systemd security hardening:
- NoNewPrivileges, ProtectSystem=strict, ProtectHome=true
- Private temporary directories and device access restrictions
- Restricted namespaces and capabilities
Troubleshooting
--------------
---------------
1. Check service status:
sudo systemctl status skyview
1. Check main service status:
sudo systemctl status skyview-adsb
2. View recent logs:
sudo journalctl -u skyview --no-pager -l
sudo journalctl -u skyview-adsb --no-pager -l
3. Test configuration:
sudo -u skyview /usr/bin/skyview -config /etc/skyview/config.json
3. Test database connectivity:
skyview-data -config /etc/skyview-adsb/config.json status
4. Check network connectivity to dump1090 sources:
telnet <host> <port>
4. Manual database update:
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