Skip to content

created a shared Docker network #28

Merged
LuisJG8 merged 1 commit intoMyProjectsfrom
from_json_to_pqt
Feb 4, 2026
Merged

created a shared Docker network #28
LuisJG8 merged 1 commit intoMyProjectsfrom
from_json_to_pqt

Conversation

@LuisJG8
Copy link
Copy Markdown
Owner

@LuisJG8 LuisJG8 commented Feb 4, 2026

created a shared Docker network and added airflow (astro cli) and Celery queue + Rabbitmq in order to run queue every hour using airflow

…ery queue + Rabbitmq in order to run queue every hour using airflow
@LuisJG8 LuisJG8 merged commit b9a5566 into MyProjects Feb 4, 2026
1 check failed
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @LuisJG8, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request establishes a robust integration between Airflow and Celery, leveraging RabbitMQ as a message broker, all orchestrated within a shared Docker network. The primary goal is to enable Airflow to schedule and trigger Celery tasks hourly for data processing, enhancing the system's distributed task execution capabilities.

Highlights

  • Celery Integration with Airflow: The run_queue.py DAG now initializes a Celery application, configured with environment variables, and dispatches tasks to a Celery worker.
  • Shared Docker Network Setup: A new etl-shared Docker network has been introduced and configured across various services in docker-compose.yml and airflow/docker-compose.override.yml to facilitate inter-service communication.
  • Airflow DAG Task Dispatch: The run_queue DAG's hourly task now actively sends a worker.get_github_data task to the Celery queue, replacing a previous placeholder.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • airflow/dags/run_queue.py
    • Added imports for Celery and os.
    • Initialized a Celery application instance, configuring its broker and backend URLs via environment variables.
    • Updated the DAG's start_date to 2026, 2, 3.
    • Replaced the print("hello") placeholder with a call to app.send_task("worker.get_github_data", args=[0, 500]) within the run_the_queue task.
  • airflow/docker-compose.override.yml
    • Introduced a new docker-compose.override.yml file.
    • Configured Airflow's api-server, scheduler, and triggerer services to connect to the etl-shared network.
    • Declared etl-shared as an external network.
  • client.py
    • Removed a redundant comment line # test.
  • docker-compose.yml
    • Integrated rabbitmq, celery_worker, flower, client, and webserver services into the newly defined etl-shared network.
    • Explicitly defined the etl-shared network as external at the top-level networks section.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request establishes a shared Docker network to integrate Airflow with your Celery and RabbitMQ services. While enabling intended functionality, it introduces a security risk by exposing unauthenticated services, specifically Redis, on the shared network (etl-shared), increasing the attack surface. It is recommended to secure the Redis instance with a password and review the necessity of exposing RabbitMQ and Flower ports to the host if they are only for internal container communication. Additionally, the review suggests improving the new Airflow DAG by promoting best practices like using Airflow Connections for secrets and parameterizing tasks, and cleaning up the Docker Compose configuration for better maintainability.

Comment on lines +36 to +37
networks:
- etl-shared
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

security-medium medium

The Redis service is configured without authentication and is being added to an external shared network (etl-shared). This allows any other container on the same host that joins this network to access the Redis instance without a password. Since Redis is used as a Celery backend, an attacker on the same network could read or manipulate task results, potentially leading to data corruption or unauthorized access to processed information. It is highly recommended to secure Redis with a password and ensure that the shared network is restricted to only necessary services.

Comment on lines +8 to +9
broker = os.getenv('CELERY_BROKER_URL'),
backend = os.getenv('CELERY_BACKEND_URL')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using os.getenv to fetch connection details directly within a DAG is not a recommended practice. It makes the DAG less portable and harder to manage as it creates a tight coupling with the execution environment's environment variables. A more robust and secure approach is to use Airflow Connections. You can store your broker and backend URLs as a Celery connection in the Airflow UI and then retrieve them in your DAG using an Airflow hook. This centralizes connection management and enhances security.

@task
def run_the_queue():
print("hello")
app.send_task("worker.get_github_data", args=[0, 500])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The arguments 0 and 500 are hardcoded in the send_task call. This limits the DAG's flexibility and reusability. To make this task more dynamic, consider using Airflow's params feature. You can define default values in the @dag decorator and override them when triggering the DAG manually.

For example:

@dag(
    # ... other arguments
    params={"start_in_repo_num": 0, "batch_size": 500},
)

You would then access these parameters within your task via the task context.


networks:
etl-shared:
external: true No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This file is missing a final newline character. It's a POSIX standard for text files to end with a newline, and some tools and editors may not handle files correctly without it.

    external: true

Comment on lines +145 to +147
networks:
etl-shared:
external: true No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The etl-shared network is defined as external in both docker-compose.yml and airflow/docker-compose.override.yml. This is redundant. To adhere to the DRY (Don't Repeat Yourself) principle, it's best to define the network in a single location. Since docker-compose.yml serves as the base configuration, I recommend keeping the definition here and removing the networks block from airflow/docker-compose.override.yml.


networks:
etl-shared:
external: true No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This file is missing a final newline character. It's a POSIX standard for text files to end with a newline, and some tools and editors may not handle files correctly without it.

    external: true

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