mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-08-26 16:40:40 +03:00
Merge pull request #181 from grillazz/179-reflect-latest-and-greatest-fastapi-improvements
179 reflect latest and greatest fastapi improvements
This commit is contained in:
commit
48cbb8cfff
2
.env
2
.env
@ -9,7 +9,7 @@ POSTGRES_USER=user
|
|||||||
POSTGRES_PASSWORD=secret
|
POSTGRES_PASSWORD=secret
|
||||||
|
|
||||||
# Redis
|
# Redis
|
||||||
REDIS_HOST=redis
|
REDIS_HOST=inmemory
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
REDIS_DB=2
|
REDIS_DB=2
|
||||||
|
|
||||||
|
4
Makefile
4
Makefile
@ -65,3 +65,7 @@ model-generate: ## generate sqlalchemy models from database
|
|||||||
.PHONY: docker-up-granian
|
.PHONY: docker-up-granian
|
||||||
docker-up-granian: ## Run project with compose and granian
|
docker-up-granian: ## Run project with compose and granian
|
||||||
docker compose -f granian-compose.yml up --remove-orphans
|
docker compose -f granian-compose.yml up --remove-orphans
|
||||||
|
|
||||||
|
.PHONY: docker-up-valkey
|
||||||
|
docker-up-valkey: ## Run project with compose and valkey
|
||||||
|
docker compose -f valkey-compose.yml up --remove-orphans
|
||||||
|
@ -166,6 +166,7 @@ I've included a few of my favorites to kick things off!
|
|||||||
* [Connection pool for asyncpg](https://magicstack.github.io/asyncpg/current/usage.html#connection-pools)
|
* [Connection pool for asyncpg](https://magicstack.github.io/asyncpg/current/usage.html#connection-pools)
|
||||||
* [Granian - A Rust HTTP server for Python applications](https://github.com/emmett-framework/granian)
|
* [Granian - A Rust HTTP server for Python applications](https://github.com/emmett-framework/granian)
|
||||||
* [APScheduler - In-process task scheduler with Cron-like capabilities](https://apscheduler.readthedocs.io/en/master/)
|
* [APScheduler - In-process task scheduler with Cron-like capabilities](https://apscheduler.readthedocs.io/en/master/)
|
||||||
|
* [Valkey - A simple and fast key-value store](https://github.com/valkey-io/valkey)
|
||||||
|
|
||||||
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
||||||
|
|
||||||
|
@ -44,9 +44,9 @@ services:
|
|||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
|
||||||
redis:
|
inmemory:
|
||||||
image: redis:latest
|
image: redis:latest
|
||||||
container_name: fsap_redis
|
container_name: fsap_inmemory
|
||||||
ports:
|
ports:
|
||||||
- "6379:6379"
|
- "6379:6379"
|
||||||
env_file:
|
env_file:
|
||||||
|
@ -38,9 +38,9 @@ services:
|
|||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
|
||||||
redis:
|
inmemory:
|
||||||
image: redis:latest
|
image: redis:latest
|
||||||
container_name: fsap_redis
|
container_name: fsap_inmemory
|
||||||
ports:
|
ports:
|
||||||
- "6379:6379"
|
- "6379:6379"
|
||||||
env_file:
|
env_file:
|
||||||
|
57
valkey-compose.yml
Normal file
57
valkey-compose.yml
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
services:
|
||||||
|
app:
|
||||||
|
container_name: fsap_app
|
||||||
|
build: .
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
- .secrets
|
||||||
|
command: bash -c "
|
||||||
|
uvicorn app.main:app
|
||||||
|
--log-config ./logging-uvicorn.json
|
||||||
|
--host 0.0.0.0 --port 8080
|
||||||
|
--lifespan=on --use-colors --loop uvloop --http httptools
|
||||||
|
--reload --log-level debug
|
||||||
|
"
|
||||||
|
volumes:
|
||||||
|
- .:/home/code
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
- valkey
|
||||||
|
|
||||||
|
db:
|
||||||
|
container_name: fsap_db
|
||||||
|
build:
|
||||||
|
context: ./db
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
volumes:
|
||||||
|
- fastapi_postgres_data:/var/lib/postgresql/data
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
environment:
|
||||||
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD?Variable not set}
|
||||||
|
- POSTGRES_USER=${POSTGRES_USER?Variable not set}
|
||||||
|
- POSTGRES_DB=${POSTGRES_DB?Variable not set}
|
||||||
|
healthcheck:
|
||||||
|
test:
|
||||||
|
[
|
||||||
|
"CMD-SHELL", "pg_isready -d $POSTGRES_DB -U $POSTGRES_USER"
|
||||||
|
]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
inmemory:
|
||||||
|
image: valkey/valkey:latest
|
||||||
|
container_name: fsap_inmemory
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
entrypoint: valkey-server --loglevel verbose
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
fastapi_postgres_data: {}
|
Loading…
x
Reference in New Issue
Block a user