Skip to content

Commit 93c8b91

Browse files
authored
docs: update and consolidate documentation (#643)
* docs: update and consolidate documentation * docs(readme): fix formatting
1 parent fe55275 commit 93c8b91

File tree

9 files changed

+534
-1200
lines changed

9 files changed

+534
-1200
lines changed

README.md

Lines changed: 114 additions & 328 deletions
Large diffs are not rendered by default.

app.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@
1313
# The list of events the GitHub App subscribes to.
1414
# Uncomment the event names below to enable them.
1515
default_events:
16-
- custom_property_values
17-
- repository_ruleset
16+
- branch_protection_rule
1817
- check_run
1918
- check_suite
20-
- branch_protection_rule
19+
- create
20+
- custom_property_values
2121
- member
2222
- pull_request
2323
- push
2424
- repository
25+
- repository_ruleset
2526
- team
2627

2728

docs/deploy.md

Lines changed: 56 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Deployment
22

3+
## Deployment Environment Variables
4+
5+
To deploy the app anywhere, you will need 3 key environment variables:
6+
7+
- `APP_ID`: the ID of the app, which you can get from the [app settings page](https://github.com/settings/apps).
8+
9+
- `WEBHOOK_SECRET`: the **Webhook Secret** that you generated when you created the app.
10+
11+
And one of:
12+
13+
- `PRIVATE_KEY`: (preferred approach) the contents of the private key you downloaded after creating the app, and base64 encode it ...or
14+
- `PRIVATE_KEY_PATH`: the path to a private key file. This will require modification for different environments to make sure the file is available. E.g. For Docker: modify the Dockerfile to COPY the file into the container.
15+
16+
> [!NOTE]
17+
> `PRIVATE_KEY` takes precedence over `PRIVATE_KEY_PATH`.
18+
319
## Deploy the app
420

521
### Prepare the source code
@@ -9,13 +25,13 @@ Note: If running locally without Docker, ensure that Node 16.x or later is insta
925

1026
- Clone the codebase
1127
- `git clone https://github.com/github/safe-settings.git` or `git clone <this repo>`
12-
28+
1329
- Change directory to inside the code base
1430
- `cd safe-settings/`
15-
31+
1632
- Run `npm install` to build the code
1733

18-
- The easiest way to create the Github App is using the [manifest flow](https://docs.github.com/en/developers/apps/building-github-apps/creating-a-github-app-from-a-manifest#using-probot-to-implement-the-github-app-manifest-flow) . To set up the app in an org, provide the `GH_ORG` env variable in the .env file
34+
- The easiest way to create the Github App is using the [manifest flow](https://docs.github.com/en/developers/apps/building-github-apps/creating-a-github-app-from-a-manifest#using-probot-to-implement-the-github-app-manifest-flow). To set up the app in an org, provide the `GH_ORG` env variable in the .env file
1935

2036
- If using the `manifest` flow, create `.env` from `.env.example` and set the `GH_ORG` variable if installing the app in an org.
2137

@@ -26,32 +42,15 @@ Note: If running locally without Docker, ensure that Node 16.x or later is insta
2642
- If not using the `manifest flow` then follow the steps in [Create the GitHub App](#create-the-github-app)
2743

2844
- Create `.env` from `.env.example`
29-
30-
- `cp .env.example .env`
31-
32-
- Update the `.env` with the needed fields.
33-
34-
To deploy an app to any cloud provider, you will need 3 environment variables:
35-
36-
- `APP_ID`: the ID of the app, which you can get from the [app settings page](https://github.com/settings/apps).
3745

38-
- `WEBHOOK_SECRET`: the **Webhook Secret** that you generated when you created the app.
39-
40-
And one of:
41-
(You will need to copy the contents of the `.pem` created from **GitHub** . This will be used when the app is built and deployed.)
42-
- `PRIVATE_KEY`: (preferred approach) the contents of the private key you downloaded after creating the app, and base64 encode it ...or
43-
- `PRIVATE_KEY_PATH`: the path to a private key file. (Modify the Dockerfile to COPY the file if this is done)
46+
- `cp .env.example .env`
4447

45-
`PRIVATE_KEY` takes precedence over `PRIVATE_KEY_PATH`.
48+
- Update the `.env` with the fields outlined in the [Deployment Environment Variables](#deployment-environment-variables) section
4649

47-
Other Optional values in the .env are:
48-
- `LOG_LEVEL`: Control the logging level
49-
- `ADMIN_REPO`: default is `admin`
50-
- `SETTINGS_FILE_PATH`: default is `settings.yml`
51-
- `DEPLOYMENT_CONFIG_FILE`: default is `deployment-settings.yml`
50+
Optional values in the .env file can be found under the [Environment variables](../README.md#environment-variables) section. Additionally, you can set:
5251
- `NODE_TLS_REJECT_UNAUTHORIZED`: `0` for ignoring SSL validation and errors
5352
- `GHE_HOST`: This is a required field for **GitHub Enterprise Server** implementations (_Example: github.mycompany.com_)
54-
- `WEBHOOK_PROXY_URL`: SMEE Url for testing locally
53+
- `WEBHOOK_PROXY_URL`: SMEE Url for testing locally
5554

5655
Once you have the `.env` file configured, you are ready to start the building of the container.
5756

@@ -95,9 +94,9 @@ This will start the container in the background and detached.
9594

9695
### __Deploying using kubectl__
9796
- Create and push your image to a container registry
98-
- Create a `imagePullSecret`
99-
- For e.g.
100-
`kubectl create secret docker-registry regcred --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL`
97+
- Create a `imagePullSecret`
98+
- For e.g.
99+
`kubectl create secret docker-registry regcred --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL`
101100
- Create app secrets from the `.env` file
102101
`kubectl create secret generic app-env --from-env-file=.env`
103102
- Deploy the app
@@ -110,76 +109,64 @@ This will start the container in the background and detached.
110109

111110
[Helm](https://helm.sh/) must be installed to use the charts. Please refer to Helm's [documentation](https://helm.sh/docs/) to get started.
112111

113-
Once Helm is set up properly, add the Helm Repository as follows:
112+
Once Helm is set up properly, view the latest Helm chart version:
114113

115114
```bash
116-
$ helm repo add decyjphr https://decyjphr-org.github.io/charts/
115+
helm show chart oci://ghcr.io/github/helm-charts/safe-settings
117116
```
118117

119-
Once a Helm Repository is added, it can be updated as follows:
118+
__Configure required values__
120119

120+
See the values that can be configured.
121121
```bash
122-
$ helm repo update decyjphr
122+
helm show values oci://ghcr.io/github/helm-charts/safe-settings
123123
```
124124

125-
See the charts.
126-
```bash
127-
helm search repo safe-settings
128-
```
125+
Make sure to set the [Deployment Environment Variables](#deployment-environment-variables) in a `myvalues.yaml` file.
129126

130-
__Configure required values.__
127+
Optionally, you can set other values like LOG_LEVEL. See [Environment variables](../README.md#environment-variables) for more details.
131128

132-
See the values that can be configured.
133-
```bash
134-
helm show values decyjphr/safe-settings
135-
```
129+
You can also override the `deploymentConfig` value.
136130

137-
- APP_ID
138-
- PRIVATE_KEY
139-
- WEBHOOK_SECRET
131+
__Install the chart__
140132

141-
Optionally, you can set other values like LOG_LEVEL.
142-
143-
You can also override the `deploymentConfig` value.
144-
145-
__Install the chart__
146-
Set the values for APP_ID, PRIVATE_KEY, WEBHOOK_SECRET using `--values` (Preferred approach)
133+
Set the values using `--values` (preferred approach)
147134
```bash
148-
helm install safe-settings decyjphr/safe-settings --values myvalues.yaml
135+
helm install safe-settings oci://ghcr.io/github/helm-charts/safe-settings --values myvalues.yaml
149136
```
150137

151-
Set the with values for APP_ID, PRIVATE_KEY, WEBHOOK_SECRET using `--set`
138+
Set the with values using `--set`
152139

153140
```bash
154-
helm install safe-settings decyjphr/safe-settings --set appEnv.APP_ID="\"0000\"" --set appEnv.PRIVATE_KEY="TFM...==" --set appEnv.WEBHOOK_SECRET="ZjZlYTFjN...=="
141+
helm install safe-settings oci://ghcr.io/github/helm-charts/safe-settings --set appEnv.APP_ID="\"0000\"" --set appEnv.PRIVATE_KEY="TFM...==" --set appEnv.WEBHOOK_SECRET="ZjZlYTFjN...=="
155142
```
156143

157-
`NOTE:`Setting up Ingress controller is out of scope of this doc, but is recommended.
144+
> [!NOTE]
145+
> Setting up Ingress controller is out of scope of this doc, but is recommended.
158146
159147

160148
__If not doing an install using Helm. Generate Kubernetes YAMLs__
161149
```bash
162-
helm template safe-settings decyjphr/safe-settings --values myvalues.yaml
150+
helm template safe-settings oci://ghcr.io/github/helm-charts/safe-settings --values myvalues.yaml
163151
```
164152

165-
Chart documentation is available in [decyjphr charts repo](https://github.com/decyjphr-org/charts/).
166-
167153
*See [helm repo](https://helm.sh/docs/helm/helm_repo/) for command documentation.*
168154

169155
**Consider using a custom image**
170156

171-
For production use cases one should consider to build a custom safe-settings app image which conforms to your org standards.
157+
For production use cases one should consider to build a custom safe-settings app image which conforms to your org standards.
172158

173159
Follow the instructions [here](#build-the-docker-container) on how to do it.
174160

175161

176-
`NOTE:` If you want a reproducible build then you should specify a non floating tag for the image `yadhav/safe-settings:2.0.3` .
162+
> [!NOTE]
163+
> If you want a reproducible build then you should specify a non floating tag for the image `ghcr.io/github/safe-settings:2.1.10` .
177164
178165
Once you built the image and pushed it to your registry you can specify it in your `values` file like this:
179166

180167
```yaml
181168
image:
182-
repository: yadhav/safe-settings
169+
repository: custom-registry/safe-settings
183170
pullPolicy: IfNotPresent
184171
# Overrides the image tag whose default is the chart appVersion.
185172
tag: ""
@@ -254,7 +241,7 @@ Probot runs like [any other Node app](https://devcenter.heroku.com/articles/depl
254241
255242
Every deployment will need an [App](https://developer.github.com/apps/).
256243
257-
1. The easiest way to create the Github App is using the [manifest flow](https://docs.github.com/en/developers/apps/building-github-apps/creating-a-github-app-from-a-manifest#using-probot-to-implement-the-github-app-manifest-flow) . If you set up the app using the `manifest flow`, congrats, you are DONE!
244+
1. The easiest way to create the Github App is using the [manifest flow](https://docs.github.com/en/developers/apps/building-github-apps/creating-a-github-app-from-a-manifest#using-probot-to-implement-the-github-app-manifest-flow). If you set up the app using the `manifest flow`, congrats, you are DONE!
258245
2. [Create a new GitHub App](https://github.com/settings/apps/new) with:
259246
- **Homepage URL**: the URL to the GitHub repository for your app
260247
- **Webhook URL**: Use `https://example.com/` for now, we'll come back in a minute to update this with the URL of your deployed app.
@@ -272,28 +259,34 @@ Every deployment will need an [App](https://developer.github.com/apps/).
272259
- Checks: **Read & Write**
273260
- Commit statuses: **Read & Write**
274261
- Contents: **Read & Write**
262+
- Custom properties: **Read & Write**
275263
- Issues: **Read & Write**
264+
- Metadata: **Read-only**
276265
- Pull requests: **Read & Write**
277266
278267
#### Organization Permissions
279268
280-
- Members: **Read & Write**
281269
- Administration: **Read & Write**
270+
- Custom properties: **Admin**
271+
- Members: **Read & Write**
282272
283273
### Events
284274
285275
- Branch protection rule
286276
- Check run
287277
- Check suite
278+
- Create
279+
- Custom property values
288280
- Member
289-
- Push
290281
- Pull request
282+
- Push
291283
- Repository
284+
- Repository ruleset
292285
- Team
293286
294287
1. Download the private key from the app.
295288
296-
1. Make sure that you click the green **Install** button on the top left of the app page. This gives you an option of installing the app on all or a subset of your repositories. __**Important: Install this App for `All` repos in the Org**__
289+
2. Make sure that you click the green **Install** button on the top left of the app page. This gives you an option of installing the app on all or a subset of your repositories. __**Important: Install this App for `All` repos in the Org**__
297290
298291
299292

docs/sample-settings/org-ruleset.json

Lines changed: 0 additions & 115 deletions
This file was deleted.

0 commit comments

Comments
 (0)