Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial devcontainer configuration #1098

Merged
merged 1 commit into from
Jul 9, 2024
Merged

Add initial devcontainer configuration #1098

merged 1 commit into from
Jul 9, 2024

Conversation

brylie
Copy link
Member

@brylie brylie commented Jul 9, 2024

Summary by Sourcery

Initial setup for development container configuration, including Docker Compose setup for a Python and PostgreSQL environment, and Dependabot configuration for automated dependency updates.

Copy link
Contributor

sourcery-ai bot commented Jul 9, 2024

Reviewer's Guide by Sourcery

This pull request introduces an initial devcontainer configuration to streamline the development environment setup. It includes Docker Compose configurations for a Python application and a PostgreSQL database, a Dependabot configuration for automated dependency updates, and a devcontainer.json file to define the development container settings.

File-Level Changes

Files Changes
.devcontainer/docker-compose.yml
.devcontainer/devcontainer.json
Added initial devcontainer configuration to set up a consistent development environment using Docker Compose, including services for the application and PostgreSQL database, and defined settings for the development container.
.github/dependabot.yml Configured Dependabot to automate dependency updates for the devcontainers package ecosystem on a weekly schedule.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

sonarcloud bot commented Jul 9, 2024

@brylie brylie merged commit 987d288 into main Jul 9, 2024
4 checks passed
@brylie brylie deleted the add-devcontainer branch July 9, 2024 11:47
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @brylie - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • Hard-coded database URL found. (link)
  • Hard-coded PostgreSQL password found. (link)
Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🔴 Security: 2 blocking issues, 1 other issue
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

dockerfile: .devcontainer/Dockerfile

volumes:
- ../..:/workspaces:cached
Copy link
Contributor

Choose a reason for hiding this comment

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

🚨 suggestion (security): Volume mount path might be too broad

Mounting ../.. to /workspaces could expose more of the host filesystem than necessary. Consider narrowing the scope to only the required directories.

Suggested change
- ../..:/workspaces:cached
- ../../specific-directory:/workspaces/specific-directory:cached

- ../..:/workspaces:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Using sleep infinity to keep the container running

While sleep infinity is a common way to keep a container running, it might be better to use a more explicit command or a lightweight process manager to handle this.

Suggested change
command: sleep infinity
command: tail -f /dev/null

- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Consider adjusting the update interval

A weekly update interval might be too frequent for some projects. Depending on the project's needs, a bi-weekly or monthly interval could reduce noise and workload.

Suggested change
interval: weekly
interval: monthly

"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"features": {},
"forwardPorts": [8000, 5432],
"postCreateCommand": "pip install --user -r requirements.txt && pre-commit install"
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (bug_risk): Potential issue with pip install --user

Using pip install --user can lead to issues with package paths and permissions. Consider using a virtual environment instead.

network_mode: service:db

environment:
DATABASE_URL: "postgres://postgres:postgres@db:5432/postgres"
Copy link
Contributor

Choose a reason for hiding this comment

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

🚨 issue (security): Hard-coded database URL found.

It's recommended to use environment variables to store sensitive information like database URLs to avoid exposing them in the codebase.

environment:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
Copy link
Contributor

Choose a reason for hiding this comment

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

🚨 issue (security): Hard-coded PostgreSQL password found.

Consider using environment variables to store sensitive information like database passwords to enhance security.

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.

1 participant