You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/deploy.md
+56-63Lines changed: 56 additions & 63 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,21 @@
1
1
# Deployment
2
2
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
+
3
19
## Deploy the app
4
20
5
21
### Prepare the source code
@@ -9,13 +25,13 @@ Note: If running locally without Docker, ensure that Node 16.x or later is insta
9
25
10
26
- Clone the codebase
11
27
-`git clone https://github.com/github/safe-settings.git` or `git clone <this repo>`
12
-
28
+
13
29
- Change directory to inside the code base
14
30
-`cd safe-settings/`
15
-
31
+
16
32
- Run `npm install` to build the code
17
33
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
19
35
20
36
- If using the `manifest` flow, create `.env` from `.env.example` and set the `GH_ORG` variable if installing the app in an org.
21
37
@@ -26,32 +42,15 @@ Note: If running locally without Docker, ensure that Node 16.x or later is insta
26
42
- If not using the `manifest flow` then follow the steps in [Create the GitHub App](#create-the-github-app)
27
43
28
44
- 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).
37
45
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`
44
47
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
46
49
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:
52
51
-`NODE_TLS_REJECT_UNAUTHORIZED`: `0` for ignoring SSL validation and errors
53
52
-`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
55
54
56
55
Once you have the `.env` file configured, you are ready to start the building of the container.
57
56
@@ -95,9 +94,9 @@ This will start the container in the background and detached.
95
94
96
95
### __Deploying using kubectl__
97
96
- Create and push your image to a container registry
Chart documentation is available in [decyjphr charts repo](https://github.com/decyjphr-org/charts/).
166
-
167
153
*See [helm repo](https://helm.sh/docs/helm/helm_repo/) for command documentation.*
168
154
169
155
**Consider using a custom image**
170
156
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.
172
158
173
159
Follow the instructions [here](#build-the-docker-container) on how to do it.
174
160
175
161
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` .
177
164
178
165
Once you built the image and pushed it to your registry you can specify it in your `values` file like this:
179
166
180
167
```yaml
181
168
image:
182
-
repository: yadhav/safe-settings
169
+
repository: custom-registry/safe-settings
183
170
pullPolicy: IfNotPresent
184
171
# Overrides the image tag whose default is the chart appVersion.
185
172
tag: ""
@@ -254,7 +241,7 @@ Probot runs like [any other Node app](https://devcenter.heroku.com/articles/depl
254
241
255
242
Every deployment will need an [App](https://developer.github.com/apps/).
256
243
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!
258
245
2. [Create a new GitHub App](https://github.com/settings/apps/new) with:
259
246
- **Homepage URL**: the URL to the GitHub repository for your app
260
247
- **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/).
272
259
- Checks: **Read & Write**
273
260
- Commit statuses: **Read & Write**
274
261
- Contents: **Read & Write**
262
+
- Custom properties: **Read & Write**
275
263
- Issues: **Read & Write**
264
+
- Metadata: **Read-only**
276
265
- Pull requests: **Read & Write**
277
266
278
267
#### Organization Permissions
279
268
280
-
- Members: **Read & Write**
281
269
- Administration: **Read & Write**
270
+
- Custom properties: **Admin**
271
+
- Members: **Read & Write**
282
272
283
273
### Events
284
274
285
275
- Branch protection rule
286
276
- Check run
287
277
- Check suite
278
+
- Create
279
+
- Custom property values
288
280
- Member
289
-
- Push
290
281
- Pull request
282
+
- Push
291
283
- Repository
284
+
- Repository ruleset
292
285
- Team
293
286
294
287
1. Download the private key from the app.
295
288
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**__
0 commit comments