diff --git a/.gitignore b/.gitignore index fd02ff3..9e5464c 100644 --- a/.gitignore +++ b/.gitignore @@ -136,4 +136,6 @@ dmypy.json *.csv *dump -*.dump \ No newline at end of file +*.dump + +/postgres/data \ No newline at end of file diff --git a/README.md b/README.md index d84a1ef..9cfe984 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,34 @@ # Horras Backend: Backend of Horras, the Haikou Online Ride-hailing Records Analysis System This is the backend of Horras, the Haikou Online Ride-hailing Records Analysis System. It is a Fastapi project with a PostgreSQL database. -See the frontend project [here](https://github.com/yanglinshu/horras). \ No newline at end of file +See the frontend project [here](https://github.com/yanglinshu/horras). + +## Dependencies +Horras Backend is built on top of the following dependencies: +- [Fastapi](https://fastapi.tiangolo.com/) +- [PostgreSQL](https://www.postgresql.org/) +- [Prisma](https://www.prisma.io/) +- [Docker](https://www.docker.com/) + +## Installation +Horras Backend runs its database in a Docker container. To install the database, run the following command: +```bash +docker-compose up -d +``` + +To install the backend, run the following commands: +```bash +pip install -r requirements.txt + +prisma db push + +uvicorn horras_backend.main:app --host 0.0.0.0 +``` + +For compatibility reasons, running the backend in a Docker container is not recommended. + +## Usage +The backend is a Fastapi project. To access the API documentation, go to `http://localhost:8000/docs`. + +## License +This repository is licensed under the [MIT License](https://choosealicense.com/licenses/mit/). diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4be3656 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: '2' +services: + postgres: + build: + context: ./postgres + dockerfile: Dockerfile + ports: + - "5432:5432" + volumes: + - ./postgres/data:/var/lib/postgresql/data + environment: + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=dummy123