Feat logging#181
Conversation
Reviewer's GuideDisables several brittle integration-style tests, extends Docker and docker-compose configuration to support MongoDB and Dozzle for logging/storage, and adds developer documentation for the new tooling and storage options. Flow diagram for logging and storage with MongoDB and Dozzleflowchart LR
App[CLI Surf app container] --> Stdout[STDOUT output]
Stdout --> DockerLogs[Docker logs]
DockerLogs --> Dozzle[Dozzle container real_time_log_viewer]
App -->|DB_URI_set| MongoDB[mongodb_local or cloud MongoDB]
MongoDB --> DevTools[Developer tools such as MongoDB Compass]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 5 issues, and left some high level feedback:
- Instead of commenting out the failing tests with TODOs, consider marking them with
@pytest.mark.skipor@pytest.mark.xfail(and a clear reason) so they remain visible in the test suite while not breaking CI. - The
Dockerfileline installinglibkrb5-devhas a trailing backslash with a space (libkrb5-dev \), which will break theRUNcommand; remove the extra space or backslash to ensure the image builds correctly.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Instead of commenting out the failing tests with TODOs, consider marking them with `@pytest.mark.skip` or `@pytest.mark.xfail` (and a clear reason) so they remain visible in the test suite while not breaking CI.
- The `Dockerfile` line installing `libkrb5-dev` has a trailing backslash with a space (`libkrb5-dev \ `), which will break the `RUN` command; remove the extra space or backslash to ensure the image builds correctly.
## Individual Comments
### Comment 1
<location> `Dockerfile:14-16` </location>
<code_context>
COPY .env.example .env
+# Install the tool the dependencies need
+RUN apt-get update && apt-get install -y \
+ gcc \
+ libkrb5-dev \
+ && rm -rf /var/lib/apt/lists/*
+
</code_context>
<issue_to_address>
**issue (bug_risk):** The trailing space after the backslash will break the RUN command at build time.
Because of the trailing space, the backslash escapes the space instead of the newline, so the shell sees `libkrb5-dev\` as the end of the line and the RUN command will fail to parse. Remove the trailing space (or the backslash if it’s the last package) to fix it.
</issue_to_address>
### Comment 2
<location> `compose.yaml:14-17` </location>
<code_context>
+ depends_on:
+ - mongodb
+
+ mongodb:
+ image: mongo:latest
+ container_name: mongodb_local
+ restart: always
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Using the `latest` MongoDB tag can introduce non-deterministic behavior across environments.
Please pin MongoDB to a specific major/minor version (e.g. `mongo:7.0`) so environment behavior stays consistent when new images are published, especially when debugging version-specific issues locally.
```suggestion
mongodb:
image: mongo:7.0
container_name: mongodb_local
restart: always
```
</issue_to_address>
### Comment 3
<location> `compose.yaml:23-28` </location>
<code_context>
+ volumes:
+ - mongo_data:/data/db
+
+ dozzle:
+ image: amir20/dozzle:latest
+ container_name: dozzle
+ restart: always
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock
+ ports:
+ - 8080:8080
</code_context>
<issue_to_address>
**🚨 question (security):** Mounting the Docker socket into the dozzle container has security implications.
Mounting `/var/run/docker.sock` gives this container broad control over the Docker daemon (and effectively the host). If this is meant only for local/dev use, please make that explicit in the compose file or related docs and ensure it’s not used as-is in production.
</issue_to_address>
### Comment 4
<location> `docs/tooling.md:5` </location>
<code_context>
+
+## [Dozzle](https://github.com/amir20/dozzle)
+
+When using Docker Compose to spin up the app, a dozzle container is deployed.
+This can be accessed at `http://localhost:8080/` to view live Docker logs.
+
</code_context>
<issue_to_address>
**nitpick (typo):** Capitalize "Dozzle" for consistency with the product name and heading.
In the sentence, change “a dozzle container” to “a Dozzle container” to use the correct proper noun capitalization.
```suggestion
When using Docker Compose to spin up the app, a Dozzle container is deployed.
```
</issue_to_address>
### Comment 5
<location> `docs/tooling.md:8` </location>
<code_context>
+When using Docker Compose to spin up the app, a dozzle container is deployed.
+This can be accessed at `http://localhost:8080/` to view live Docker logs.
+
+> **_NOTE:_** Dozzle logs are not persistent - nothing is stored, it is just a real-time log viewer for Docker containers
\ No newline at end of file
</code_context>
<issue_to_address>
**issue (typo):** Tighten punctuation in the NOTE sentence (comma splice and missing period).
This sentence has a comma splice ("nothing is stored, it is just...") and is missing a period. Please either split it into two sentences (e.g., "Dozzle logs are not persistent — nothing is stored. It is just a real-time log viewer for Docker containers.") or use a semicolon, and add a final period.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| RUN apt-get update && apt-get install -y \ | ||
| gcc \ | ||
| libkrb5-dev \ |
There was a problem hiding this comment.
issue (bug_risk): The trailing space after the backslash will break the RUN command at build time.
Because of the trailing space, the backslash escapes the space instead of the newline, so the shell sees libkrb5-dev\ as the end of the line and the RUN command will fail to parse. Remove the trailing space (or the backslash if it’s the last package) to fix it.
| mongodb: | ||
| image: mongo:latest | ||
| container_name: mongodb_local | ||
| restart: always |
There was a problem hiding this comment.
suggestion (bug_risk): Using the latest MongoDB tag can introduce non-deterministic behavior across environments.
Please pin MongoDB to a specific major/minor version (e.g. mongo:7.0) so environment behavior stays consistent when new images are published, especially when debugging version-specific issues locally.
| mongodb: | |
| image: mongo:latest | |
| container_name: mongodb_local | |
| restart: always | |
| mongodb: | |
| image: mongo:7.0 | |
| container_name: mongodb_local | |
| restart: always |
| dozzle: | ||
| image: amir20/dozzle:latest | ||
| container_name: dozzle | ||
| restart: always | ||
| volumes: | ||
| - /var/run/docker.sock:/var/run/docker.sock |
There was a problem hiding this comment.
🚨 question (security): Mounting the Docker socket into the dozzle container has security implications.
Mounting /var/run/docker.sock gives this container broad control over the Docker daemon (and effectively the host). If this is meant only for local/dev use, please make that explicit in the compose file or related docs and ensure it’s not used as-is in production.
| When using Docker Compose to spin up the app, a dozzle container is deployed. | ||
| This can be accessed at `http://localhost:8080/` to view live Docker logs. | ||
|
|
||
| > **_NOTE:_** Dozzle logs are not persistent - nothing is stored, it is just a real-time log viewer for Docker containers No newline at end of file |
There was a problem hiding this comment.
issue (typo): Tighten punctuation in the NOTE sentence (comma splice and missing period).
This sentence has a comma splice ("nothing is stored, it is just...") and is missing a period. Please either split it into two sentences (e.g., "Dozzle logs are not persistent — nothing is stored. It is just a real-time log viewer for Docker containers.") or use a semicolon, and add a final period.
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
General:
Code:
Summary by Sourcery
Introduce optional MongoDB-backed storage and Docker-based log viewing while temporarily disabling flaky integration tests.
New Features:
Build:
Deployment:
Documentation:
Tests: