guidocioni / point_wx

4 stars 0 forks source link

point_wx

This is a Dash application that uses the open-meteo APIs (https://open-meteo.com/en/docs) to show some interesting plots.

alt|300 alt|300 alt|300

Installation

Install the requirements

Sorry, no explicit packaging with yaml and/or requirements.txt is provided for now. But since you only need a few packages to make it work, it should be fine.

Configuration

You can set the options in src/utils/settings.py

Running

To test just run python src/app.py. To deploy in production something like this should work

gunicorn -b 127.0.0.1:8000 --timeout=90 app:server

You can setup a service using systemd

[Unit]
Description=Gunicorn instance to serve point_wx
After=network.target

[Service]
User=user
Group=group
WorkingDirectory=/home/user/point_wx/src
Environment="MAPBOX_KEY=<mapbox-key-for-geocoding-api>"
Environment="OPENMETEO_KEY=<commercial-key-otherwise-free-is-used>"
Environment="REACT_VERSION=18.2.0" # Needed for dash mantine
ExecStart=/bin/bash -c "source /home/user/miniconda3/bin/activate dash && exec gunicorn -b 127.0.0.1:8000 --workers=3 --timeout=90 --preload app:server"
StandardOutput=append:/var/log/pointwx/point_wx.log
StandardError=append:/var/log/pointwx/point_wx.log

[Install]
WantedBy=multi-user.target

Or with Docker

docker build -t pointwx .
docker run -p 8083:8000 -it -e MAPBOX_KEY=<mapbox-key-for-geocoding-api> -e OPENMETEO_KEY=<commercial-key-otherwise-free-is-used> pointwx