Skip to content

Commit e0e20ea

Browse files
authored
Add additional endpoints for editing RFDs (#150)
* First pass on reservations * Content update fixes. CLI output for RFD reservation * Extend conenction timeout limit * Add index * More cli help messages * Add discuss and publish endpoints * Help text fixes * Fmt * License fix * Fix test context * Update example config files * Add local dev login for testing * Fmt * Add job immediately after performing updates * Example config and field fixes * Start on setup doc * Link endpoint * Extend timeout * Start display_name support for Google * Fix primary field * Use display names as opposed to caller ids in commit messages * More Google auth fixes * More sha typing * Filter out providers that do not have a display name * Update local dev feature * Fix Google redirect test
1 parent 1ee4173 commit e0e20ea

File tree

51 files changed

+3112
-301
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3112
-301
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,4 @@ jobs:
1515
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1
1616
with:
1717
command: build
18-
args: --release
19-
env:
20-
RUSTFLAGS: "--cfg tracing_unstable"
18+
args: --release --all-features

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ determining the RFD number to update. Instead they use the numeric portion of th
9595

9696
### Revisions
9797

98-
Every revision is tied to a commit* against an RFD readme file. There is no guarantee though that
98+
Every revision is tied to a commit* against a RFD readme file. There is no guarantee though that
9999
there exists a revision though for every commit. While the RFD API will attempt to create a revision
100100
for every commit, outages, missing webhooks, or internal errors can result in missing revisions.
101101
Currently the background periodic processor does not attempt to backfill missing revisions, it only
@@ -111,7 +111,7 @@ as a separate action. Currently the supported actions are:
111111

112112
| Action | Purpose |
113113
|------------------------|------------
114-
| copy_images_to_storage | Copies images and static files associated with an RFD to cloud storage
114+
| copy_images_to_storage | Copies images and static files associated with a RFD to cloud storage
115115
| create_pull_request | Create a PR for the RFD if it does not have one and the RFD is in discussion
116116
| ensure_default_state | Checks that RFDs on the default branch have appropriate states
117117
| ensure_pr_state | Updates the state attribute for RFDs not on the default branch as needed
@@ -123,16 +123,16 @@ as a separate action. Currently the supported actions are:
123123
### Content Updates
124124

125125
RFD processing manipulates both internally stored state as well as the source content document of
126-
the RFD it is processing. The two cases where the processor will update the contents of an RFD are:
126+
the RFD it is processing. The two cases where the processor will update the contents of a RFD are:
127127

128-
1. An RFD has an incorrect discussion url
129-
2. An RFD is in an incorrect state
128+
1. a RFD has an incorrect discussion url
129+
2. a RFD is in an incorrect state
130130

131131
The first update is the easier of the two. For any RFD that has an open discussion PR, the processor
132132
will check that the `discussion` attribute in the RFD document matches the url of the discussion PR.
133133
Note though that there is a bug here currently related to the order in which revisions may be processed.
134134

135-
State checking is a bit more complex. For an RFD that has an open discussion PR, the processor will
135+
State checking is a bit more complex. For a RFD that has an open discussion PR, the processor will
136136
ensure that the RFD state is set to `discussion`. For RFDs that are merged to the default branch
137137
though, there is not a good determination as to which of the final states to assign them. Instead
138138
the processor will emit a warning when it encounters such a case.

SETUP.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# rfd-api
2+
3+
Backend services and tools for processing and managing RFDs
4+
5+
## Setup
6+
7+
To start with there are few dependencies for running the RFD API. Notably the RFD API is broken up
8+
in to two applications, the `rfd-api` and the `rfd-processor`. See [README.md] for more information
9+
on the distinctions.
10+
11+
### Dependencies
12+
13+
General
14+
* Rust 1.77
15+
* Postgres 14
16+
17+
Processor
18+
* Asciidoctor 2.0.16
19+
* Node 20.11.0
20+
* NPM Packages:
21+
* Ruby 3.0.2
22+
* Ruby Gems:
23+
* asciidoctor-mermaid 0.4.1
24+
* asciidoctor-pdf 2.3.10
25+
* mmdc 10.6.1
26+
* rouge 4.2.0
27+
28+
Optional
29+
* Meilisearch (if search is to be supported)
30+
31+
### Build
32+
33+
Run `cargo build --release` to build all of the project binaries. Two binaries will be generated and
34+
emitted at:
35+
36+
* `target/release/rfd-api`
37+
* `target/release/rfd-processor`
38+
39+
### Installation
40+
41+
Once all of the dependencies have been installed, database migrations will need to be run to prepare
42+
the database tables. These can be run using the [`diesel` cli ](https://diesel.rs/guides/getting-started).
43+
44+
To run them:
45+
46+
```sh
47+
cd rfd-model
48+
DATABASE_URL=<database-url> diesel migration run
49+
```
50+
51+
Replace `<database-url>` with the url to the Postgres instance that the API and processor will be
52+
configured to run against.
53+
54+
### Configuration
55+
56+
Each part (the api and processor) has its own configuration file, and the respective application
57+
directories have example files called `config.example.toml`. Where possible the define either
58+
default values, or disabled options.
59+
60+
#### API
61+
62+
The two sections in the API configuration to pay attention to are the `[[keys]]` and `[[authn]]`
63+
configurations.
64+
65+
`[[keys]]` define the key pairs used to sign API keys and session tokens. Two sources are supported
66+
for keys, either local or GCP Cloud KMS. Placeholder configurations are provided for both sources as
67+
examples. During local development it is recommended to generate a new RSA key pair locally for use.
68+
69+
`[[authn]]` is a list of authentication providers that should be enabled. Google and GitHub are the
70+
only authentication providers supported currently and placeholders are available in the API example
71+
configuration.
72+
73+
For local development remote authentication can be bypassed by using the `local-dev` feature.
74+
Instead of using a remote authentication provider, the API can be run via:
75+
76+
```sh
77+
cargo run -p rfd-api --features local-dev
78+
```
79+
80+
This will run the API with a [`POST /login/local`](rfd-api/src/endpoints/login/local/mod.rs) endpoint
81+
exposed. This endpoint allows for logging in with an arbitrary email and user supplied unique
82+
identifier. To use this with the CLI, the `local-dev` feature will need to be passed to the CLI
83+
build.
84+
85+
```sh
86+
cargo run -p rfd-cli --features local-dev
87+
```
88+
89+
#### Processor
90+
91+
The processor has multiple jobs that are able to be run, and configuration is only required for
92+
jobs that are going to be run. The `actions` key defines the jobs that should be run. By default
93+
all jobs are disabled. In this this mode the processor will only construct a database of RFDs.

0 commit comments

Comments
 (0)