From 35d570b7cc176a293a095fb3ef710707c70ec86e Mon Sep 17 00:00:00 2001 From: rshaurya24 Date: Thu, 8 Jan 2026 17:59:46 +0530 Subject: [PATCH 01/13] Added basic devcontainer configuration. --- .devcontainer/devcontainer.json | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..ef0fdf9c --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,30 @@ +{ + "name": "BuffaLogs Development", + "dockerComposeFile": "docker-compose.yaml", + "service": "buffalogs", + "workspaceFolder": "/opt/certego/buffalogs", + // Stop all running containers on close + "shutdownAction": "stopCompose", + "remoteUser": "root", + "postCreateCommand": "pip install --no-cache-dir django-debug-toolbar && python manage.py migrate", + "forwardPorts": [8000, 5433, 5672, 15672], + "portsAttributes": { + "8000": { + "label": "Django Dev Server", + "onAutoForward": "notify" + }, + "5433": { + "label": "PostgreSQL", + "onAutoForward": "notify" + }, + "5672": { + "label": "RabbitMQ", + "onAutoForward": "silent" + }, + "15672": { + "label": "RabbitMQ Management", + "onAutoForward": "notify" + } + + } +} From 1a42075ec9125fca678eff9bc761ed1c6e71bfae Mon Sep 17 00:00:00 2001 From: rshaurya24 Date: Thu, 8 Jan 2026 18:02:05 +0530 Subject: [PATCH 02/13] Extended buffalogs, rabbitmq and postgres services for devcontainer --- .devcontainer/docker-compose.yaml | 68 +++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .devcontainer/docker-compose.yaml diff --git a/.devcontainer/docker-compose.yaml b/.devcontainer/docker-compose.yaml new file mode 100644 index 00000000..1ccb3dbf --- /dev/null +++ b/.devcontainer/docker-compose.yaml @@ -0,0 +1,68 @@ +services: + # Development override - extends original docker-compose.yaml + buffalogs_postgres: + extends: + file: ../docker-compose.yaml + service: buffalogs_postgres + volumes: + - buffalogs_postgres_data:/var/lib/postgresql/data + ports: + - "5433:5432" + + buffalogs_rabbitmq: + extends: + file: ../docker-compose.yaml + service: buffalogs_rabbitmq + ports: + - "5672:5672" + - "15672:15672" + + + + # Override buffalogs service for development + buffalogs: + extends: + file: ../docker-compose.yaml + service: buffalogs + build: + context: .. + dockerfile: .devcontainer/Dockerfile.dev + volumes: + - ../buffalogs:/opt/certego/buffalogs + - ../config:/opt/certego/config:ro + - ../.vscode:/opt/certego/buffalogs/.vscode + - buffalogs_django_static:/var/www + - buffalogs_nginx_sockets:/var/run/nginx-sockets + # For development, we need to expose port 8000 for Django runserver and 5678 for debugpy + ports: + - "8000:8000" + - "5678:5678" + environment: + - DEBUG=1 + - CERTEGO_BUFFALOGS_DEBUG=True + - USE_DEBUGPY=1 + command: python -m debugpy --listen 0.0.0.0:5678 manage.py runserver 0.0.0.0:8000 + depends_on: + buffalogs_postgres: + condition: service_healthy + buffalogs_rabbitmq: + condition: service_healthy + + + + + +volumes: + buffalogs_postgres_data: + driver: local + buffalogs_nginx_sockets: + driver: local + buffalogs_django_static: + driver: local + buffalogs_rabbitmq_data: + driver: local + +networks: + buffalogs_network: + driver: bridge + name: buffalogs_network \ No newline at end of file From 552144c66a8b83a58e50ded902218231e6d83055 Mon Sep 17 00:00:00 2001 From: rshaurya24 Date: Fri, 9 Jan 2026 15:23:24 +0530 Subject: [PATCH 03/13] Added customizations and extensions to devcontainer config. --- .devcontainer/devcontainer.json | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ef0fdf9c..85c21513 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -26,5 +26,36 @@ "onAutoForward": "notify" } - } + }, + "customizations": { + "vscode": { + "settings": { + "python.defaultInterpreterPath": "/usr/local/bin/python", + "python.linting.enabled": true, + "python.linting.pylintEnabled": true, + "python.formatting.provider": "black", + "python.testing.pytestEnabled": true, + "python.testing.unittestEnabled": false, + "files.exclude": { + "**/__pycache__": true, + "**/*.pyc": true + }, + "django.debugJustMyCode": false + }, + "extensions": [ + "ms-python.python", + "ms-python.debugpy", + "ms-python.black-formatter", + "ms-python.pylint", + "batisteo.vscode-django", + "ms-vscode.vscode-json", + "redhat.vscode-yaml" + ] + } + }, + "features": { + "ghcr.io/devcontainers/features/git:1": {}, + "ghcr.io/devcontainers/features/github-cli:1": {} + }, + "overrideCommand": false } From 3794602ca78a303745a9329378f251dd9c18153e Mon Sep 17 00:00:00 2001 From: rshaurya24 Date: Fri, 9 Jan 2026 15:23:52 +0530 Subject: [PATCH 04/13] Added celery and celery_beat services. --- .devcontainer/docker-compose.yaml | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/.devcontainer/docker-compose.yaml b/.devcontainer/docker-compose.yaml index 1ccb3dbf..f9c31ec0 100644 --- a/.devcontainer/docker-compose.yaml +++ b/.devcontainer/docker-compose.yaml @@ -48,7 +48,34 @@ services: buffalogs_rabbitmq: condition: service_healthy - + # Development Celery worker + buffalogs_celery: + extends: + file: ../docker-compose.yaml + service: buffalogs_celery + build: + context: .. + dockerfile: .devcontainer/Dockerfile.dev + volumes: + - ../buffalogs:/opt/certego/buffalogs + - ../config:/opt/certego/config:ro + command: celery -A buffalogs worker -c 1 --loglevel=info + environment: + - DEBUG=1 + + # Development Celery beat + buffalogs_celery_beat: + extends: + file: ../docker-compose.yaml + service: buffalogs_celery_beat + build: + context: .. + dockerfile: .devcontainer/Dockerfile.dev + volumes: + - ../buffalogs:/opt/certego/buffalogs + - ../config:/opt/certego/config:ro + environment: + - DEBUG=1 From edeac405e573acce744dd76d39691e1cd8af0cb6 Mon Sep 17 00:00:00 2001 From: rshaurya24 Date: Fri, 9 Jan 2026 15:26:30 +0530 Subject: [PATCH 05/13] Added development dockerfile --- .devcontainer/Dockerfile.dev | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .devcontainer/Dockerfile.dev diff --git a/.devcontainer/Dockerfile.dev b/.devcontainer/Dockerfile.dev new file mode 100644 index 00000000..35616da8 --- /dev/null +++ b/.devcontainer/Dockerfile.dev @@ -0,0 +1,48 @@ +FROM python:3.12-slim-trixie + +ENV INSTALL_PATH /opt/certego +RUN mkdir -p $INSTALL_PATH +WORKDIR $INSTALL_PATH + +# Install system dependencies +RUN sed -i 's/main/main non-free/g' /etc/apt/sources.list.d/debian.sources \ + && apt-get update \ + && apt-get -y install \ + gcc \ + curl \ + git \ + vim \ + && rm -rf /var/lib/apt/lists/* + +# Copy requirements and install Python packages +COPY buffalogs/requirements.txt requirements.txt +RUN pip install --no-cache-dir -r requirements.txt + +# Install additional development packages +RUN pip install --no-cache-dir \ + django-debug-toolbar \ + django-extensions \ + ipython \ + pytest-django \ + pytest-cov \ + black \ + pylint \ + flake8 \ + uwsgi \ + debugpy + +# Copy application code +COPY buffalogs/ /opt/certego/buffalogs/ +RUN chmod +x /opt/certego/buffalogs/run.sh +RUN chmod +x /opt/certego/buffalogs/run_worker.sh +RUN chmod +x /opt/certego/buffalogs/run_beat.sh + +WORKDIR /opt/certego/buffalogs/ + +# Create socket directory for uwsgi +RUN mkdir -p /var/run/nginx-sockets + +# Expose port for development server +EXPOSE 8000 + +CMD ["sleep", "infinity"] \ No newline at end of file From 85f63483cf88bbfa376a3ad33791cf93aa82c43d Mon Sep 17 00:00:00 2001 From: rshaurya24 Date: Sat, 10 Jan 2026 16:18:07 +0530 Subject: [PATCH 06/13] Forwarded celery port --- .devcontainer/devcontainer.json | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 85c21513..f4a0b363 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,7 +7,13 @@ "shutdownAction": "stopCompose", "remoteUser": "root", "postCreateCommand": "pip install --no-cache-dir django-debug-toolbar && python manage.py migrate", - "forwardPorts": [8000, 5433, 5672, 15672], + "forwardPorts": [ + 8000, + 5433, + 5672, + 15672, + 5679 + ], "portsAttributes": { "8000": { "label": "Django Dev Server", @@ -25,7 +31,6 @@ "label": "RabbitMQ Management", "onAutoForward": "notify" } - }, "customizations": { "vscode": { @@ -58,4 +63,4 @@ "ghcr.io/devcontainers/features/github-cli:1": {} }, "overrideCommand": false -} +} \ No newline at end of file From 9c67f619d63e904897d8e57e0b099978c1c8bd73 Mon Sep 17 00:00:00 2001 From: rshaurya24 Date: Sat, 10 Jan 2026 16:19:10 +0530 Subject: [PATCH 07/13] Added command to debug celery workers --- .devcontainer/docker-compose.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.devcontainer/docker-compose.yaml b/.devcontainer/docker-compose.yaml index f9c31ec0..c125d28d 100644 --- a/.devcontainer/docker-compose.yaml +++ b/.devcontainer/docker-compose.yaml @@ -59,7 +59,9 @@ services: volumes: - ../buffalogs:/opt/certego/buffalogs - ../config:/opt/certego/config:ro - command: celery -A buffalogs worker -c 1 --loglevel=info + ports: + - "5679:5679" + command: python -m debugpy --listen 0.0.0.0:5679 --wait-for-client -m celery -A buffalogs worker -c 1 --loglevel=info environment: - DEBUG=1 From 6b0fb081ee3734be7c5876c1295b2ced2668d9ad Mon Sep 17 00:00:00 2001 From: rshaurya24 Date: Tue, 13 Jan 2026 11:46:24 +0530 Subject: [PATCH 08/13] Added documentation for develoment with Dev Containers. --- .../development_with_devcontainers.md | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 docs/guides/development/development_with_devcontainers.md diff --git a/docs/guides/development/development_with_devcontainers.md b/docs/guides/development/development_with_devcontainers.md new file mode 100644 index 00000000..161ab599 --- /dev/null +++ b/docs/guides/development/development_with_devcontainers.md @@ -0,0 +1,122 @@ +# Overview +DevContainers provide a containerized development environment that eliminates the need for local setup of dependencies, databases, and services which saves space on your machine. This guide will help you set up BuffaLogs backend development using DevContainers. + +## Prerequisites +Before starting, ensure you have: +- [Visual Studio Code](https://code.visualstudio.com/) (or any other IDE which support the Dev Containers extension) installed +- [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) installed in your IDE +- Docker and Docker compose plugin installed and running +- Git installed + +# Quick Start +1. **Clone the repository** + ```bash + git clone https://github.com/certego/BuffaLogs.git + cd BuffaLogs + ``` + +2. **Open in DevContainer** + - Open the project in VS Code + - Before starting development with dev containers, ensure that no containers are currently running on your system. This prevents port conflicts and any errors that could interfere with the dev container environment. + - To see current docker containers running on your system, execute: `docker ps`. There shouldn't be any running containers. + - Press `Ctrl+Shift+P` + - Select or type "Dev Containers: Reopen in Container" + - Wait for the container to build and start (first time may take 5-7 minutes) + +3. **Verify setup** + The DevContainer will automatically: + - Install all Python dependencies + - Set up PostgreSQL database + - Setup RabbitMQ message broker + - Run Django migrations + - Start the development server on port 8000 + +# Development Environment +The DevContainer provides the following services: + +## Core Services +| **Service** | **Port** | **Description** | **Access** | +|---|---|---|---| +| Django Dev Server | 8000 | Main BuffaLogs application | http://localhost:8000 | +| PostgreSQL | 5433 | Primary database | localhost:5433 | +| RabbitMQ | 5672 | Message broker | localhost:5672 | +| RabbitMQ Management | 15672 | Web management UI | http://localhost:15672 | +| Celery Worker | 5679 | Celery Worker debugging | localhost:5679 | +| Debug Server | 5678 | Python debugging | localhost:5678 | + +## Development Tools +The container includes: +- **Python 3.12** with all BuffaLogs dependencies +- **Django Debug Toolbar** for enhanced debugging +- **pytest** for testing +- **black** for code formatting +- **pylint** for code linting +- **debugpy** for remote debugging +- **Git** and **GitHub CLI** for version control + +# Working with the DevContainer + +## Django Management Commands +All Django management commands work as expected: + +```bash +# Create superuser +python manage.py createsuperuser + +# Run migrations +python manage.py migrate + +# Start shell +python manage.py shell + +# Collect static files +python manage.py collectstatic +``` + +## Database Access +The PostgreSQL database is automatically configured and accessible: + +```bash +# Connect to database +psql -h localhost -p 5433 -U default_user -d buffalogs +``` + +Default credentials: +- **Username**: default_user +- **Password**: password +- **Database**: buffalogs + + +# Debugging +The DevContainer is configured for remote debugging: + +## Django Debugging +1. Set breakpoints in your code +2. Go to Run and Debug panel in VS Code +3. Select "Python: Django" configuration +4. Start debugging + +## Celery Worker Debugging +The Celery worker is configured for debugging on port 5679: +1. Set breakpoints in Celery tasks +2. Create a debug configuration for port 5679 +3. Go to Run and Debug panel in VS Code +4. Select "Python: Celery Worker" configuration + +Note: For these configurations to appear in the Run and Debug panel in VS Code, you will have to create a `launch.json` file in a `.vscode folder` and manually add these configurations. In case of further assistance, you may reach out to me. + +# Development Workflow + +## Making Changes +1. Edit files in the `buffalogs/` directory +2. Changes are automatically synced to the container +3. Django development server auto-reloads on changes + +## Environment Variables +Key environment variables for development: +- `DEBUG=1` - Enables Django debug mode +- `CERTEGO_BUFFALOGS_DEBUG=True` - BuffaLogs-specific debug settings +- `USE_DEBUGPY=1` - Enables debugpy for remote debugging + + +This DevContainer setup provides a consistent, reproducible development environment that matches the production infrastructure while offering enhanced debugging and development capabilities. \ No newline at end of file From cb14b993f2f1c13357cc8db47862995a363666d6 Mon Sep 17 00:00:00 2001 From: rshaurya24 Date: Tue, 13 Jan 2026 11:50:10 +0530 Subject: [PATCH 09/13] Updated existing docs to link with dev containers. --- README.md | 6 +++++- docs/guides/development/complete_guide_for_developers.md | 2 ++ docs/guides/development/project_architecture.md | 6 +++++- docs/guides/development/step_by_step_example.md | 3 +++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4766fbef..f26a9b7d 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,11 @@ git clone git@github.com:certego/BuffaLogs.git ``` Or download the application directly from the [Docker Hub](https://hub.docker.com/r/certego/buffalogs), with the `sudo docker pull certego/buffalogs:`. -After that, there are two ways of running BuffaLogs, depending on your system configurations: +After that, there are three ways of running BuffaLogs, depending on your system configurations: +* **DevContainers (Only for backend development)**: + * Use [Development with DevContainers](docs/guides/development/development_with_devcontainers.md) for a complete containerized development environment + * All dependencies (PostgreSQL, RabbitMQ, Elasticsearch, Kibana) are pre-configured + * Includes debugging tools and development utilities * if you already have an elastic cluster: * Configure the connection in `config/buffalogs/ingestion.json` (see [Elasticsearch Configuration Guide](docs/ingestion/elasticsearch.md) for detailed instructions) * Set the Elasticsearch URL, credentials, and index patterns diff --git a/docs/guides/development/complete_guide_for_developers.md b/docs/guides/development/complete_guide_for_developers.md index 4fb33974..cad55411 100644 --- a/docs/guides/development/complete_guide_for_developers.md +++ b/docs/guides/development/complete_guide_for_developers.md @@ -6,6 +6,8 @@ Steps workflow for Developers: 1. All the developers have to set the enrivornment correctly → Follow [the System Configuration guide](#system-configuration) + **Alternative Setup**: For a containerized **backend** development environment with all dependencies pre-configured, see [Development with DevContainers](development_with_devcontainers.md). + 1a. Then, if you'd like to make front-end changes, so you need only to query the APIs → Upload [the fixture data](#fixture) and read the [API's section](docs/rest-apis.md) for more details about them 1b. Otherwise, if you want to analyze the back-end development generating new data, please check [the BuffaLogs detection](#run-buffalogs-detection) diff --git a/docs/guides/development/project_architecture.md b/docs/guides/development/project_architecture.md index b823c84c..de06a0bd 100644 --- a/docs/guides/development/project_architecture.md +++ b/docs/guides/development/project_architecture.md @@ -38,4 +38,8 @@ Message queueing allows web servers to respond to requests quickly instead of be ### Celery Beat [Celery Beat](https://docs.celeryq.dev/en/stable/reference/celery.beat.html) is the scheduler, so it keeps track of when tasks should be executed by Celery. -Celery would consume the tasks instantly, instead with Celery Beat the consumption of tasks is periodic. \ No newline at end of file +Celery would consume the tasks instantly, instead with Celery Beat the consumption of tasks is periodic. + +## Development Environment Setup + +For a complete containerized **backend** development environment that includes all the components mentioned above, see [Development with DevContainers](development_with_devcontainers.md). This provides a pre-configured setup with all services running and ready for development. \ No newline at end of file diff --git a/docs/guides/development/step_by_step_example.md b/docs/guides/development/step_by_step_example.md index 42cebb87..5af0b471 100644 --- a/docs/guides/development/step_by_step_example.md +++ b/docs/guides/development/step_by_step_example.md @@ -1,4 +1,7 @@ ## A Step by step Example + +**Alternative Setup**(optional): For a simplified development experience with all services pre-configured, consider using [Development with DevContainers](development_with_devcontainers.md) instead of manual setup. + It is possible to create random logs to test the project just by running the commands below: 1. Launch Elasticsearch and Kibana with the `docker compose -f docker-compose.yaml -f docker-compose.elastic.yaml up -d elasticsearch kibana` command` 2. Load the Elastic Common Schema template running the `./load_templates.sh` script From b94e2562355311470f5cd4147ec4d45d5482f812 Mon Sep 17 00:00:00 2001 From: rshaurya24 Date: Tue, 13 Jan 2026 11:51:18 +0530 Subject: [PATCH 10/13] Labeled port 5679. --- .devcontainer/devcontainer.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f4a0b363..2e4546ac 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -30,6 +30,10 @@ "15672": { "label": "RabbitMQ Management", "onAutoForward": "notify" + }, + "5679": { + "label": "Celery Worker", + "onAutoForward": "notify" } }, "customizations": { From 639a0c1e6649a623e7a01f94b17956b42d37c8e7 Mon Sep 17 00:00:00 2001 From: rshaurya24 Date: Wed, 14 Jan 2026 10:50:12 +0530 Subject: [PATCH 11/13] Refined the devcontainer docs. --- .../development_with_devcontainers.md | 56 ++++++++++++++----- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/docs/guides/development/development_with_devcontainers.md b/docs/guides/development/development_with_devcontainers.md index 161ab599..a827e907 100644 --- a/docs/guides/development/development_with_devcontainers.md +++ b/docs/guides/development/development_with_devcontainers.md @@ -1,12 +1,11 @@ # Overview -DevContainers provide a containerized development environment that eliminates the need for local setup of dependencies, databases, and services which saves space on your machine. This guide will help you set up BuffaLogs backend development using DevContainers. +DevContainers provide a consistent development environment with debuggers that eliminates the need for local setup of dependencies, databases, and services. This guide will help you set up BuffaLogs backend development environment using DevContainers. ## Prerequisites Before starting, ensure you have: -- [Visual Studio Code](https://code.visualstudio.com/) (or any other IDE which support the Dev Containers extension) installed +- [Visual Studio Code](https://code.visualstudio.com/) (or any other IDE which support the Dev Containers) installed - [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) installed in your IDE -- Docker and Docker compose plugin installed and running -- Git installed +- Docker and Docker compose installed and running # Quick Start 1. **Clone the repository** @@ -17,19 +16,20 @@ Before starting, ensure you have: 2. **Open in DevContainer** - Open the project in VS Code - - Before starting development with dev containers, ensure that no containers are currently running on your system. This prevents port conflicts and any errors that could interfere with the dev container environment. + - Before starting development with dev containers, ensure that no `buffalogs` containers are currently running on your system. This prevents port conflicts and any errors that could interfere with the dev container environment. - To see current docker containers running on your system, execute: `docker ps`. There shouldn't be any running containers. - Press `Ctrl+Shift+P` - Select or type "Dev Containers: Reopen in Container" - - Wait for the container to build and start (first time may take 5-7 minutes) + - Wait for the container to build and start (first time may take few minutes) 3. **Verify setup** - The DevContainer will automatically: - - Install all Python dependencies - - Set up PostgreSQL database - - Setup RabbitMQ message broker + The DevContainer will automatically build and run following containers: + - PostgreSQL database + - RabbitMQ message broker + - Celery and Celery beat workers - Run Django migrations - - Start the development server on port 8000 + - Runs `debugpy` on port `5678` for debugging + - Start the Django development server on port 8000 # Development Environment The DevContainer provides the following services: @@ -57,7 +57,7 @@ The container includes: # Working with the DevContainer ## Django Management Commands -All Django management commands work as expected: +All Django management commands work as expected inside the devcontainer terminal: ```bash # Create superuser @@ -91,6 +91,32 @@ Default credentials: The DevContainer is configured for remote debugging: ## Django Debugging + +Configure `launch.json` in VS Code for debugging. +``` +{ + "name": "Python: Django Debug Service", + "type": "debugpy", + "request": "attach", + "connect": { + "host": "localhost", + "port": 5678 + }, + "pathMappings": [ + { + "localRoot": "${workspaceFolder}", + "remoteRoot": "/opt/certego/buffalogs" + } + ], + "justMyCode": false, + "django": true, + "presentation": { + "hidden": false, + "group": "Docker Debug" + } +} +``` + 1. Set breakpoints in your code 2. Go to Run and Debug panel in VS Code 3. Select "Python: Django" configuration @@ -103,14 +129,13 @@ The Celery worker is configured for debugging on port 5679: 3. Go to Run and Debug panel in VS Code 4. Select "Python: Celery Worker" configuration -Note: For these configurations to appear in the Run and Debug panel in VS Code, you will have to create a `launch.json` file in a `.vscode folder` and manually add these configurations. In case of further assistance, you may reach out to me. +Note: For these configurations to appear in the Run and Debug panel in VS Code, you will have to create a `launch.json` file in a `.vscode folder` and manually add these configurations. In case of further assistance, you may reach out. # Development Workflow ## Making Changes 1. Edit files in the `buffalogs/` directory -2. Changes are automatically synced to the container -3. Django development server auto-reloads on changes +2. Django development server auto-reloads on changes ## Environment Variables Key environment variables for development: @@ -118,5 +143,6 @@ Key environment variables for development: - `CERTEGO_BUFFALOGS_DEBUG=True` - BuffaLogs-specific debug settings - `USE_DEBUGPY=1` - Enables debugpy for remote debugging +For closing the devcontainers, go to the bottom left of your screen (in VS Code) and click on `Reopen folder locally`. This will stop all running buffalogs containers. This DevContainer setup provides a consistent, reproducible development environment that matches the production infrastructure while offering enhanced debugging and development capabilities. \ No newline at end of file From cfb7cd99f5f5a1e101bc5653ecf9ebb357e02cc8 Mon Sep 17 00:00:00 2001 From: rshaurya24 Date: Thu, 29 Jan 2026 20:46:26 +0530 Subject: [PATCH 12/13] Pinned library versions. --- .devcontainer/Dockerfile.dev | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.devcontainer/Dockerfile.dev b/.devcontainer/Dockerfile.dev index 35616da8..b0cd2ba9 100644 --- a/.devcontainer/Dockerfile.dev +++ b/.devcontainer/Dockerfile.dev @@ -8,15 +8,15 @@ WORKDIR $INSTALL_PATH RUN sed -i 's/main/main non-free/g' /etc/apt/sources.list.d/debian.sources \ && apt-get update \ && apt-get -y install \ - gcc \ - curl \ - git \ - vim \ - && rm -rf /var/lib/apt/lists/* + gcc \ + curl \ + git \ + vim \ + && rm -rf /var/lib/apt/lists/* # Copy requirements and install Python packages -COPY buffalogs/requirements.txt requirements.txt -RUN pip install --no-cache-dir -r requirements.txt +COPY buffalogs/ /opt/certego/buffalogs/ +RUN pip install --no-cache-dir -r buffalogs/requirements.txt -r buffalogs/requirements_dev.txt # Install additional development packages RUN pip install --no-cache-dir \ @@ -25,14 +25,11 @@ RUN pip install --no-cache-dir \ ipython \ pytest-django \ pytest-cov \ - black \ - pylint \ - flake8 \ - uwsgi \ + black==25.1.0 \ + pylint==3.3.5 \ + flake8==7.1.2 \ debugpy -# Copy application code -COPY buffalogs/ /opt/certego/buffalogs/ RUN chmod +x /opt/certego/buffalogs/run.sh RUN chmod +x /opt/certego/buffalogs/run_worker.sh RUN chmod +x /opt/certego/buffalogs/run_beat.sh From 0dc8e55eec5a14c9a94e825ff87c163bf9acab51 Mon Sep 17 00:00:00 2001 From: rshaurya24 Date: Thu, 29 Jan 2026 20:47:08 +0530 Subject: [PATCH 13/13] Updated post create command. --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 2e4546ac..31ccf35e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,7 +6,7 @@ // Stop all running containers on close "shutdownAction": "stopCompose", "remoteUser": "root", - "postCreateCommand": "pip install --no-cache-dir django-debug-toolbar && python manage.py migrate", + "postCreateCommand": "python manage.py migrate", "forwardPorts": [ 8000, 5433,