Doc/systems#56
Merged
Merged
Conversation
…resource
Previously, each manager VM was defined as a separate, named Terraform
resource (manager1_prod, manager2_prod, etc.). Adding or removing a manager
required manually duplicating or deleting entire resource blocks and updating
the Ansible inventory, env file, null_resource depends_on, and triggers in
multiple places.
This change introduces a single manager_count variable in both the production
and staging configurations. A single digitalocean_droplet resource with
count = var.manager_count replaces the hardcoded resources. All downstream
resources (Ansible inventory, .env file, null_resource depends_on) now use
Terraform's splat expressions and template for-loops to dynamically adapt to
however many managers are configured.
Key changes:
- Added manager_count variable (default: 2) with a validation rule enforcing
an even number >= 2. This is required because db_prod/db_stage already acts
as the swarm leader (a manager), so total managers = manager_count + 1 must
be odd for Docker Swarm Raft quorum.
- Replaced manager1/manager2 droplet resources with a single
digitalocean_droplet.manager_{prod,stage} resource using count.
- Ansible inventory now uses a %{ for } template loop to emit one line per
manager, so it stays correct regardless of manager_count.
- .env file uses the same loop to emit MANAGER1_IP, MANAGER2_IP, ... entries
dynamically. Staging nip.io domain and URLs continue to use manager[0].
- Added triggers to null_resource.run_ansible_{prod,stage} so that Ansible
is re-run whenever a manager IP changes or a new manager is added. Previously
triggers were absent, meaning Ansible would only ever run on first apply.
- All depends_on references updated from the old per-resource names to the
new array-style reference (digitalocean_droplet.manager_{prod,stage}).
To scale managers: set manager_count = 4 (or any even number >= 2) in
terraform.tfvars or pass -var="manager_count=4" at apply time.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… into fix/traefik
|
Up to standards ✅🟢 Issues
|
Contributor
|
✅ Tests passed and image built! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



No description provided.