Skip to content

Staging#179

Merged
Riyad-Murad merged 2 commits intomainfrom
staging
May 21, 2025
Merged

Staging#179
Riyad-Murad merged 2 commits intomainfrom
staging

Conversation

@Riyad-Murad
Copy link
Owner

@Riyad-Murad Riyad-Murad commented May 21, 2025

Summary by Sourcery

Apply resource constraints to Docker services, optimize Laravel container startup with cache operations, and update CI workflows to deploy a custom low-memory MySQL configuration.

Enhancements:

  • Apply memory and CPU limits to PHP, MySQL, and Node services in docker-compose
  • Mount mysql-lowmem.cnf for low-memory MySQL configuration and expose the database port
  • Set NODE_OPTIONS for the Node service to cap its heap size

CI:

  • Add steps to copy mysql-lowmem.cnf to EC2 in both staging and production GitHub Actions workflows

Chores:

  • Enhance dockerShell.sh to clear and cache Laravel config, routes, and views before running migrations
  • Introduce mysql-lowmem.cnf with custom low-memory MySQL settings

@sourcery-ai
Copy link

sourcery-ai bot commented May 21, 2025

Reviewer's Guide

This PR bounds container resource usage by adding memory and CPU limits, introduces a low-memory MySQL config, updates CI/CD workflows to deploy it, and enhances the Docker entrypoint script with cache-clearing and caching steps before migrations.

Flow Diagram: Updated amp-laravel Startup Script (dockerShell.sh)

graph TD
    Start["Previous steps (e.g., composer install)"] --> ConfigClear["php artisan config:clear"]
    ConfigClear --> NewCacheClear["php artisan cache:clear (New)"]
    NewCacheClear --> NewRouteClear["php artisan route:clear (New)"]
    NewRouteClear --> NewViewClear["php artisan view:clear (New)"]
    NewViewClear --> ConfigCache["php artisan config:cache"]
    ConfigCache --> NewRouteCache["php artisan route:cache (New)"]
    NewRouteCache --> NewViewCache["php artisan view:cache (New)"]
    NewViewCache --> Migrate["php artisan migrate --seed --force"]
    Migrate --> Apache["apache2-foreground"]
    Apache --> End["Service Running"]
Loading

File-Level Changes

Change Details Files
Enforce resource constraints on Docker Compose services
  • Add mem_limit and cpus settings to application, database, and node services
  • Set NODE_OPTIONS to limit Node’s memory footprint
  • Reorder and mount custom MySQL config for low-memory optimization
docker-compose.yaml
Introduce low-memory MySQL configuration
  • Add new mysql-lowmem.cnf file with custom settings
mysql-lowmem.cnf
Extend CI/CD workflows to include low-memory MySQL config
  • Add scp action to copy mysql-lowmem.cnf to EC2 in staging and production workflows
.github/workflows/stacksDockerDeployStaging.yaml
.github/workflows/stacksDockerDeployProduction.yaml
Improve Docker entrypoint script maintenance
  • Clear and rebuild Laravel config, route, and view caches before migration
  • Include cache clear commands alongside existing config cache step
amp-laravel/dockerShell.sh

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!

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

@Riyad-Murad Riyad-Murad merged commit 2410354 into main May 21, 2025
1 of 6 checks passed
Copy link

@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 @Riyad-Murad - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: 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.

source: "amp-client/dist"
target: "/home/${{ secrets.EC2_USER }}/"

- name: Copy Database Low Memory cofiguration file to EC2
Copy link

Choose a reason for hiding this comment

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

nitpick (typo): Fix typo in step name

Fix typo: change 'cofiguration' to 'configuration'.

Suggested change
- name: Copy Database Low Memory cofiguration file to EC2
- name: Copy Database Low Memory configuration file to EC2

source: "docker-compose.yaml"
target: "/home/${{ secrets.EC2_USER }}/"

- name: Copy Database Low Memory cofiguration file to EC2
Copy link

Choose a reason for hiding this comment

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

nitpick (typo): Fix typo in step name

Also correct 'cofiguration' to 'configuration' here.

Suggested change
- name: Copy Database Low Memory cofiguration file to EC2
- name: Copy Database Low Memory configuration file to EC2

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