The FOSS Public Alert Server lets clients receive push notifications via UnifiedPush about emergency and weather alerts worldwide.
This is made possible thanks to OASIS' Common Alerting Protocol (CAP). CAP alerts are used for a wide variety of emergencies. From alerts about extreme weather to alerts about contaminated drinking water to pandemics.
Our server aggregates hundreds of CAP Feeds published by alerting authorities worldwide. When finished, this server can be used with clients like FOSS Warn and KDE's alert integration (still beta).
We have three main motivations. Firstly, we want to offer an easy-to-use alternative to proprietary emergency apps to allow privacy- and freedom-focused people to receive emergency alerts. Secondly, we want to enable other developers to implement clients for different devices like desktop PCs, smart speakers, and Linux smartphones, and last but not least, we want to make traveling easier. While traveling, no one wants to search for and install the local emergency app to receive emergency alerts in this country. With our solution, there is one app for the world. This project aims to expand the existing and already used alerting infrastructure and is not a replacement for any part of it. Stay informed and safe!
a project in collaboration with KDE and the FOSS Warn Team
This project is still in development and not yet ready for production!
2024-10 until 2025-10
This project was funded through the NGI0 Core Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet program, under the aegis of DG Communications Networks, Content and Technology under grant agreement No. 101092990.
The server consists of three parts:
- An off-the-shelf PostGIS database server.
- The AlertHandler, which retrieves the alert sources and stores the alerts in the database Stores alerts in the database and provides endpoints for retrieving alerts
- the SubscriptionHandler, with which you can register for an area to receive push notifications
- A celery worker who calls up the alert-fetching at regular intervals
Starting the development version of Django requires some preliminary work. We recommend using the Provided Docker Compose file for starting the required RabbitMQ and PostGIS services.
To get started with the project, install UV, a fast and performant Python package manager.
# clone or download the repository
git clone https://invent.kde.org/webapps/foss-public-alert-server.git
# change the directory
cd foss-public-alert-server/dev-compose
# this requires having Docker installed
docker compose up -d # this might require sudo depending on your installation
# for stopping the containers run
docker compose downTo execute the Django project, you first need to install some dependencies. The following Linux packages are required:
Fedora
- libpq-devel
- python3-devel
# install these packages with
sudo dnf install libpq-devel python3-develDebian/ubuntu
- pg_config
- python-dev
# install these packages with
sudo apt install pg_config python-devWith these packages installed and RabbitMQ and PostGIS running, you can start Django with
# create directory for Prometheus metrics
mkdir -p /tmp/fpas-metrics
export PROMETHEUS_MULTIPROC_DIR=/tmp/fpas-metrics
export DJANGO_DEBUG=True # in case you want to activate the debug mode of Django
uv sync # only needed on first start or if the dependencies changed.
uv run manage.py collectstatic
uv run manage.py migrate
uv run manage.py runserver 8000
# at the first start, you must create a super user
uv run manage.py createsuperuser
# start celery worker for alert parsing
uv run celery -A foss_public_alert_server worker --loglevel=INFO -n alerts --concurrency 3
# start celery worker for sending push notifications
uv run celery -A foss_public_alert_server worker --loglevel=INFO -Q push_notifications -n notifications --concurrency 1
# if you have Flower installed, you can start the Celery monitoring tool with
uv run celery -A foss_public_alert_server flower --port=5556
# You can now visit the flower under http://localhost:5556
# start celery beat
uv run celery -A foss_public_alert_server beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseSchedulerCheck out the official celery manual
This should install and build everything and should launch the Django application on http://localhost:8000
This repo contains a Docker Compose file that you can quickly start by:
# clone or download the repository
git clone https://invent.kde.org/webapps/foss-public-alert-server.git
# change the directory
cd foss-public-alert-server/compose
# make sure the Docker daemon
# start the Docker container in the background
docker compose up -d # add --build to rebuild the container if needed
# wait until the container is up, then create a Django admin account
docker exec -it foss-public-alert-server-aggregator-1 uv run manage.py createsuperuser
# after that, you should be able to visit the admin page
# via http://localhost:8000/adminPostGIS setup No special configuration is required, but there needs to be an empty database and, depending on your setup, a corresponding database user.
The aggregator service needs to be configured to find your PostGIS database. This can be done in or via environment variables.
POSTGRES_HOST: IP address or host name of the PostGIS serverPOSTGRES_DATABASE: name of the PostGIS databasePOSTGRES_USER: name of the user on the PostGIS databasePOSTGRES_PASSWORD: password for connecting to the PostGIS database
The aggregator service is started as follows for local development:
The default config is for development only, and not safely configured for deployments! We will provide a production ready version in the future.
For a production deployment, you'll likely want to put this application behind an HTTP server. More information can be found in the Django deployment documentation.