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

Better docker development tools #551

Merged
merged 6 commits into from
Feb 15, 2025
Merged

Better docker development tools #551

merged 6 commits into from
Feb 15, 2025

Conversation

norbusan
Copy link
Member

@norbusan norbusan commented Feb 14, 2025

  • make hard-coded UID/GID in Dockerfile configurable
  • add a Makefile to build the local docker image
  • Allow pretalx to take argument devel for hot reloading gunicorn

Summary by Sourcery

Configure UID/GID in the Dockerfile, add a Makefile for local Docker image builds, and allow pretalx to take a 'devel' argument for hot reloading gunicorn and setting debug log level.

Build:

  • Add a Makefile to build the local Docker image with configurable UID/GID, and update the Dockerfile to use these arguments when creating the pretixuser.
  • Update the Dockerfile to use configurable UID/GID when creating the pretixuser group and user, allowing for better integration with the host system during development and avoiding permission issues when mounting volumes.

Deployment:

  • Add a devel command to the pretix.bash script to enable hot reloading of gunicorn and set the log level to debug during development within the Docker container.
  • Make the UID and GID configurable in the Dockerfile to allow for easier development and avoid permission issues when mounting volumes.

- allow for UID/GID of user to be determined at image build time
- allow passing in --reload and change log level for gunicorn
- provide a new pretalx command `devel` that is used for starting
  in reloading mode
Copy link
Contributor

sourcery-ai bot commented Feb 14, 2025

Reviewer's Guide by Sourcery

This pull request improves the docker development experience by allowing the user and group IDs to be configured, adding a Makefile target to build the local docker image, allowing pretix to be run in development mode with hot reloading, and making the gunicorn log level configurable.

Sequence diagram for pretix in development mode

sequenceDiagram
    participant User
    participant Docker Container
    participant Supervisord
    participant Gunicorn

    User->>Docker Container: Runs 'docker compose up'
    Docker Container->>Docker Container: Executes 'pretix devel'
    Docker Container->>Docker Container: Runs 'make production'
    Docker Container->>Docker Container: Sets GUNICORN_LOGLEVEL to debug
    Docker Container->>Docker Container: Sets GUNICORN_RELOAD to true
    Docker Container->>Supervisord: Starts Supervisord with config
    Supervisord->>Gunicorn: Starts Gunicorn with --reload and --log-level=debug
    Gunicorn->>Gunicorn: Hot reloading on source file changes
Loading

File-Level Changes

Change Details Files
Allow the user and group IDs to be configured when building the Docker image.
  • Added UID and GID build arguments to the Dockerfile.
  • Used the UID and GID build arguments when creating the pretixuser user and group.
Dockerfile
Makefile
Added a Makefile target to build the local docker image.
  • Added a local target to the Makefile that builds the Docker image with the current user's UID and GID.
Makefile
Allow running pretix in development mode with hot reloading.
  • Added a devel argument to the pretix.bash script that enables hot reloading of gunicorn and sets the log level to debug.
  • The devel argument executes make production to ensure the application is built.
  • The devel argument starts supervisord to manage the processes.
deployment/docker/pretix.bash
Make gunicorn log level configurable.
  • Introduced GUNICORN_LOGLEVEL environment variable to configure gunicorn log level.
  • Set the gunicorn log level using the GUNICORN_LOGLEVEL environment variable.
deployment/docker/pretix.bash

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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 @norbusan - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a make help target to explain the available make commands.
  • The TODO comment in the Dockerfile should be addressed before merging.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 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 and I'll use the feedback to improve your reviews.

mariobehling and others added 3 commits February 15, 2025 06:50
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@mariobehling mariobehling merged commit a3f2d27 into development Feb 15, 2025
3 of 5 checks passed
@norbusan norbusan deleted the docker-dev branch February 15, 2025 11:41
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