After an upgrade or an initial deployment, you'll need to create or migrate the database schema. This script will activate the tor-weather virtual environment, export the tor-weather envvar settings, and then create/migrate the database schema.
After an upgrade or an initial deployment, you'll need to create or migrate the database schema. This script will activate the tor-weather virtual environment, export the tor-weather envvar settings, and then create/migrate the database schema. Note: the `flask` command might need to get updated dependent on the Python version running.
flask --app tor_weather.app db upgrade --directory /home/weather/tor-weather-venv/lib/python3.11/site-packages/tor_weather/migrations
exit
exit
```
```
...
@@ -150,15 +159,21 @@ exit
...
@@ -150,15 +159,21 @@ exit
## Services
## Services
the tor-weather deployment consists of three main services:
The tor-weather deployment consists of three main services:
1. apache: configured in puppet. proxies requests to `http://localhost:8000`
1. apache: configured in puppet. proxies requests to `http://localhost:8000`
1. gunicorn: started by a systemd service file configured in puppet. runs with 5 workers (recommended by gunicorn docs: (2 * nproc) + 1), listens on localhost port 8000
1. gunicorn: started by a systemd service file configured in puppet. runs with 5 workers (recommended by gunicorn docs: (2 * nproc) + 1), listens on localhost port 8000
1. postgres: a base postgres installation with a `torweather` user and database
1. postgres: a base postgres installation with a `torweather` user and database
Additionally, there are three services related to task scheduling:
1. rabbitmq: configured in puppet, a message broker (listening on `localhost:5672`)
1. celery: task queue, started by a systemd service file configured in puppet
1. celery beat: scheduler, started by a systemd service file configured in puppet
## Storage
## Storage
tor-weather is backed by a postgres database. the postgres database is configured in the `/home/weather/tor-weather/env` file, using a [sqlalchemy connection URI][].
tor-weather is backed by a postgres database. the postgres database is configured in the `/home/weather/.tor-weather.env` file, using a [sqlalchemy connection URI][].
@@ -166,7 +181,7 @@ tor-weather is backed by a postgres database. the postgres database is configure
...
@@ -166,7 +181,7 @@ tor-weather is backed by a postgres database. the postgres database is configure
### Onionoo Update Job
### Onionoo Update Job
The `tor-weather-onionoo.service` and `tor-weather-onionoo.timer` files run a job every 15 minutes to update tor-weather's onionoo metrics information. Tor-weather handling its own job scheduling is a planned feature.
The `tor-weather-celerybeat.service` file triggers a job every 15 minutes to update tor-weather's onionoo metrics information.