https://github.com/eddyizm/quotes
FastAPI quote app (rest api and jinja html pages)
https://github.com/eddyizm/quotes
caddy fastapi frontend html pod podman postgresql python3 rest-api webapp
Last synced: 5 months ago
JSON representation
FastAPI quote app (rest api and jinja html pages)
- Host: GitHub
- URL: https://github.com/eddyizm/quotes
- Owner: eddyizm
- License: mit
- Created: 2023-02-14T05:18:55.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-29T14:53:40.000Z (about 1 year ago)
- Last Synced: 2025-04-29T15:59:28.611Z (about 1 year ago)
- Topics: caddy, fastapi, frontend, html, pod, podman, postgresql, python3, rest-api, webapp
- Language: Python
- Homepage:
- Size: 393 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# quotes
FastAPI quote app
## local set up
set up local pod, container and db.
`podman pod create -p 8000:8000 -p 5432:5432 --name=quote_pod && podman pod start quote_pod`
`podman build -t quote-app -f Dockerfile --ignorefile .dockerignore`
`podman run -d --pod=quote_pod --name=postgres_db -v dbdata:/var/lib/postgresql/data --env-file src/core/.env docker.io/postgres:latest`
`podman run -d --pod=quote_pod --name=quote-app quote-app`
# Podman
Set up pod to put all related app containers together, like docker compose. Note mapped ports are only declared at the top level , rather the pod the containers are in.
// moving this pod building to a start up script
oracle vps setup
```
sudo firewall-cmd --permanent --zone=public --add-port=80/tcp
sudo firewall-cmd --permanent --zone=public --add-port=443/tcp
sudo firewall-cmd --runtime-to-permanent
```
### create systemd services
Using the user flag, these generated files get stored here [podman docs](https://docs.podman.io/en/latest/markdown/podman-generate-systemd.1.html)
These commands only work after having everything up and running. Which then need to be removed.
`podman generate systemd --files --name quote_pod`
copy files
`mv -v *.service ~/.config/systemd/user/`
enable/disable
`systemctl --user enable pod-quote_pod.service`
enable linger
`loginctl enable-linger $USER`
and start
`systemctl --user start pod-quote_pod.service`
check running
`systemctl --user --type=service --state=running`
### Docker
[Docker set up here](DOCKER.md)
## running jobs
call scraper via container. Use this in the crontab job.
`podman exec quote-app python -m scraper`
### check db in container
`psql -U $POSTGRES_USER $POSTGRES_DB`
### restore backup
`gunzip -c ragingdharmaDbBackup_2025-04-25.sql.tar.gz | podman exec -i postgres_db psql -U root -d postgres`
### tests
Initital testing is against a local container postgres using `pytest` and only testing the open api endpoints atm.
TODO: test the jinja templates, test auth and protected routes.