We love your input! We want to make contributing to Gurubase as easy and transparent as possible, whether it's:
- Adding a new feature
- Submitting a fix
- Reporting a bug
- Discussing the current state of the code
- Proposing new features
We use VSCode devcontainers for development. This ensures a consistent development environment for all contributors.
- Docker
27.3.x
or later. - Docker Compose (
docker compose
ordocker-compose
)2.30.x
or later. - VSCode with the Remote - Containers extension installed.
- Port
8018
and8019
should be available on your machine.
- Fork the repository by clicking the "Fork" button at the top right of the Gurubase repository page
- Clone your forked repository to your local machine:
git clone https://github.com/YOUR-USERNAME/gurubase.git
- Add the original repository as an upstream remote:
cd gurubase
git remote add upstream https://github.com/Gurubase/gurubase.git
The .dev
folder contains a docker compose file named selfhosted-dev-docker-compose.yml
for a development environment. This will start the necessary containers for frontend and backend development. These services are:
- Milvus
- RabbitMQ
- PostgreSQL
- Redis
- Nginx
To start the development environment, run the following command in the root of the repository:
docker compose -f .dev/selfhosted-dev-docker-compose.yml up -d
After that, you need to start the backend and frontend services. Frontend code is located in src/gurubase-frontend
and backend code is located in src/gurubase-backend
. Open these directories in different VSCode windows.
Open the frontend code in a separate VSCode window:
cd src/gurubase-frontend
code .
Open the backend code in a separate VSCode window:
cd src/gurubase-backend
code .
After you have opened the frontend (src/gurubase-frontend) in a separate VSCode window, follow these steps:
- Open the devcontainer by pressing
F1
orCtrl+Shift+P
and selectingRemote-Containers: Reopen in Container
- Select
Gurubase Selfhosted Dev Container
from the list - Wait for the container to start and the project to open in it
- In the terminal, run
yarn dev-selfhosted
After you have opened the backend (src/gurubase-backend) in a separate VSCode window, follow these steps:
-
Open the devcontainer by pressing
F1
orCtrl+Shift+P
and selectingRemote-Containers: Reopen in Container
-
Select
Gurubase Selfhosted Dev Container
from the list -
Wait for the container to start and the project to open in it
-
If this is the first time you run the backend, you need to run the following command once to fill the database with initial data and other initializations. You don't need to run this command again.
cd backend && ./manage.py migrate && python scripts/1_generate_users.py && python scripts/3_update_site.py && python scripts/5_fill_llm_prices.py && python scripts/4_create_milvus_collections.py && python manage.py collectstatic --noinput --verbosity 0
-
Run the following command to start the backend server:
cd backend bash migrate_runserver.sh
-
You also need to start the celery beat and worker in separate terminals:
-
Open a new terminal and run the following command to start the celery beat:
bash start_scripts/start_celery_beat.sh
-
Open another terminal and run the following command to start the celery worker:
bash start_scripts/start_celery_worker.sh
-
-
At the end, there will be 3 terminals running. One for the backend, one for the celery beat and one for the celery worker.
-
If you work on the Gurubase Discord bot, you need to start its backend separately. Otherwise, you can ignore this step.
bash start_scripts/start_discord_listener.sh
Note, to be able to use the debuggers,
Press
F1
orCtrl+Shift+P
Select "Python: Select Interpreter"
Select "Enter interpreter path..."
Type
/workspace/.venv/bin/python
and enterFrom Visual Studio Code or Cursor, you can visit the "Run and Debug" section and use it.
- You should be able to access Gurubase UI at
http://localhost:8019
. - You should be able to access Django Admin Panel at
http://localhost:8018/admin
.- The default credentials are:
- Username:
root@gurubase.io
- Password:
ChangeMe
- Username:
- The default credentials are:
selfhosted-dev-docker-compose.yml
file creates a Docker networkselfhosted-dev-gurubase
and all the services communicate over this network.- Nginx is used for serving the frontend, backend and media files.
- Milvus is used for vector search.
- PostgreSQL is used for storing the relational and structured data.
- Redis is used for caching/distributed locking/rate limiting and similar purposes.
- RabbitMQ is used as a broker for Celery.
- If you face any issues about the development environment, please open an issue on GitHub Issues, or contact us on Discord.
We would like to discuss the task before you start working on it. You can select one of the open issues or create a new one and discuss it with the team. Once you have the task assigned, you can start working on it. We also use GitHub Projects to manage tasks. You can find the board here.
- Create a new branch for your changes from
develop
branch - Branch name should be in the following format:
feat/your-feature-name
for new featuresfix/your-fix-name
for bug fixeschore/your-chore-name
for choresrefactor/your-refactor-name
for refactoringtask/your-task-name
for tasks that are not fits to any of the above
- Commit messages should be in the following format:
- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit the first line to 72 characters or less
- Reference issues and pull requests liberally after the first line
- Push your changes to your branch and create a pull request from your branch to
develop
branch - Once the pull request is approved, it will be merged to
develop
branch
By contributing, you agree that your contributions will be licensed under its Apache License 2.0.