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
Triagebot consists of a webserver with several endpoints.
13
+
The `/github-hook` and `/zulip-hook` endpoints receive webhook notifications from the respective services.
14
+
Triagebot can then respond to those notifications to perform various actions such as adjusting labels.
15
+
16
+
The Triagebot webserver also includes several other endpoints intended for users to access directly, such as https://triage.rust-lang.org/agenda.
17
+
18
+
Triagebot uses a Postgres database to retain some state.
19
+
In production, it uses [RDS](https://aws.amazon.com/rds/).
20
+
21
+
The server at https://triage.rust-lang.org/ runs on ECS and is configured via [Terraform](https://github.com/rust-lang/simpleinfra/blob/master/terraform/shared/services/triagebot/main.tf#L8).
22
+
Updates are automatically deployed when merged to master.
23
+
10
24
## Installation
11
25
12
26
To compile the Triagebot you need OpenSSL development library to be installed (e.g. for Ubuntu-like Linux distributions `sudo apt install libssl-dev`).
13
27
14
28
Run `cargo build` to compile the triagebot.
15
29
16
-
The `GITHUB_WEBHOOK_SECRET`, `GITHUB_API_TOKEN` and `DATABASE_URL` environment
17
-
variables need to be set.
30
+
## Running triagebot
31
+
32
+
It is possible to run triagebot yourself, and test changes against your own repository.
33
+
Some developers may settle with testing in production as the risks tend to be low, but the more intrepid may find it easier to iterate separately.
34
+
35
+
The general overview of what you will need to do:
36
+
37
+
1. Install Postgres. Look online for any help with installing and setting up Postgres (particularly if you need to create a user and set up permissions).
38
+
2. Create a database: `createdb triagebot`
39
+
3. Provide a way for GitHub to access the Triagebot webserver.
40
+
There are various ways to do this (such as placing it behind a proxy, or poking holes in your firewall).
41
+
Or, you can use a service such as https://ngrok.com/ to access on your local dev machine via localhost.
42
+
Installation is fairly simple, though requires setting up a (free) account.
43
+
Run the command `ngrok http 8000` to forward to port 8000 on localhost.
44
+
4. Create a GitHub repo to run some tests on.
45
+
5. Configure the webhook in your GitHub repo.
46
+
I recommend at least skimming the [GitHub webhook documentation](https://docs.github.com/en/developers/webhooks-and-events/webhooks/about-webhooks) if you are not familiar with webhooks. In short:
47
+
48
+
1. Go to the settings page.
49
+
2. Go to the webhook section.
50
+
3. Click "Add webhook"
51
+
4. Include the settings:
52
+
53
+
- Payload URL: This is the URL to your Triagebot server, for example http://7e9ea9dc.ngrok.io/github-hook. This URL is displayed when you ran the `ngrok` command above.
54
+
- Content type: application/json
55
+
- Secret: Enter a shared secret (some longish random text)
56
+
- Events: "Send me everything"
57
+
6. Configure the `.env` file:
18
58
19
-
If `GITHUB_API_TOKEN` is not set, the token can also be stored in `~/.gitconfig` in the
20
-
`github.oauth-token` setting.
59
+
1. Copy `.env.sample` to `.env`
60
+
2.`GITHUB_API_TOKEN`: This is a token needed for Triagebot to send requests to GitHub. Go to GitHub Settings > Developer Settings > Personal Access Token, and create a new token. The `repo` permission should be sufficient.
61
+
If this is not set, Triagebot will also look in `~/.gitconfig` in the `github.oauth-token` setting.
62
+
3.`DATABASE_URL`: This is the URL to the Postgres database. Something like `postgres://eric@localhost/triagebot` should work, replacing `eric` with your username.
63
+
4.`GITHUB_WEBHOOK_SECRET`: Enter the secret you entered in the webhook above.
64
+
5.`RUST_LOG`: Set this to `debug`.
21
65
22
-
To configure the GitHub webhook, point it to the `/github-hook` path of your
23
-
webserver (by default `http://localhost:8000`), configure the secret you chose
24
-
in `.env`, set the content type to `application/json` and select all events.
66
+
7. Run `cargo run --bin triagebot`. This starts the http server listening on port 8000.
67
+
8. Add a `triagebot.toml` file to the main branch of your GitHub repo with whichever services you want to try out.
68
+
9. Try interacting with your repo, such as issuing `@rustbot` commands or interacting with PRs and issues (depending on which services you enabled in `triagebot.toml`). Watch the logs from the server to see what's going on.
0 commit comments