https://github.com/dgonzo27/fastapi-demo
Dockerized FastAPI with PostgreSQL
https://github.com/dgonzo27/fastapi-demo
docker docker-compose fastapi fastapi-sqlalchemy postgresql
Last synced: 9 months ago
JSON representation
Dockerized FastAPI with PostgreSQL
- Host: GitHub
- URL: https://github.com/dgonzo27/fastapi-demo
- Owner: dgonzo27
- Created: 2021-12-30T02:05:58.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-12-30T02:06:59.000Z (almost 4 years ago)
- Last Synced: 2025-01-22T09:42:32.264Z (11 months ago)
- Topics: docker, docker-compose, fastapi, fastapi-sqlalchemy, postgresql
- Language: Python
- Homepage:
- Size: 4.88 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fastapi-demo
watch the demo on [youtube](https://youtu.be/f9BwGhUnK6s)
## getting started
1. build the docker containers:
```sh
docker compose build
```
2. run the containers in detached mode:
```sh
docker compose up -d
```
3. apply database migrations:
```sh
docker compose exec api alembic upgrade head
```
4. visit `http://localhost:8000/docs` to create and get movies
5. stop the containers:
```sh
docker compose down
```
## database migrations
> __note__: the application must be up and running before using the following commands
1. create a new migration:
```sh
docker compose exec api alembic revision --autogenerate -m "your comment here"
```
2. apply migrations:
```sh
docker compose exec api alembic upgrade head
```
3. revert a migration:
```sh
docker compose exec api alembic downgrade -1
```