feat(perforce/p4-code-review): Migrate from ECS to EC2#852
feat(perforce/p4-code-review): Migrate from ECS to EC2#852gabebatista wants to merge 7 commits intomainfrom
Conversation
ac4448c to
a4511d0
Compare
📚 Documentation Preview✅ Preview deployed successfully! 🔗 Preview URL: https://aws-games.github.io/cloud-game-development-toolkit/preview-pr-852/ 🔒 Maintainer Action RequiredThe preview requires approval before it's accessible. A maintainer must approve the GitHub Pages deployment in the Environments section. Once approved, the preview will be accessible within 1-2 minutes. Build Information
This preview will be automatically deleted when the PR is merged or closed. |
a22cbad to
e4afb3e
Compare
84b8793 to
4766a91
Compare
4766a91 to
180cd6b
Compare
hwkiem
left a comment
There was a problem hiding this comment.
Plenty of comments and some minor changes requested or clarification needed. Also, can you change the name of the PR to conventional commit if the plan is to squash and merge? or is the plan to rebase and merge?
modules/perforce/modules/p4-code-review/user-data-native.sh.tpl
Outdated
Show resolved
Hide resolved
180cd6b to
759ea6e
Compare
759ea6e to
ebfb57c
Compare
|
|
Only other feedback - lets review the documentation. It built and deployed a preview to GH pages (see docs comment near the top of this PR). The architecture diagram is outdated. |
e8f2f69 to
533950c
Compare
0b3e700 to
7fe2360
Compare
|
❌ Terraform validation failed for View detailed logs: Workflow run |
|
❌ Terraform validation failed for View detailed logs: Workflow run |
|
❌ Terraform validation failed for View detailed logs: Workflow run |
345d288 to
2bd2966
Compare
Add Packer template and configuration scripts for building P4 Code Review (Helix Swarm) AMI on Ubuntu 24.04 LTS. Key components: - p4_code_review_x86.pkr.hcl: Packer template for x86_64 AMI - swarm_setup.sh: Initial Swarm package installation - swarm_configure.sh: Runtime configuration script for: - P4 server connection with SSL trust and authentication - Redis cache configuration - SSO/SAML setup - Queue worker configuration - Swarm extension Swarm-Secure setting
…caling Refactor P4 Code Review (Helix Swarm) deployment from ECS Fargate to native EC2 with Auto Scaling Group for improved performance and simpler operations. Key changes: - Replace ECS task definition with EC2 launch template - Add Auto Scaling Group (min=1, max=1) for automatic instance recovery - Add persistent EBS volume for Swarm data directory - Add user-data script for volume attachment and Swarm configuration - Update security groups for EC2-based deployment - Add ALB target group for health checks - Support for custom config.php injection via Secrets Manager
Update the create-resources-complete example to use the new EC2-based P4 Code Review module configuration, removing deprecated ECS-specific variables.
… compatibility Implement a dual super user approach to support Swarm extension installation while allowing custom super user configuration. Key changes: - Always create 'super' user first for Swarm extension compatibility - Create custom super user (if specified) and grant super privileges - Add 'unlimited_timeout' group for service integrations - Both users added to unlimited_timeout group to prevent ticket expiration - Update variables for super user configuration
… 24.04 Consolidate Swarm authentication to use the super user for both runtime operations (-u) and admin tasks (-U). This simplifies credential management and ensures compatibility with all authentication configurations (SSO, standard password, etc.). Changes: - Use super user for both configure-swarm.sh -u and -U parameters - Ensure super user is standard type (not service account) for p4 protects validation - Remove unused Swarm user credential variables from Terraform modules - Pin P4 Code Review AMI to Ubuntu 24.04 LTS (helix-swarm-optional requires ImageMagick 6) - Update README prerequisites to reflect simplified credential setup
Add wait_for_apt function that polls for the dpkg lock to be released before running apt-get commands. This fixes intermittent build failures caused by unattended-upgrades holding the lock after instance boot.
…ndition Wait for the previous instance to terminate before detaching the EBS volume. ASG launches new instances before terminating old ones, which can cause the new instance to fail when trying to attach the volume while the old instance is still running or shutting down. The script now waits up to 5 minutes for the old instance to reach terminated state before proceeding with force detach.
2bd2966 to
f7e5600
Compare
Issue number: N/A
Summary
Changes
This PR migrates the P4 Code Review (Helix Swarm) module from a containerized ECS/Fargate deployment to a native EC2 Auto Scaling Group deployment with persistent storage.
Key changes:
superuser for Swarm extension compatibility, plus optional custom super userunlimited_timeoutgroup for service accounts to prevent ticket expirationUser experience
In the existing implementation, when the p4cr container is restarted jobs and queue data is lost due to the lack of Swarm-compatible persistent storage. The new implementation uses EC2 in place of ECS/Fargate, allowing for EBS volumes to handle persistent storage for
/opt/perforce/swarm/data.Files Changed
assets/packer/perforce/p4-code-review/*assets/packer/perforce/p4-server/p4_configure.shmodules/perforce/modules/p4-code-review/*modules/perforce/sg.tfmodules/perforce/variables.tfmodules/perforce/examples/create-resources-complete/main.tfHow to Test
Prerequisites
Step 1: Build the P4 Code Review AMI
cd assets/packer/perforce/p4-code-review packer init p4_code_review_x86.pkr.hcl packer build p4_code_review_x86.pkr.hclNote the AMI ID from the output (e.g.,
ami-0abc123def456789).Step 2: Build the P4 Server AMI (if not already available)
cd assets/packer/perforce/p4-server packer init p4_al2023_x86.pkr.hcl packer build p4_al2023_x86.pkr.hclStep 3: Deploy the Infrastructure
Use the example configuration or create your own:
Step 4: Verify the Deployment
P4 Server: Connect using P4V or p4 CLI
P4 Code Review (Swarm):
https://review.perforce.example.comVerify Swarm Extension (via SSM on P4 Server):
Test Instance Recovery:
Expected Outcomes
curl https://review.example.com/api/v10/queue/workers)Swarm-Secure: falseChecklist
Is this a breaking change?
Yes, this is a breaking change.
Users currently running P4 Code Review using the ECS-based module will need to:
Migration guide and detailed documentation have been included in the module README.
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created might not be successful.