Skip to content

Conversation

@adamoutler
Copy link
Collaborator

@adamoutler adamoutler commented Sep 19, 2025

This pull request introduces a Visual Studio Code Development Container to the NetAlertX project. This is a significant enhancement that solves the "it works on my machine" problem by providing every developer with a consistent, pre-configured, and reproducible development environment that runs inside Docker.

For anyone new to devcontainers, think of it as a development environment in a box. It contains all the tools, extensions, and configurations needed to work on NetAlertX, ensuring that every contributor has the exact same setup, regardless of their local operating system. This drastically simplifies onboarding and debugging.

An Owner's Manual for the NetAlertX Devcontainer

This devcontainer is designed to mirror the production container environment as closely as possible, while providing a rich set of tools for development.

How to Get Started

  1. Prerequisites:

  2. Launch the Devcontainer:

    • Clone this repository.
    • Open the repository folder in VS Code.
    • A notification will pop up in the bottom-right corner asking to "Reopen in Container". Click it.
    • VS Code will now build the Docker image and connect your editor to the container. Your terminal, debugger, and all tools will now be running inside this isolated environment.

Key Workflows & Features

Once you're inside the container, everything is set up for you.

1. Services (Frontend & Backend)
image

The container's startup script (.devcontainer/scripts/setup.sh) automatically starts the Nginx/PHP frontend and the Python backend. You can restart them at any time using the built-in tasks.

2. Integrated Debugging (Just Press F5!)
image

Debugging for both the Python backend and PHP frontend is pre-configured and ready to go.

  • Python Backend (debugpy): The backend automatically starts with a debugger attached on port 5678. Simply open a Python file (e.g., server/__main__.py), set a breakpoint, and press F5 (or select "Python Backend Debug: Attach") to connect the debugger.
  • PHP Frontend (Xdebug): Xdebug listens on port 9003. In VS Code, start listening for Xdebug connections and use a browser extension (like "Xdebug helper") to start a debugging session for the web UI.

3. Common Tasks (F1 -> Run Task)
image

We've created several VS Code Tasks to simplify common operations. Access them by pressing F1 and typing "Tasks: Run Task".

  • Generate Dockerfile: This is important. The actual .devcontainer/Dockerfile is auto-generated. If you need to change the container environment, edit .devcontainer/resources/devcontainer-Dockerfile and then run this task.
  • Re-Run Startup Script: Manually re-runs the .devcontainer/scripts/setup.sh script to re-link files and restart services.
  • Start Backend (Python) / Start Frontend (nginx and PHP-FPM): Manually restart the services if needed.

4. Running Tests
image

The environment includes pytest. You can run tests directly from the VS Code Test Explorer UI or by running pytest -q in the integrated terminal. The necessary PYTHONPATH is already configured so that tests can correctly import the server modules.

How to Maintain This Devcontainer

The setup is designed to be easy to manage. Here are the core principles:

  • Don't Edit Dockerfile Directly: The main .devcontainer/Dockerfile is a combination of the project's root Dockerfile and a special dev-only stage. To add new tools or dependencies, edit .devcontainer/resources/devcontainer-Dockerfile and then run the Generate Dockerfile task.
  • Build-Time vs. Run-Time Setup:
    • For changes that can be baked into the image (like installing a new package with apk add), add them to the resource Dockerfile.
    • For changes that must happen when the container starts (like creating symlinks, setting permissions, or starting services), use .devcontainer/scripts/setup.sh.
  • Project Conventions: The .github/copilot-instructions.md file is an excellent resource to help AI and humans understand the project's architecture, conventions, and how to use existing helper functions instead of hardcoding values.

This setup provides a powerful and consistent foundation for all current and future contributors to NetAlertX.

Summary by CodeRabbit

  • New Features

    • Added a full Dev Container setup with preconfigured Nginx/PHP/Python environment, health checks, and service orchestration.
    • Built-in debugging for PHP (Xdebug) and Python (debugpy), with ready-to-use VS Code launch configurations and forwarded ports.
    • Developer scripts to generate the Dockerfile, (re)start backend, start/stop services, stream logs, and run tests.
  • Documentation

    • Added developer guides covering devcontainer behavior, workflows, architecture, and debugging.
  • Chores

    • VS Code settings and tasks for testing and service management.
    • Pytest discovery configuration and minor ignore rule updates.

✔️ Tasks

  • Document usage in an article under /docs

@jokob-sk
Copy link
Collaborator

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 20, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 20, 2025

Walkthrough

Adds a full devcontainer setup with a generated multi-stage Dockerfile, VS Code configs, Xdebug settings, and scripts to build, start, and test services. Introduces nginx/PHP-FPM configuration, backend debug attach, test wiring via pytest, and documentation describing workflows. Minor repo updates include ignore rules and pytest discovery config.

Changes

Cohort / File(s) Summary
Devcontainer Dockerfile and generation
.devcontainer/Dockerfile, .devcontainer/resources/devcontainer-Dockerfile, .devcontainer/scripts/generate-dockerfile.sh
Multi-stage Dockerfile for builder/runner/devcontainer; dev-only stage appended via generator script that filters root Dockerfile content and adds tooling/logging; healthcheck and entrypoints defined.
Devcontainer runtime setup scripts
.devcontainer/scripts/setup.sh, .devcontainer/scripts/restart-backend.sh, .devcontainer/scripts/stream-logs.sh, .devcontainer/scripts/run-tests.sh
Provision workspace, link sources, configure PHP/nginx/Xdebug, start/stop services, restart backend under debugpy, stream logs, and run pytest with configured PYTHONPATH.
Devcontainer configuration
.devcontainer/devcontainer.json, .devcontainer/README.md
VS Code DevContainer definition (build/run args, ports, extensions, settings), postStart provisioning, and documentation of workflows and conventions.
Xdebug and nginx config
.devcontainer/resources/99-xdebug.ini, .devcontainer/xdebug-trigger.ini, .devcontainer/resources/netalertx-devcontainer.conf
Xdebug enablement (always-on and trigger-based configs), nginx virtual host for dev, PHP-FPM proxying, headers, timeouts, and logging to stdout/stderr.
Editor/IDE integration
.vscode/launch.json, .vscode/settings.json, .vscode/tasks.json
Launch configs for Python attach and PHP listen, pytest integration and interpreter path, tasks to generate Dockerfile, rerun setup, and start/stop frontend/backend.
Repo and test config
pyproject.toml, front/.gitignore
Pytest discovery rules (class/function prefixes, file patterns, testpaths) and ignore buildtimestamp.txt.
Project documentation
.github/copilot-instructions.md
Architecture and workflow guidance for development and testing.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer (VS Code)
  participant DC as DevContainer
  participant SU as setup.sh
  participant NG as nginx
  participant PF as php-fpm
  participant BE as Python Backend (debugpy)

  Dev->>DC: Open workspace (devcontainer.json)
  DC->>DC: Build multi-stage Dockerfile (target=devcontainer)
  DC->>SU: postStartCommand: setup.sh
  SU->>SU: Provision /app (links, assets, perms)
  SU->>PF: Start php-fpm
  SU->>NG: Start nginx
  SU->>BE: Launch backend with debugpy (0.0.0.0:5678)
  Dev-->>BE: Attach debugpy (localhost:5678)
  Dev-->>NG: Open forwarded port (frontend)
  Note over NG,PF: PHP requests proxied to php-fpm
Loading
sequenceDiagram
  autonumber
  participant Gen as generate-dockerfile.sh
  participant Root as Root Dockerfile
  participant Frag as resources/devcontainer-Dockerfile
  participant Out as .devcontainer/Dockerfile

  Gen->>Root: Read & filter (remove COPY ${INSTALL_DIR})
  Gen->>Out: Write autogenerated header + filtered content
  Gen->>Out: Patch lines (aiofreepybox, cert COPY)
  Gen->>Frag: Append devcontainer stage
  Frag-->>Out: Final combined Dockerfile
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

I hopped through stages, three by three,
Built a burrow in dev for me.
Nginx hums, PHP squeaks,
Debugpy listens when backend speaks.
With pytest trails and logs that stream—
My carrot-ship now runs supreme. 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "feat: Devcontainer" is concise, follows conventional commit style, and accurately summarizes the primary change (adding a VS Code devcontainer and supporting configuration/scripts), so it clearly reflects the PR's main purpose for reviewers scanning history.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

🧹 Nitpick comments (29)
front/.gitignore (1)

1-1: Also add to Docker ignore to keep images lean.
.gitignore doesn’t affect Docker build context. If any Dockerfile does COPY . (or builds from front/), add the same rule to front/.dockerignore to avoid shipping this artifact into images.

# front/.dockerignore
+buildtimestamp.txt

Optionally, if buildtimestamp.txt can appear elsewhere, centralize with a root .gitignore pattern like **/buildtimestamp.txt.

.github/copilot-instructions.md (6)

5-11: Clarify GraphQL vs REST (avoid misleading scope).

API map below only documents Flask/REST. If GraphQL isn’t actually shipped, drop it here; otherwise reference concrete GraphQL entry points/files.

Apply if REST-only:

- - Backend (Python): main loop + GraphQL/REST endpoints orchestrate scans, plugins, workflows, notifications, and JSON export.
+ - Backend (Python): main loop + REST endpoints orchestrate scans, plugins, workflows, notifications, and JSON export.

23-26: Add minimal auth security guardrails for API usage.

Make expectations explicit (HTTPS, no query-string tokens, standard failures).

 - Authorization: all routes expect header `Authorization: Bearer <API_TOKEN>` via `get_setting_value('API_TOKEN')`.
+ - Authorization: all routes expect header `Authorization: Bearer <API_TOKEN>` via `get_setting_value('API_TOKEN')`.
+   - Use HTTPS only; never send tokens via query params or in logs.
+   - Return 401 (missing/invalid) vs 403 (authenticated but not allowed) consistently.
+   - Consider basic rate‑limiting on write endpoints and verify `Origin/Referer` for browser calls.

28-32: Strengthen guidance on secrets/logging.

Call out secret handling and log masking to prevent accidental leakage.

 - Settings: add/modify via `ccd()` in `server/initialise.py` or per‑plugin manifest. Never hardcode ports or secrets; use `get_setting_value()`.
+ - Settings: add/modify via `ccd()` in `server/initialise.py` or per‑plugin manifest. Never hardcode ports or secrets; use `get_setting_value()`. Do not log secrets; mask values at source.

33-37: Align pytest/devcontainer wording with actual base image.

Text mentions “Alpine packages”; devcontainer may be Debian/Ubuntu. Prefer base‑agnostic phrasing.

- - Testing: pytest available via Alpine packages. Tests live in `test/`; app code is under `server/`. PYTHONPATH is preconfigured to include workspace and `/opt/venv` site‑packages.
+ - Testing: pytest is preinstalled in the devcontainer. Tests live in `test/`; app code is under `server/`. PYTHONPATH is preconfigured to include the workspace and `/opt/venv` site‑packages.

43-46: Verify referenced docs exist; add devcontainer doc link.

Ensure these files are present in this PR; if there’s a dedicated devcontainer doc/README, link it here.

 - Docs: `docs/PLUGINS_DEV.md`, `docs/SETTINGS_SYSTEM.md`, `docs/API_*.md`, `docs/DEBUG_*.md`
+ - Docs: `docs/PLUGINS_DEV.md`, `docs/SETTINGS_SYSTEM.md`, `docs/API_*.md`, `docs/DEBUG_*.md`, `docs/DEVCONTAINER.md` (or `.devcontainer/README.md`)

45-45: Casing consistency (nit).

Use consistent “Nginx/PHP‑FPM” casing as used earlier.

- - Logs: backend `/app/log/app.log`, plugin logs under `/app/log/plugins/`, nginx/php logs under `/var/log/*`
+ - Logs: backend `/app/log/app.log`, plugin logs under `/app/log/plugins/`, Nginx/PHP‑FPM logs under `/var/log/*`
.devcontainer/README.md (1)

10-14: Call out required port forwards (5678, 9003, 20211) and Linux note for host.docker.internal.

Please add a short note that the devcontainer exposes/forwards:

  • 20211 (nginx), 5678 (debugpy), 9003 (Xdebug).
    On Linux, host.docker.internal may not exist depending on Docker; clarify that xdebug.discover_client_host=true mitigates this.
.devcontainer/resources/netalertx-devcontainer.conf (1)

21-25: Use Xdebug 3 settings instead of deprecated remote_enable.

xdebug.remote_enable is a v2 directive. Prefer Xdebug 3 keys to avoid confusion.

Apply this diff:

-        fastcgi_param   PHP_VALUE "xdebug.remote_enable=1";
+        fastcgi_param   PHP_VALUE "xdebug.mode=debug\nxdebug.start_with_request=yes";
.devcontainer/scripts/setup.sh (4)

28-31: Avoid hard‑coding TZ; respect host/user configuration.

Hard-setting TZ=Europe/Paris can surprise non‑EU contributors and tests. Prefer inheriting TZ or default to UTC if unset.

Apply this diff:

-export TZ=Europe/Paris
+export TZ="${TZ:-UTC}"

161-164: Limit nginx fastcgi_pass rewrite to the intended file.

Wildcard editing of /etc/nginx/http.d/*.conf is brittle. Use NGINX_CONFIG_FILE.

Apply this diff:

-    sudo sed -i 's|fastcgi_pass .*|fastcgi_pass 127.0.0.1:9000;|' /etc/nginx/http.d/*.conf
+    sudo sed -i 's|fastcgi_pass .*|fastcgi_pass 127.0.0.1:9000;|' "${NGINX_CONFIG_FILE}"

141-149: Port wait uses ss; provide a fallback for minimal images.

ss may be absent. Fallback to netstat or skip check.

Apply this diff:

-    while ss -ltn | grep -q ":${PORT}[[:space:]]" && [ $tries -lt 10 ]; do
+    while { ss -ltn 2>/dev/null || netstat -ltn 2>/dev/null || true; } | grep -q ":${PORT}[[:space:]]" && [ $tries -lt 10 ]; do

21-23: Consistency: LOGS_LOCATION is unused and differs from /app/log.

Either remove or set it to /app/log to avoid confusion.

Apply this diff:

-export LOGS_LOCATION=/app/logs
+export LOGS_LOCATION=/app/log
.vscode/settings.json (1)

11-13: JSON comments trip strict linters (Biome parse error).

VS Code accepts comments but Biome flagged this file. Either remove comments or exclude .vscode from Biome.

Option A (remove comments):

-    // Let the Python extension invoke pytest via the interpreter; avoid hardcoded paths
-    // Removed python.testing.pytestPath and legacy pytest.command overrides

Option B: ignore via Biome config:

  • Add an ignore rule for ".vscode/*.json".
.devcontainer/xdebug-trigger.ini (1)

1-11: Deduplicate Xdebug config to a single active .ini.

This coexists with 99-xdebug.ini; duplicate/contradicting keys can confuse troubleshooting. Keep one source of truth and ensure setup.sh copies the intended file.

.devcontainer/scripts/run-tests.sh (1)

9-13: Make test runner a bit more robust (exec + sanity check).

Minor hardening so failures propagate and we don’t run against a missing tests dir.

 # Make sure PYTHONPATH includes server and workspace
 export PYTHONPATH="/workspaces/NetAlertX:/workspaces/NetAlertX/server:/app:/app/server:${PYTHONPATH:-}"

 # Default to running the full test suite under /workspaces/NetAlertX/test
-pytest -q --maxfail=1 --disable-warnings test "$@"
+test -d test || { echo "test directory not found at $(pwd)/test" >&2; exit 1; }
+exec pytest -q --maxfail=1 --disable-warnings test "$@"
.devcontainer/scripts/restart-backend.sh (2)

6-12: Use strict mode and log output; remove unused vars.

ShellCheck flagged unused LOG_DIR/PID. Also, without logs it’s hard to diagnose startup issues.

-set -e
+set -eu
-
-LOG_DIR=/app/log
+LOG_DIR=/app/log
 APP_DIR=/app/server
 PY=python3
 PORT_DEBUG=5678
@@
-setsid nohup ${PY} -m debugpy --listen 0.0.0.0:${PORT_DEBUG} /app/server/__main__.py >/dev/null 2>&1 &
-PID=$!
+mkdir -p "$LOG_DIR"
+setsid nohup "${PY}" -m debugpy --listen "0.0.0.0:${PORT_DEBUG}" /app/server/__main__.py \
+  >>"$LOG_DIR/backend.out" 2>&1 &
+echo $! > "$LOG_DIR/backend.pid"
 sleep 2

Also applies to: 20-23


2-4: Update the task name in the comment.

Script says it’s invoked by “Restart GraphQL” but the task is “Start Backend (Python)”.

.devcontainer/devcontainer.json (1)

23-33: Remove deprecated/duplicate PHP debug extension.

felixfbecker.php-debug is deprecated and can conflict with xdebug.php-debug.

       "extensions": [
         "ms-python.python",
         "ms-azuretools.vscode-docker",
-        "felixfbecker.php-debug",
         "bmewburn.vscode-intelephense-client",
         "xdebug.php-debug",
         "ms-python.vscode-pylance",
         "pamaron.pytest-runner",
         "coderabbit.coderabbit-vscode",
         "ms-python.black-formatter"
       ]
.devcontainer/scripts/generate-dockerfile.sh (3)

6-6: Enable strict mode.
[raise_n​inor_issue]

-# Generator for .devcontainer/Dockerfile
+set -eu
+# Generator for .devcontainer/Dockerfile

14-17: Silence ShellCheck SC1007 and make path resolution clearer.

-SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
+SCRIPT_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)"
 DEVCONTAINER_DIR="${SCRIPT_DIR%/scripts}"
 ROOT_DIR="${DEVCONTAINER_DIR%/.devcontainer}"

24-31: Make sed transforms less brittle.

Anchor the COPY deletion and relax the certificate path match for future Python updates.

-sed '/${INSTALL_DIR}/d' "${ROOT_DIR}/Dockerfile" >> "$OUT_FILE"
+sed -E '/^[[:space:]]*COPY[[:space:]]+\.[[:space:]]+\$\{INSTALL_DIR\}\//d' "${ROOT_DIR}/Dockerfile" >> "$OUT_FILE"
@@
-# don't cat the file, just copy it in because it doesn't exist at build time
-sed -i 's|^ RUN cat ${INSTALL_DIR}/install/freebox_certificate.pem >> /opt/venv/lib/python3.12/site-packages/aiofreepybox/freebox_certificates.pem$| COPY install/freebox_certificate.pem /opt/venv/lib/python3.12/site-packages/aiofreepybox/freebox_certificates.pem |' "$OUT_FILE"
+# don't cat the file, just copy it in because it doesn't exist at build time
+sed -i -E 's|^[[:space:]]*RUN[[:space:]]+cat[[:space:]]+\$\{INSTALL_DIR\}/install/freebox_certificate.pem[[:space:]]*>>[[:space:]]*/opt/venv/lib/python.*/site-packages/aiofreepybox/freebox_certificates.pem$| COPY install/freebox_certificate.pem /opt/venv/lib/python3.12/site-packages/aiofreepybox/freebox_certificates.pem |' "$OUT_FILE"
.devcontainer/Dockerfile (2)

73-81: Avoid duplicate pytest installs and unnecessary sudo in build.

You already installed pytest via apk; the additional pip install (and sudo in a root build stage) is redundant.

-RUN apk add --no-cache git nano vim jq php83-pecl-xdebug py3-pip nodejs sudo gpgconf pytest pytest-cov && \
+RUN apk add --no-cache git nano vim jq php83-pecl-xdebug py3-pip nodejs sudo gpgconf pytest pytest-cov && \
@@
-# setup pytest
-RUN sudo /opt/venv/bin/python -m pip install -U pytest pytest-cov
+# setup pytest (already installed via apk; keep pip upgrade only if needed)
+# RUN /opt/venv/bin/python -m pip install -U pytest pytest-cov

Also applies to: 106-108


112-112: Keep container alive reliably on Alpine.

sleep infinity can be flaky with BusyBox. Use a portable pattern.

-ENTRYPOINT ["/bin/sh","-c","sleep infinity"]
+ENTRYPOINT ["/bin/sh","-c","tail -f /dev/null"]
.vscode/tasks.json (2)

61-66: Start frontend tasks: consider explicit daemonization.

Starting both in background is fine; ensure nginx doesn’t fail silently. Optional: add -g 'daemon off;' and run php-fpm in foreground within setsid/supervision if needed.


78-81: Stop task: safer/consistent process stop.

pkill -f 'php-fpm83|nginx|crond|python3' may treat | literally depending on pkill. Use killall for clarity.

-"command": "pkill -f 'php-fpm83|nginx|crond|python3' || true",
+"command": "killall php-fpm83 nginx crond python3 2>/dev/null || true",
.devcontainer/resources/devcontainer-Dockerfile (3)

11-17: Tooling set: verify package names on Alpine and avoid duplication.

gpgconf may be part of gnupg on Alpine; also pytest is installed twice (apk and later pip).

-RUN apk add --no-cache git nano vim jq php83-pecl-xdebug py3-pip nodejs sudo gpgconf pytest pytest-cov && \
+RUN apk add --no-cache git nano vim jq php83-pecl-xdebug py3-pip nodejs sudo gnupg pytest pytest-cov && \
@@
-# setup pytest
-RUN sudo /opt/venv/bin/python -m pip install -U pytest pytest-cov
+# setup pytest (already installed via apk; keep pip upgrade only if needed)
+# RUN /opt/venv/bin/python -m pip install -U pytest pytest-cov

9-10: Avoid hard-coding Python minor version in PYTHONPATH.

This will break on Python upgrades.

-ENV PYTHONPATH=/workspaces/NetAlertX/test:/workspaces/NetAlertX/server:/app:/app/server:/opt/venv/lib/python3.12/site-packages
+ENV PYTHONPATH=/workspaces/NetAlertX/test:/workspaces/NetAlertX/server:/app:/app/server

You already export PYTHONPATH dynamically in run-tests.sh.


51-51: Same keep-alive reliability note as above.

-ENTRYPOINT ["/bin/sh","-c","sleep infinity"]
+ENTRYPOINT ["/bin/sh","-c","tail -f /dev/null"]
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d58471f and 5ffb6f2.

📒 Files selected for processing (18)
  • .devcontainer/Dockerfile (1 hunks)
  • .devcontainer/README.md (1 hunks)
  • .devcontainer/devcontainer.json (1 hunks)
  • .devcontainer/resources/99-xdebug.ini (1 hunks)
  • .devcontainer/resources/devcontainer-Dockerfile (1 hunks)
  • .devcontainer/resources/netalertx-devcontainer.conf (1 hunks)
  • .devcontainer/scripts/generate-dockerfile.sh (1 hunks)
  • .devcontainer/scripts/restart-backend.sh (1 hunks)
  • .devcontainer/scripts/run-tests.sh (1 hunks)
  • .devcontainer/scripts/setup.sh (1 hunks)
  • .devcontainer/scripts/stream-logs.sh (1 hunks)
  • .devcontainer/xdebug-trigger.ini (1 hunks)
  • .github/copilot-instructions.md (1 hunks)
  • .vscode/launch.json (1 hunks)
  • .vscode/settings.json (1 hunks)
  • .vscode/tasks.json (1 hunks)
  • front/.gitignore (1 hunks)
  • pyproject.toml (1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.11.0)
.devcontainer/scripts/generate-dockerfile.sh

[warning] 14-14: Remove space after = if trying to assign a value (for empty string, use var='' ... ).

(SC1007)

.devcontainer/scripts/setup.sh

[warning] 100-100: sudo doesn't affect redirects. Use ..| sudo tee file

(SC2024)

.devcontainer/scripts/restart-backend.sh

[warning] 8-8: LOG_DIR appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 22-22: PID appears unused. Verify use (or export if used externally).

(SC2034)

🪛 Biome (2.1.2)
.vscode/settings.json

[error] 12-13: Expected a property but instead found '}'.

Expected a property here.

(parse)

🔇 Additional comments (5)
front/.gitignore (1)

1-1: LGTM — ignore rule looks correct.
No functional risks; safe to merge.

.github/copilot-instructions.md (1)

47-49: LGTM overall — concise, actionable guidance.

Clear paths, helpers, and validation expectations; will help keep contributions aligned.

pyproject.toml (1)

1-5: Pytest discovery config looks good.

Patterns align with test/ layout and VS Code settings.

If you have async tests, consider adding:
asyncio_mode = "auto" under [tool.pytest.ini_options].

.vscode/launch.json (2)

4-23: Debugpy attach mapping LGTM.

Port and path mappings align with /app layout and restart-backend.sh usage.

Confirm that devcontainer forwards 5678 and that restart-backend.sh starts debugpy in listen mode.


24-32: PHP Xdebug listen config LGTM.

Port and mapping are consistent with nginx/php-fpm and Xdebug settings.

@adamoutler
Copy link
Collaborator Author

Coderabit doesn't understand the difference between a deployment container and a devcontainer. Every comment is irrelevant, and there's basically 0-chance I'm going to Unit Test a devcontainer.

Don't merge this yet BTW. I am missing some resources in the repository. For sure the app.conf and something else.

@adamoutler
Copy link
Collaborator Author

Coderabit dockerfile sequence diagram is wrong

sequenceDiagram
    autonumber
    participant Gen as "generate-dockerfile.sh"
    participant Root as "Production Dockerfile"
    participant Frag as "resources/devcontainer-Dockerfile"
    participant Out as ".devcontainer/Dockerfile"
    Gen->>Out: Create/overwrite with auto-gen header
    Gen->>Root: Read and filter out lines with INSTALL_DIR
    Root-->>Gen: Return filtered content
    Gen->>Out: Append filtered content
    Gen->>Out: Modify in-place patch aiofreepybox and cert lines
    Gen->>Frag: Read content
    Frag-->>Gen: Return content
    Gen->>Out: Append fragment content
Loading

@adamoutler
Copy link
Collaborator Author

During initialization of the devcontainer this became a problem.
In PHP8.1 null was deprecated. A default sane value should be provided here.
image

Empty string works fine.

Copy link
Collaborator Author

@adamoutler adamoutler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete.

@jokob-sk
Copy link
Collaborator

@adamoutler ready to merge?

@adamoutler
Copy link
Collaborator Author

Almost. Still verifying some things.

@jokob-sk
Copy link
Collaborator

No rush, just Ping me when you think it's ready 👍

@adamoutler
Copy link
Collaborator Author

I'm sorry. Not ready yet. I decided to start working in the devcontainer on an ntopng plugin to ensure things were working properly. However, I found a problem with the devcontainer and stashed my changes, then I couldn't get the container working properly. Turns out the backend was crashing out because it found a folder, but no config.json. Anyway... will update shortly. it seems to be working but I must revise the commit history.

@jokob-sk
Copy link
Collaborator

Take all the time you need - and especially, please don't apologise - I'm grateful for the time and effort you put into this.

@adamoutler
Copy link
Collaborator Author

Good to go.

@jokob-sk jokob-sk merged commit 83aa1a9 into netalertx:main Sep 21, 2025
3 checks passed
@adamoutler adamoutler deleted the devving-devcontainer branch September 21, 2025 00:23
@jokob-sk
Copy link
Collaborator

I copied over your overview into the docs: https://github.com/jokob-sk/NetAlertX/blob/main/docs/DEV_DEVCONTAINER.md
thanks again 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants