|
1 |
| -# starquery |
| 1 | +<h1> |
| 2 | + <img src="./icon.png" width="48px" style="margin-right: 12px;" align="center"> |
| 3 | + starquery |
| 4 | +</h1> |
2 | 5 |
|
3 |
| -An API that near-realtime tracks whether a user has starred a GitHub repository. |
| 6 | +[](https://coder.com/chat?utm_source=github.com/coder/vscode-coder&utm_medium=github&utm_campaign=readme.md) |
4 | 8 |
|
5 |
| -## Deployment |
6 |
| - |
7 |
| -The API is live at `starquery.coder.com`. A Cloudflare Tunnel is used for DDoS protection made with [this guide](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/get-started/create-local-tunnel/). The config is: |
| 9 | +Query in near-realtime if a user has starred a GitHub repository. |
8 | 10 |
|
9 |
| -```yaml |
10 |
| -# Located in /home/kyle/.cloudflared/config.yml |
11 |
| -url: http://localhost:8080 |
12 |
| -tunnel: 7e5e3b0d-4eb3-4aff-9924-e5f6efebcc2d |
13 |
| -credentials-file: /home/kyle/.cloudflared/7e5e3b0d-4eb3-4aff-9924-e5f6efebcc2d.json |
| 11 | +``` |
| 12 | +https://starquery.coder.com/coder/coder/user/kylecarbs |
14 | 13 | ```
|
15 | 14 |
|
16 |
| -`cloudflared` is ran in `screen -S cloudflared`: |
| 15 | +- Uses GitHub Webhooks for near-realtime accuracy. |
| 16 | +- Periodically refreshes all stargazers using GitHub's GraphQL API for accuracy. |
| 17 | +- Start tracking a repository by [adding it to the list](https://github.com/coder/starquery/blob/main/cmd/starquery/main.go#L52)! |
17 | 18 |
|
18 |
| -``` |
19 |
| -cloudflared tunnel run 7e5e3b0d-4eb3-4aff-9924-e5f6efebcc2d |
20 |
| -``` |
| 19 | +This service is used by [coder/coder](https://github.com/coder/coder) to prompt users to star the repository if they haven't already! |
| 20 | + |
| 21 | +## Deployment |
21 | 22 |
|
22 |
| -`/run/starquery/environ` must have `WEBHOOK_SECRET`, but here's a template: |
| 23 | +starquery is deployed on a tiny VM in Google Cloud. It is exposed via a Cloudflare Tunnel and accessible at: `starquery.coder.com`. |
| 24 | + |
| 25 | +The `./deploy.sh` script can be used to update the service (probably should be automated at some point). |
| 26 | + |
| 27 | +`/run/starquery/environ` must exist. Here is a template: |
23 | 28 |
|
24 | 29 | ```env
|
25 | 30 | REDIS_URL=127.0.0.1:6379
|
26 | 31 | BIND_ADDRESS=127.0.0.1:8080
|
27 | 32 | # use cdrci account
|
28 | 33 | GITHUB_TOKEN=
|
| 34 | +WEBHOOK_SECRET= |
| 35 | +``` |
| 36 | + |
| 37 | +### Cloudflare Tunnel |
| 38 | + |
| 39 | +See [the config file](./cloudflared.yaml). `cloudflared` is ran in `screen -S cloudflared`: |
| 40 | + |
| 41 | +```sh |
| 42 | +cloudflared tunnel run 7e5e3b0d-4eb3-4aff-9924-e5f6efebcc2d |
29 | 43 | ```
|
0 commit comments