
Stores data streams from ADSB receivers to generate insights about the world above us.
Note: This is a WIP, more visualizations soon to come!
skyviz.app »
Table of Contents
The ADS-B Exchange network collects telemetry from plane transponders and publishes the current state of the airspace through their APIs. This project stores and transforms the data to make it available for historical analysis in a Streamlit web app.
Resources are containerized using Docker and hosted in Azure. CI/CD is enabled through Pulumi and Github Actions. Database versioning and migrations are handled by SQLAlchemy ORM and Alembic. Environment configuration is managed using Hydra.
- Create a free subsciption to ADSBexchange APIs on RapidAPI
- Clone the repo
git clone https://github.com/fpvian/sky-viz.git
- Rename
.env.template
to.env
and fill with api keyADSB_EXCHANGE_API_KEY_DEV=<your key here>
- Install Docker
- Start containers
docker compose up
- Navigate to localhost:8501
- Install Python
- Create and activate a virtual environment
python3 -m venv .venv --upgrade-deps source .venv/bin/activate
- Install packages and dependencies
pip install --editable .
- Run modules
python3 -m flights & streamlit run ./src/skyviz/Home.py
Tests are run automatically when opening a PR and merging to main. Coverage reports are added to the PR as a comment.
- Add
ADSB_EXCHANGE_API_KEY_DEV
to the Github repository secrets - Run all tests and generate coverage report
pytest
After following these steps, deployments will be handled automatically when merging to main. Note that webapp_name
in src/flights/config/groups/general.py
and server_name
in src/flights/config/groups/db.py
must be globally unique in Azure.
- Create Pulumi account and access token
- Create Azure account and service principal with "Contributer" role
- Create Docker Hub account and access token
- Populate ARM, PULUMI, DOCKER, POSTGRES, and ADSB fields in .env file and GitHub repository secrets
ARM_CLIENT_ID=<your azure service principal client id> ARM_CLIENT_SECRET=<your azure service principal client secret> ARM_TENANT_ID=<from `az account list`> ARM_SUBSCRIPTION_ID=<id from `az account list`> PULUMI_ACCESS_TOKEN=<your pulumi token> DOCKER_USER=<your docker username> DOCKER_TOKEN=<your docker token> POSTGRES_USERNAME=<make up a username> POSTGRES_PASSWORD=<randomly generate a password> ADSB_EXCHANGE_API_KEY_DEV=<your key here> ADSB_EXCHANGE_API_KEY_PROD=<your key here>
- Install Pulumi
curl -fsSL https://get.pulumi.com | sh
- Run Pulumi
cd deployment/ export SKYVIZ_ENV=prod pulumi up
- Update DNS records and issue certificates for domain
- Install Pulumi app in GitHub repository to preview changes to prod resources as a PR comment
Staging environment is automatically deployed when opening a pull request to main and automatically destroyed when merged. Follow these steps to manually manage staging environment.
- Run Pulumi in a separate stack
cd deployment/ export SKYVIZ_ENV=staging pulumi up
- Navigate to Staging Website
- Clean up resources
pulumi destroy
- Navigate to folder with alembic.ini file
cd src/flights/db/
- Set environment variable to select database
export SKYVIZ_ENV=test # ephemeral sqlite database
- Check for changes to the database model
alembic check
- Create a new version
alembic revision --autogenerate -m "<name of commit>"
- Test migration (migrations are handled automatically)
alembic upgrade heads
- Undo the last migration
alembic downgrade -1
- Restore database to its initial state
alembic downgrade base