This is a containerized FastAPI project with PostgreSQL using Docker.
- Docker
- Docker Compose
- Clone the repository and navigate to the folder:
cd globo-prompt- Run the project:
docker-compose up --build- Access the application:
- API: http://localhost:8000
- Swagger Documentation: http://localhost:8000/docs
- ReDoc Documentation: http://localhost:8000/redoc
Stop containers:
docker-compose downStop and remove volumes (deletes database data):
docker-compose down -vView logs:
docker-compose logs -f appRun only the database:
docker-compose up dbGET /- Home pageGET /health- Application health checkGET /items/{item_id}- Example endpoint with parametersGET /docs- Swagger documentationGET /redoc- ReDoc documentation
- PostgreSQL 15
- Port: 5432
- Database: fastapi_db
- User: postgres
- Password: postgres
For local development without Docker:
- Install dependencies:
pip install -r requirements.txt- Configure environment variables:
cp .env.example .env- Run the application:
uvicorn main:app --reloadglobo-prompt/
├── main.py # FastAPI application
├── requirements.txt # Python dependencies
├── Dockerfile # Container configuration
├── docker-compose.yml # Service orchestration
├── .dockerignore # Files ignored in build
└── README.md # This file
Problem: Database connection error
- Solution: Wait a few seconds for PostgreSQL to fully initialize
Problem: Port 8000 already in use
- Solution: Change the port in
docker-compose.ymlor stop other services
Problem: Docker permission error
- Solution: Run with
sudoor add your user to the docker group