-
Notifications
You must be signed in to change notification settings - Fork 43
Add Patcher self-hosting documentation #2722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
devin-ai-integration
wants to merge
4
commits into
main
Choose a base branch
from
devin/DEV-1044-1756504061
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1d5e4e4
Add Patcher self-hosting documentation
devin-ai-integration[bot] aa9b539
Fix spellcheck errors by adding technical terms to custom dictionary
devin-ai-integration[bot] 0dec380
Fix typo: change 'leasat' to 'least' in account factory documentation
devin-ai-integration[bot] 3001fcd
Add specific repo-copier configuration for Patcher self-hosting
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,4 +54,9 @@ projectprefix | |
GOVCLOUD | ||
rollouts | ||
myvars | ||
myfile | ||
myfile | ||
gruntwork-io | ||
minamijoyo | ||
tfupdate | ||
hcledit | ||
self-hosting |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
# Self-hosting Patcher | ||
|
||
## Introduction to Patcher self-hosting | ||
|
||
Patcher runs in GitHub Actions or GitLab CI environments to automate dependency updates for your Terraform and Terragrunt infrastructure. While the Patcher service itself runs in CI/CD pipelines, you might want to self-host the Patcher and Terrapatch binaries rather than downloading them directly from github.com/gruntwork-io. | ||
|
||
You might want to self-host Patcher binaries because: | ||
|
||
- **Security requirements**: Your organization requires all external dependencies to be vetted and hosted internally | ||
- **Air-gapped environments**: Your infrastructure operates in environments without direct internet access | ||
- **Compliance policies**: Internal policies mandate that all tools must be sourced from approved internal repositories | ||
- **Network restrictions**: Corporate firewalls or proxy configurations prevent direct access to GitHub releases | ||
|
||
:::info | ||
|
||
Only the Patcher and Terrapatch binaries need to be self-hosted. The Patcher service itself continues to run within your existing CI/CD infrastructure (GitHub Actions or GitLab CI). | ||
|
||
::: | ||
|
||
## Self-hosting options | ||
|
||
### Repo-copier + GitHub Actions (Recommended) | ||
|
||
The primary recommended approach for self-hosting Patcher binaries is to use Gruntwork's [repo-copier](https://github.com/gruntwork-io/repo-copier) tool in combination with GitHub Actions or GitHub Enterprise. | ||
|
||
Repo-copier automatically copies all content from Gruntwork's private repositories—including releases and binary assets—to your internal version control system. This ensures that Patcher binaries are available in your environment while maintaining automatic updates. | ||
|
||
#### Required repositories for Patcher self-hosting | ||
|
||
You need to configure repo-copier to copy the following Patcher-related repositories: | ||
|
||
- [`gruntwork-io/patcher-cli`](https://github.com/gruntwork-io/patcher-cli) - The main Patcher binary | ||
- [`gruntwork-io/patcher-action`](https://github.com/gruntwork-io/patcher-action) - GitHub Action for running Patcher | ||
- [`gruntwork-io/terrapatch-cli`](https://github.com/gruntwork-io/terrapatch-cli) - Terrapatch binary for Terraform patching | ||
|
||
#### GitHub Actions permissions configuration | ||
|
||
After copying these repositories to your internal GitHub organization or GitHub Enterprise instance, you must configure GitHub Actions permissions for each repository to allow other repositories to access them. | ||
|
||
For each of the three repositories above, navigate to the repository's Actions settings: | ||
- Go to `https://your-github-instance.com/your-org/REPO_NAME/settings/actions` | ||
- Scroll down to the "Access" section | ||
- Select one of the following options (do **not** select "Not accessible"): | ||
- **"Accessible from repositories in the 'your-org' organization"** - Allows access from repositories within your organization | ||
- **"Accessible from repositories in the 'Your-Enterprise' enterprise"** - Allows access from repositories across your entire GitHub Enterprise | ||
|
||
This configuration ensures that your other repositories can use the self-hosted Patcher actions and download the necessary binaries during CI/CD workflows. | ||
|
||
For detailed repo-copier setup instructions, see the [IaC Library self-hosting guide](/2.0/docs/library/guides/self-hosting). | ||
|
||
**Supported with repo-copier:** | ||
- Your own GitHub.com organization | ||
- GitHub Enterprise Server | ||
- GitLab.com | ||
- BitBucket Server | ||
|
||
### Forking repositories (Alternative) | ||
|
||
You can manually fork the [patcher-cli](https://github.com/gruntwork-io/patcher-cli) and [terrapatch-cli](https://github.com/gruntwork-io/terrapatch-cli) repositories to your internal GitHub organization or GitHub Enterprise instance. | ||
|
||
However, manual forking has limitations: | ||
- Updates from Gruntwork do not propagate automatically | ||
- You must manually sync releases and binary assets | ||
- Cross-references may need manual updates | ||
|
||
### Alternative approaches | ||
|
||
For organizations with specific requirements, you can: | ||
|
||
1. **Download and host binaries manually**: Download releases from Gruntwork repositories and host them in your internal artifact storage | ||
2. **Build from source**: Clone the repositories and build binaries using your internal build systems | ||
3. **Mirror releases**: Set up automated mirroring of GitHub releases to your internal systems | ||
|
||
:::caution | ||
|
||
These alternative approaches require significant manual maintenance and may not receive automatic security updates. | ||
|
||
::: | ||
|
||
## GitHub Actions parameters for self-hosted binaries | ||
|
||
### Current limitations | ||
|
||
The current patcher-action implementation hardcodes the GitHub organization and repository names for binary downloads. The action downloads binaries from: | ||
|
||
- `gruntwork-io/patcher-cli` | ||
- `gruntwork-io/terrapatch-cli` | ||
- `minamijoyo/tfupdate` | ||
- `minamijoyo/hcledit` | ||
|
||
### Custom SCM parameters | ||
|
||
Currently, the patcher-action does not support custom SCM parameters for specifying alternative binary sources. The action would require modifications to support: | ||
|
||
- Custom GitHub organizations | ||
- Alternative GitHub Enterprise instances | ||
- Custom binary repository URLs | ||
|
||
### Authentication requirements | ||
|
||
When using GitHub Enterprise or custom GitHub organizations, ensure your GitHub Actions have appropriate authentication: | ||
|
||
```yaml | ||
- name: Run Patcher | ||
uses: gruntwork-io/patcher-action@v2 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
read_token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} # For accessing your internal repos | ||
update_token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} | ||
``` | ||
|
||
## Code examples | ||
|
||
### GitHub Enterprise configuration | ||
|
||
If you're using repo-copier with GitHub Enterprise, your workflow might look like this: | ||
|
||
```yaml | ||
name: Patcher Update | ||
on: | ||
schedule: | ||
- cron: '0 9 * * MON' # Run weekly on Mondays | ||
workflow_dispatch: | ||
|
||
jobs: | ||
patcher-update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_ENTERPRISE_TOKEN }} | ||
|
||
- name: Run Patcher Update | ||
uses: gruntwork-io/patcher-action@v2 | ||
with: | ||
patcher_command: update | ||
github_token: ${{ secrets.GITHUB_ENTERPRISE_TOKEN }} | ||
read_token: ${{ secrets.GITHUB_ENTERPRISE_TOKEN }} | ||
update_token: ${{ secrets.GITHUB_ENTERPRISE_TOKEN }} | ||
pull_request_branch: patcher-updates-${{ github.run_number }} | ||
pull_request_title: "[Patcher] Update dependencies" | ||
working_dir: "infrastructure-live/dev" | ||
``` | ||
|
||
### GitLab CI support | ||
|
||
Patcher supports GitLab CI environments, but this integration is newer and may require additional configuration. | ||
|
||
:::info | ||
|
||
For GitLab CI setup and configuration, please contact our support team at [[email protected]](mailto:[email protected]) for the latest guidance and best practices. | ||
|
||
::: | ||
|
||
## Unsupported methods and limitations | ||
|
||
### Artifactory status | ||
|
||
Artifactory and similar artifact management tools are **not currently supported** for hosting Patcher binaries. These tools lack the metadata and release management features that Patcher relies on, such as: | ||
|
||
- GitHub release tags and versioning | ||
- Release assets and checksums | ||
- API compatibility for automated downloads | ||
|
||
### Version management considerations | ||
|
||
When self-hosting Patcher binaries: | ||
|
||
- **Pin specific versions**: Use the `patcher_version` parameter to ensure consistent behavior across environments | ||
- **Test updates**: Validate new Patcher versions in development environments before promoting to production | ||
- **Monitor compatibility**: Ensure your self-hosted binaries remain compatible with your Terraform and Terragrunt versions | ||
|
||
```yaml | ||
- name: Run Patcher with pinned version | ||
uses: gruntwork-io/patcher-action@v2 | ||
with: | ||
patcher_version: "v0.15.1" # Pin to specific version | ||
# ... other parameters | ||
``` | ||
|
||
### Current action limitations | ||
|
||
The patcher-action currently requires modifications to support fully custom binary sources. If you need this functionality, please contact [[email protected]](mailto:[email protected]) to discuss your requirements and potential solutions. |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.