Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Use Capistrano's HOSTFILTER feature instead of rolling our own. #10146

Merged
merged 1 commit into from Feb 14, 2020

Conversation

sengi
Copy link
Contributor

@sengi sengi commented Feb 14, 2020

It turns out that Capistrano 2's HOSTFILTER feature does exactly what we've been trying to implement ourselves in our TARGET_MACHINES change. Specifically, it deploy to just the machines specified in HOSTFILTER and ignores any tasks for roles which the machine doesn't have.

The motivation for this is to fix deployments of Whitehall to single nodes, which happens when an EC2 instance goes away and when we scale up. This has been broken since Sep 2019 (alphagov/govuk-app-deployment#325). My previous attempt, alphagov/govuk-app-deployment#358, didn't solve the problem because Cap fails when a task has no applicable machines (for example restart_backend has no applicable machines when deploying to a whitehall_frontend machine).

There is a caveat to this, which is that HOSTFILTER appears to have been removed in Capistrano 3 and replaced with a similar HOSTS feature, which sadly doesn't do what we need; it tries to run all tasks on the specified hosts regardless of whether the tasks apply to the role or not.

So if for any reason we want to upgrade to Capistrano 3, we'd need to find an alternative solution. I don't imagine that's very likely though, given that we've been on Cap 2 for so many years.

Tested in Integration by making the same change manually on the Jenkins job temporarily.

sengi added a commit to alphagov/govuk-app-deployment that referenced this pull request Feb 14, 2020
@sengi sengi merged commit f00aea7 into master Feb 14, 2020
@sengi sengi deleted the sengi/use-capistrano-hostfilter branch February 14, 2020 15:57
sengi added a commit that referenced this pull request Feb 14, 2020
Fixes bug introduced in #10146 which broke all-nodes deployments.
sengi added a commit that referenced this pull request Feb 14, 2020
Fixes bug introduced in #10146 which broke all-nodes deployments.
sengi added a commit that referenced this pull request Feb 14, 2020
Fixes bug introduced in #10146 which broke all-nodes deployments.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants