Skip to content

Commit e4a1ffc

Browse files
committed
doc: Document k8s/tilt dev setup
1 parent 4ced087 commit e4a1ffc

1 file changed

Lines changed: 15 additions & 20 deletions

File tree

README.md

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,29 @@ This project name aged badly, trans rights are human rights!
1818
### Hedwig configuration:
1919

2020
Please reference `config.sample.yaml` for which settings can be set. The configuration file needs to be named `config.yaml`
21-
The `fcm_service_account_token_path` setting needs to point to an FCM service account token json file.
21+
The `fcm_service_account_token_path` setting needs to point to an FCM service account token json file.
2222
The `fcm_push_max_retries` setting specifies how many attempts at pushing a notification to a device should be made before giving up and reporting the push key as dead.
2323

2424
To output to stdout instead of files, remove the `file_output` section from the `config.yaml` file.
2525

26+
Hedwig can also be configured with environment variables, which is used for the local kubernetes development setup. All variables are namespaced under `PUSHGW`, with a double underscore (`__`) being the separator between the prefix and all keys. As an example, `server.bind_address` would be represented as `PUSHGW__SERVER__BIND_ADDRESS`. See `deploy/config.properties.sample` for an example configuration.
27+
28+
### Kubernetes
29+
30+
Hedwig can be easily deployed to a k8s cluster during development using the provided k8s manifests, `kustomize`, and `tilt`. If you have these tools installed, deploying a dev instance is as simple as running `tilt up`. Please see the `Tiltfile` for tilt configuration and the `deploy/` folder for manifests and the `kustomization.yaml`.
31+
32+
To run successfully, you will need a google API service account key for use with FCM. Place your key in the `deploy/` folder and name it `fcm-auth.json`. If you need to adjust the location or name of the key, please ensure your changes are reflected in the manifests and `kustomization.yaml`.
33+
2634
### On app side:
2735

28-
Example valid pusher set request (to homeserver, the homeserver will then talk to hedwig whenever there is a notification):
36+
Example valid pusher set request (to homeserver, the homeserver will then talk to hedwig whenever there is a notification):
2937
* `/_matrix/client/v3/pushers/set`:
30-
```json
38+
```json
3139
{
3240
"app_display_name": "Aweseome matrix client!",
3341

3442
// Deprecated: {APP_ID}.data_message is equivalent to setting data-message: "android" in data (keep app_id in hedwig config without the .data_message); This is due to removal, do not rely on it staying around!
35-
"app_id": "app.id.from.cfg",
43+
"app_id": "app.id.from.cfg",
3644
"append": false,
3745
"data": {
3846
"format": "event_id_only",
@@ -56,7 +64,7 @@ This will result in an FCM notification being sent to the device with the notifi
5664
"data":{
5765
"content":"null",
5866
"counts":"{\"unread\":1337,\"missed_calls\":null}",
59-
"devices":"[{\"app_id\":\"com.famedly.🦊\",\"pushkey\":\"Android\",\"pushkey_ts\":1655896032,\"data\":{\"data_message\":\"android\",\"format\":\"event_id_only\"},\"tweaks\":null}]",
67+
"devices":"[{\"app_id\":\"com.famedly.🦊\",\"pushkey\":\"Android\",\"pushkey_ts\":1655896032,\"data\":{\"data_message\":\"android\",\"format\":\"event_id_only\"},\"tweaks\":null}]",
6068
"prio":"\"high\"",
6169
"room_id":"owo"
6270
},
@@ -132,22 +140,9 @@ This will result in an FCM notification being sent to the device with the notifi
132140
}
133141
```
134142

143+
## Lints & Formatting
135144

136-
## Lints
137-
138-
We have plenty of lints in `lints.toml` that we use. Cargo currently does not natively support an extra file for lints, so we use `cargo-lints`. To check everything with our lints, run this locally:
139-
140-
```sh
141-
cargo lints clippy --workspace --all-targets
142-
```
143-
144-
and this in your IDE:
145-
146-
```sh
147-
cargo lints clippy --workspace --all-targets --message-format=json
148-
```
149-
150-
A few lints are commented out in `lints.toml`. This is because they should not be enabled by default, because e.g. they have false positives. However, they can be very useful sometimes.
145+
We enforce a set of strict lints across the project, these can be found in `Cargo.toml`. We additionally enforce formatting using rustfmt, see `rustfmt.toml` for information. Please see the #[Pre-commit usage section](#pre-commit-usage) for details on setting up pre-commit hooks to automate checks to ensure the lints and formatting pass prior to pushing.
151146

152147
## Pre-commit usage
153148

0 commit comments

Comments
 (0)