This project is a Django application that uses PostgreSQL with pgvector extension for vector similarity search capabilities.
- Docker (version 20.10.0 or higher)
- Docker Compose (version 2.0.0 or higher)
- Git (optional, for cloning the repository)
botify/
├── api/ # API endpoints
├── config/ # Django project configuration
├── staticfiles/ # Static files
├── .env # Environment variables
├── requirements.txt # Python dependencies
├── manage.py # Django management script
├── Dockerfile # Docker configuration
└── docker-compose.yml # Docker Compose configuration
-
Clone the repository (if you haven't already):
git clone <repository-url> cd botify
-
Create environment variables:
- Copy the
.env.example
file to.env
:
cp .env.example .env
- Update the
.env
file with your desired configuration
- Copy the
-
Build and start the containers:
docker-compose up --build
This will:
- Build the Django application container
- Start the PostgreSQL database with pgvector
- Run the migration
- Run the Django development server
-
Create a superuser (optional):
docker-compose exec api python manage.py createsuperuser
- Django Application: http://localhost:8000
- Admin Interface: http://localhost:8000/admin
- API Endpoints: http://localhost:8000/api/
The PostgreSQL database is configured with the following defaults:
- Host: db
- Port: 5432
- Database: botify
- User: postgres
- Password: postgres
-
Making changes to the code:
- The application code is mounted as a volume, so changes will be reflected immediately
- No need to rebuild the container for code changes
-
Installing new dependencies:
- Add new packages to
requirements.txt
- Rebuild the containers:
docker-compose up --build
- Add new packages to
-
Viewing logs:
docker-compose logs -f
-
Stop the containers:
docker-compose down
-
Stop and remove volumes (including database data):
docker-compose down -v
-
Run management commands:
docker-compose exec api python manage.py <command>
-
Access the database:
docker-compose exec db psql -U postgres -d botify
-
Port conflicts:
- If port 8000 or 5432 is already in use, modify the ports in
docker-compose.yml
- If port 8000 or 5432 is already in use, modify the ports in
-
Database issues:
- If the database isn't starting properly, try:
docker-compose down -v docker-compose up --build
-
Container issues:
- To rebuild a specific service:
docker-compose up --build api
For production deployment, you should:
- Set appropriate environment variables
- Use a production-grade WSGI server (Gunicorn is already configured)
- Configure proper security settings
- Set up proper static file serving
- Use a production-grade database backup strategy