Skip to content

Commit 3cd4760

Browse files
devin-ai-integration[bot]josh-padnickyhakbar
authored
Add Patcher self-hosting documentation (#2722)
* Add Patcher self-hosting documentation - Create comprehensive self-hosting guide at docs/2.0/docs/patcher/guides/self-hosting.md - Document repo-copier as primary recommended approach for self-hosting binaries - Explain current patcher-action limitations with hardcoded GitHub organizations - Include GitHub Enterprise and GitLab CI configuration examples - Add link to self-hosting guide in installation documentation - Update sidebar navigation to include new self-hosting guide Addresses DEV-1044 Co-Authored-By: Josh Padnick <[email protected]> * Fix spellcheck errors by adding technical terms to custom dictionary - Add gruntwork-io, minamijoyo, tfupdate, hcledit, self-hosting to custom-dictionary.txt - These are legitimate technical terms used in the Patcher self-hosting documentation - Resolves CircleCI validate_build spellcheck failure Co-Authored-By: Josh Padnick <[email protected]> * Fix typo: change 'leasat' to 'least' in account factory documentation This resolves the spellcheck error causing the validate_build CI failure. Co-Authored-By: Josh Padnick <[email protected]> * Add specific repo-copier configuration for Patcher self-hosting - Add required repositories: patcher-cli, patcher-action, terrapatch-cli - Include GitHub Actions permissions configuration instructions - Specify access settings for organization and enterprise levels - Provide actionable steps for users to configure repo-copier properly Co-Authored-By: Josh Padnick <[email protected]> * Update docs/2.0/docs/patcher/guides/self-hosting.md Co-authored-by: Yousif Akbar <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Josh Padnick <[email protected]> Co-authored-by: Yousif Akbar <[email protected]>
1 parent ca8b7e6 commit 3cd4760

File tree

4 files changed

+199
-1
lines changed

4 files changed

+199
-1
lines changed

custom-dictionary.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,9 @@ projectprefix
5454
GOVCLOUD
5555
rollouts
5656
myvars
57-
myfile
57+
myfile
58+
gruntwork-io
59+
minamijoyo
60+
tfupdate
61+
hcledit
62+
self-hosting
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# Self-hosting Patcher
2+
3+
## Introduction to Patcher self-hosting
4+
5+
Patcher runs in GitHub Actions or GitLab CI environments to automate dependency updates for your OpenTofu/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.
6+
7+
You might want to self-host Patcher binaries because:
8+
9+
- **Security requirements**: Your organization requires all external dependencies to be vetted and hosted internally
10+
- **Air-gapped environments**: Your infrastructure operates in environments without direct internet access
11+
- **Compliance policies**: Internal policies mandate that all tools must be sourced from approved internal repositories
12+
- **Network restrictions**: Corporate firewalls or proxy configurations prevent direct access to GitHub releases
13+
14+
:::info
15+
16+
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).
17+
18+
:::
19+
20+
## Self-hosting options
21+
22+
### Repo-copier + GitHub Actions (Recommended)
23+
24+
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.
25+
26+
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.
27+
28+
#### Required repositories for Patcher self-hosting
29+
30+
You need to configure repo-copier to copy the following Patcher-related repositories:
31+
32+
- [`gruntwork-io/patcher-cli`](https://github.com/gruntwork-io/patcher-cli) - The main Patcher binary
33+
- [`gruntwork-io/patcher-action`](https://github.com/gruntwork-io/patcher-action) - GitHub Action for running Patcher
34+
- [`gruntwork-io/terrapatch-cli`](https://github.com/gruntwork-io/terrapatch-cli) - Terrapatch binary for Terraform patching
35+
36+
#### GitHub Actions permissions configuration
37+
38+
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.
39+
40+
For each of the three repositories above, navigate to the repository's Actions settings:
41+
- Go to `https://your-github-instance.com/your-org/REPO_NAME/settings/actions`
42+
- Scroll down to the "Access" section
43+
- Select one of the following options (do **not** select "Not accessible"):
44+
- **"Accessible from repositories in the 'your-org' organization"** - Allows access from repositories within your organization
45+
- **"Accessible from repositories in the 'Your-Enterprise' enterprise"** - Allows access from repositories across your entire GitHub Enterprise
46+
47+
This configuration ensures that your other repositories can use the self-hosted Patcher actions and download the necessary binaries during CI/CD workflows.
48+
49+
For detailed repo-copier setup instructions, see the [IaC Library self-hosting guide](/2.0/docs/library/guides/self-hosting).
50+
51+
**Supported with repo-copier:**
52+
- Your own GitHub.com organization
53+
- GitHub Enterprise Server
54+
- GitLab.com
55+
- BitBucket Server
56+
57+
### Forking repositories (Alternative)
58+
59+
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.
60+
61+
However, manual forking has limitations:
62+
- Updates from Gruntwork do not propagate automatically
63+
- You must manually sync releases and binary assets
64+
- Cross-references may need manual updates
65+
66+
### Alternative approaches
67+
68+
For organizations with specific requirements, you can:
69+
70+
1. **Download and host binaries manually**: Download releases from Gruntwork repositories and host them in your internal artifact storage
71+
2. **Build from source**: Clone the repositories and build binaries using your internal build systems
72+
3. **Mirror releases**: Set up automated mirroring of GitHub releases to your internal systems
73+
74+
:::caution
75+
76+
These alternative approaches require significant manual maintenance and may not receive automatic security updates.
77+
78+
:::
79+
80+
## GitHub Actions parameters for self-hosted binaries
81+
82+
### Current limitations
83+
84+
The current patcher-action implementation hardcodes the GitHub organization and repository names for binary downloads. The action downloads binaries from:
85+
86+
- `gruntwork-io/patcher-cli`
87+
- `gruntwork-io/terrapatch-cli`
88+
- `minamijoyo/tfupdate`
89+
- `minamijoyo/hcledit`
90+
91+
### Custom SCM parameters
92+
93+
Currently, the patcher-action does not support custom SCM parameters for specifying alternative binary sources. The action would require modifications to support:
94+
95+
- Custom GitHub organizations
96+
- Alternative GitHub Enterprise instances
97+
- Custom binary repository URLs
98+
99+
### Authentication requirements
100+
101+
When using GitHub Enterprise or custom GitHub organizations, ensure your GitHub Actions have appropriate authentication:
102+
103+
```yaml
104+
- name: Run Patcher
105+
uses: gruntwork-io/patcher-action@v2
106+
with:
107+
github_token: ${{ secrets.GITHUB_TOKEN }}
108+
read_token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} # For accessing your internal repos
109+
update_token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
110+
```
111+
112+
## Code examples
113+
114+
### GitHub Enterprise configuration
115+
116+
If you're using repo-copier with GitHub Enterprise, your workflow might look like this:
117+
118+
```yaml
119+
name: Patcher Update
120+
on:
121+
schedule:
122+
- cron: '0 9 * * MON' # Run weekly on Mondays
123+
workflow_dispatch:
124+
125+
jobs:
126+
patcher-update:
127+
runs-on: ubuntu-latest
128+
steps:
129+
- name: Checkout
130+
uses: actions/checkout@v4
131+
with:
132+
token: ${{ secrets.GITHUB_ENTERPRISE_TOKEN }}
133+
134+
- name: Run Patcher Update
135+
uses: gruntwork-io/patcher-action@v2
136+
with:
137+
patcher_command: update
138+
github_token: ${{ secrets.GITHUB_ENTERPRISE_TOKEN }}
139+
read_token: ${{ secrets.GITHUB_ENTERPRISE_TOKEN }}
140+
update_token: ${{ secrets.GITHUB_ENTERPRISE_TOKEN }}
141+
pull_request_branch: patcher-updates-${{ github.run_number }}
142+
pull_request_title: "[Patcher] Update dependencies"
143+
working_dir: "infrastructure-live/dev"
144+
```
145+
146+
### GitLab CI support
147+
148+
Patcher supports GitLab CI environments, but this integration is newer and may require additional configuration.
149+
150+
:::info
151+
152+
For GitLab CI setup and configuration, please contact our support team at [[email protected]](mailto:[email protected]) for the latest guidance and best practices.
153+
154+
:::
155+
156+
## Unsupported methods and limitations
157+
158+
### Artifactory status
159+
160+
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:
161+
162+
- GitHub release tags and versioning
163+
- Release assets and checksums
164+
- API compatibility for automated downloads
165+
166+
### Version management considerations
167+
168+
When self-hosting Patcher binaries:
169+
170+
- **Pin specific versions**: Use the `patcher_version` parameter to ensure consistent behavior across environments
171+
- **Test updates**: Validate new Patcher versions in development environments before promoting to production
172+
- **Monitor compatibility**: Ensure your self-hosted binaries remain compatible with your Terraform and Terragrunt versions
173+
174+
```yaml
175+
- name: Run Patcher with pinned version
176+
uses: gruntwork-io/patcher-action@v2
177+
with:
178+
patcher_version: "v0.15.1" # Pin to specific version
179+
# ... other parameters
180+
```
181+
182+
### Current action limitations
183+
184+
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.

docs/2.0/docs/patcher/installation/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ $ echo $PATH
2121
$ mv patcher /usr/local/bin
2222
```
2323

24+
## Self-hosting Patcher
25+
26+
If your organization requires hosting Patcher binaries internally rather than downloading them directly from GitHub, see our [self-hosting guide](/2.0/docs/patcher/guides/self-hosting) for detailed instructions on using repo-copier and other self-hosting approaches.
27+
2428
## Before running Patcher
2529

2630
### GitHub Personal Access Token

sidebars/docs.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,11 @@ const sidebar = [
591591
type: "doc",
592592
id: "2.0/docs/patcher/guides/upgrade",
593593
},
594+
{
595+
label: "Self-hosting Patcher",
596+
type: "doc",
597+
id: "2.0/docs/patcher/guides/self-hosting",
598+
},
594599
{
595600
label: "Disable Telemetry",
596601
type: "doc",

0 commit comments

Comments
 (0)