availabili.tf/README.md

100 lines
2.5 KiB
Markdown
Raw Permalink Normal View History

2024-11-06 20:56:55 -08:00
# availabili.tf
2024-12-11 22:34:05 -08:00
Schedule and availability system for Team Fortress 2 teams.
2024-11-06 20:56:55 -08:00
## Tech Stack
- **Frontend:** [Vue 3](https://v3.vuejs.org/) + TypeScript
- **State Management:** [Pinia](https://pinia.vuejs.org/)
- **Backend:** [Flask](https://flask.palletsprojects.com/) + Python
- **ORM:** [SQLAlchemy](https://www.sqlalchemy.org/)
- **Validation:** [Pydantic](https://pydantic-docs.helpmanual.io/)
- [spectree](https://spectree.readthedocs.io/en/latest/index.html) for
OpenAPI documentation
- [Flask-Migrate](https://flask-migrate.readthedocs.io/en/latest/)
(Alembic) for database migrations
2024-12-11 22:34:05 -08:00
- [Celery](https://docs.celeryproject.org/en/stable/) for async and
scheduled tasks
2024-12-10 18:18:40 -08:00
- [Redis](https://redis.io/) for Celery broker
- **Database:** [PostgreSQL 17.1](https://www.postgresql.org/docs/17/index.html)
(production) / SQLite (development)
2024-11-06 20:56:55 -08:00
2024-12-11 22:48:11 -08:00
## File Structure
```
availabili.tf/ root
├── availabili.tf/ frontend (Vue.js)
├── backend-flask/ backend/software layer (Python)
├── nginx/ reverse proxy
├── docker-compose.prod.yml production environment
├── docker-compose.yml development environment
└── README.md this file
```
2024-12-11 22:34:05 -08:00
## Setup (production, Postgres)
2024-11-06 20:56:55 -08:00
2024-12-11 22:34:05 -08:00
Build the frontend app, assuming Node.js is installed:
2024-12-11 20:34:03 -08:00
```sh
cd availabili.tf
npm install
npm run build
2024-12-11 22:34:05 -08:00
cd ..
2024-12-11 20:34:03 -08:00
```
2024-12-11 22:34:05 -08:00
Build the rest of the containers:
2024-12-11 20:34:03 -08:00
2024-11-06 20:56:55 -08:00
```sh
2024-12-11 22:34:05 -08:00
docker compose -f docker-compose.prod.yml build
docker compose -f docker-compose.prod.yml up db backend
2024-11-06 20:56:55 -08:00
```
2024-12-11 22:34:05 -08:00
Perform initial database migration. This is for automatically setting up the
database schema for the first time:
2024-11-06 20:56:55 -08:00
2024-12-11 22:34:05 -08:00
```sh
2024-12-11 22:58:38 -08:00
docker exec -it backend-production bash
2024-12-11 22:34:05 -08:00
flask db upgrade
exit
```
Bring up the rest of the containers:
```sh
docker compose -f docker-compose.prod.yml up
```
The app will run at port 8000 and the database will be available at port 5432.
## Setup (development, SQLite3)
2024-12-10 18:18:40 -08:00
Build the frontend app:
```sh
cd availabili.tf
2024-12-11 20:34:03 -08:00
npm install
2024-12-10 18:18:40 -08:00
npm run build
```
2024-12-11 22:34:05 -08:00
Build the rest of the containers and perform initial database migration:
2024-12-10 18:18:40 -08:00
```sh
2024-12-11 22:34:05 -08:00
docker compose build
docker compose up
DATABASE_URI=sqlite:///db.sqlite3 flask db upgrade
2024-12-10 18:18:40 -08:00
```
2024-12-11 22:34:05 -08:00
The app will run at port 8000.
2024-12-10 18:18:40 -08:00
## OpenAPI
2024-11-06 20:56:55 -08:00
The backend will automatically serve its OpenAPI-compliant spec at
`/apidoc/openapi.json` which can also be viewed at `/apidoc/redoc` or
`/apidoc/swagger` or `/apidoc/scalar`.
2024-12-11 22:34:05 -08:00
To regenerate the frontend client during development:
2024-11-06 20:56:55 -08:00
```sh
npm run openapi-generate
2024-11-06 20:56:55 -08:00
```