Skip to content

Conversation

@kevinmuoz
Copy link

Hey,

I noticed there was an old PR about Docker support from about a year ago that never got merged, so I decided to give it another try.

The goal here is just to make it easier to run CAPE locally with Docker on a small dev-only stack that works out of the box.

I’ve been testing it for a few days on Ubuntu and it runs nicely.
It uses simple environment variables and mounts a custom/conf volume so configs can be easily tweaked without rebuilding the image.

Nothing fancy for now, just something to help contributors spin up the environment quickly.
If the community finds it useful, I’d be happy to improve it later with things like Docker profiles, Nginx + uWSGI for a production-style setup, etc.

Open to any feedback or changes needed to get this merged

Thanks!

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kevinmuoz, 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 aims to significantly simplify the local development experience for CAPE by introducing a Docker-based setup. It provides a self-contained environment using docker-compose to orchestrate the CAPE application alongside its PostgreSQL and MongoDB dependencies. The setup is designed for quick spin-up, offering a consistent and easily configurable platform for contributors to get started with CAPE development.

Highlights

  • Docker Development Stack: Introduces a complete docker-compose setup to easily run CAPE locally, streamlining the development environment for contributors.
  • Containerized Services: Defines three core services: cape-db (PostgreSQL), mongodb, and cape-server, each with appropriate configurations, health checks, and dependencies.
  • Automated Setup Scripts: Includes Dockerfile and auxiliary scripts (install.sh, pcap.sh, run.sh) to automate the installation of CAPE dependencies, Python environment setup, and service startup within the container.
  • Configurability and Persistence: Utilizes environment variables for port and credential management, and mounts volumes for PostgreSQL data, MongoDB data, and custom CAPE configurations, allowing easy tweaks without image rebuilding.
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
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 is a great initiative to add Docker support for easier local development. The use of Docker Compose to orchestrate the different services (Postgres, MongoDB, and the CAPE server) is well-structured. However, there are several significant areas for improvement, primarily around Docker best practices, consistency with the existing project setup (Poetry vs. venv), and the development workflow. The current implementation clones the application from a GitHub repository during the image build, which hinders local development. My review includes suggestions to switch to copying local code, use Poetry for dependency management, optimize the Docker image, and improve the robustness of the runtime script. Addressing these points will make the Docker setup more efficient, maintainable, and developer-friendly.

Comment on lines 2 to 9
python cuckoo.py &

cd web

: "${WEB_PORT:=8000}"

python manage.py migrate
python manage.py runserver 0.0.0.0:${WEB_PORT} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This script runs cuckoo.py as a background process and then starts the Django development server in the foreground. If the cuckoo.py process fails for any reason, the container will continue running with only the web server. For a more robust setup, consider using a process manager like supervisord to manage both processes. This would ensure that if one process dies, the entire container can be configured to restart, making the service more reliable.

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