Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: FCM v1 #316

Merged
merged 26 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d700411
feat: FCM v1
chris13524 Apr 10, 2024
0caa7e2
chore: lots of boilerplate
chris13524 Apr 16, 2024
3fa1538
fix: bad match
chris13524 Apr 16, 2024
0484caf
fix: missing route
chris13524 Apr 16, 2024
fe90937
chore: rename test case
chris13524 Apr 16, 2024
eb78db0
fix: var.grafana_auth
chris13524 Apr 16, 2024
bef12c8
fix: nullability constraint
chris13524 Apr 16, 2024
b5f74d0
feat: use FCM v1 instead if configured
chris13524 Apr 16, 2024
ff4b6a9
fix: tests
chris13524 Apr 16, 2024
3fcc91f
chore: various fixes/improvements to use new version of fcm-rust
chris13524 Apr 18, 2024
37f019f
chore: update
chris13524 Apr 18, 2024
63df7de
Merge branch 'main' of https://github.com/WalletConnect/echo-server i…
chris13524 Apr 19, 2024
377e73d
fix: wrong variable
chris13524 Apr 22, 2024
81029d1
fix: remove removed fields
chris13524 Apr 22, 2024
7106639
chore: document secrets
chris13524 Apr 22, 2024
e1400cc
fix: compile errors
chris13524 Apr 23, 2024
52b4cf6
fix: provide valid JWTs to credentials tests
chris13524 Apr 23, 2024
4b12842
fix: error handling
chris13524 May 13, 2024
3f7a8c5
chore: remove patches
chris13524 May 13, 2024
96d2915
Merge branch 'main' of https://github.com/WalletConnect/echo-server i…
chris13524 May 13, 2024
c717e97
fix: fmt
chris13524 May 13, 2024
6a20d9d
fix: FCM v1 enabled_providers test
chris13524 May 14, 2024
ef99f83
fix: more enabled_providers tests
chris13524 May 14, 2024
c6a64d8
fix: secrets
chris13524 May 14, 2024
e0c138b
chore: comment, reorder
chris13524 May 14, 2024
310cc1c
chore: comment
chris13524 May 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ TELEMETRY_PROMETHEUS_PORT=3001

# FCM
FCM_API_KEY=
FCM_V1_CREDENTIALS=

# APNS
APNS_CERTIFICATE= # base64 encoded .p12 APNS Certificate
Expand Down
3 changes: 2 additions & 1 deletion .env.single-tenant-example
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ TELEMETRY_PROMETHEUS_PORT=3001

# FCM
FCM_API_KEY= # Firebase Cloud Messaging Server Key
FCM_V1_CREDENTIALS= # Firebase Cloud Messaging Service Account Credentials

# APNS
APNS_CERTIFICATE= # base64 encoded .p12 APNS Certificate
APNS_CERTIFICATE_PASSWORD= # Password for provided certificate
APNS_TOPIC= # bundle ID/app ID
APNS_TOPIC= # bundle ID/app ID
17 changes: 17 additions & 0 deletions .github/SECRETS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## `PROD_JWT_SECRET` & `STAGING_JWT_SECRET`

From 1Password: `cloud/push-server-jwt/prod` and `cloud/push-server-jwt/staging`

Generated randomly and used by Cloud app to sign JWTs.

## `ECHO_TEST_FCM_V1_CREDENTIALS`

From 1Password: `Firebase Push Server Tests Service Account`

FCM v1 service account credentials for test cases.

Setup:
- Go to the Push Server Tests Firebase project: https://console.firebase.google.com/project/push-server-tests-cc0f7/settings/cloudmessaging
- On Cloud Messaging tab, under the "Firebase Cloud Messaging API (V1)" header, click the "Manage Service Accounts" link
- Select the service account and click "Manage keys"
- Click "Add key" and select "Create new key" and pick JSON
4 changes: 2 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
id: tf-apply
uses: WalletConnect/actions/terraform/apply/@1.0.3
env:
GRAFANA_AUTH: ${{ steps.grafana-get-key.outputs.key }}
TF_VAR_grafana_auth: ${{ steps.grafana-get-key.outputs.key }}
Copy link
Member Author

@chris13524 chris13524 Apr 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoids this error in newer TF versions and matches other repos:

╷
│ Error: Missing required argument
│ 
│   with provider["registry.terraform.io/grafana/grafana"],
│   on provider.tf line 16, in provider "grafana":
│   16: provider "grafana" {
│ 
│ "auth": one of `auth,cloud_api_key,oncall_access_token,sm_access_token` must be specified
╵
╷
│ Error: Missing required argument
│ 
│   with provider["registry.terraform.io/grafana/grafana"],
│   on provider.tf line 17, in provider "grafana":
│   17:   url = "https://${var.grafana_endpoint}"
│ 
│ "url": all of `auth,url` must be specified
╵
error: Recipe `tf-validate` failed with exit code 1

TF_VAR_grafana_endpoint: ${{ steps.grafana-get-details.outputs.endpoint }}
TF_VAR_jwt_secret: ${{ secrets.STAGING_JWT_SECRET }}
TF_VAR_image_version: ${{ inputs.image_tag }}
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
id: tf-apply
uses: WalletConnect/actions/terraform/apply/@1.0.3
env:
GRAFANA_AUTH: ${{ steps.grafana-get-key.outputs.key }}
TF_VAR_grafana_auth: ${{ steps.grafana-get-key.outputs.key }}
TF_VAR_grafana_endpoint: ${{ steps.grafana-get-details.outputs.endpoint }}
TF_VAR_jwt_secret: ${{ secrets.PROD_JWT_SECRET }}
TF_VAR_image_version: ${{ inputs.image_tag }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
rustc: stable
- name: "Clippy all features"
cmd: clippy
args: --all-features --tests -- -D warnings
args: --all-features --all-targets -- -D warnings
cache: {}
rustc: stable
- name: "Formatting"
Expand All @@ -85,7 +85,7 @@ jobs:
rustc: nightly
- name: "Unit Tests"
cmd: test
args: --features multitenant,analytics,geoblock,functional_tests
args: --features multitenant,analytics,geoblock,functional_tests,apns_tests,fcm_tests,fcmv1_tests
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made into separate features to enable running tests locally without all of these test secrets.

cache: { sharedKey: "tests" }
rustc: stable
- name: "Single-tenant functional tests"
Expand Down Expand Up @@ -170,6 +170,7 @@ jobs:
args: ${{ matrix.cargo.args }}
env:
ECHO_TEST_FCM_KEY: ${{ secrets.ECHO_TEST_FCM_KEY }}
ECHO_TEST_FCM_V1_CREDENTIALS: ${{ secrets.ECHO_TEST_FCM_V1_CREDENTIALS }}
ECHO_TEST_APNS_P8_KEY_ID: ${{ secrets.ECHO_TEST_APNS_P8_KEY_ID }}
ECHO_TEST_APNS_P8_TEAM_ID: ${{ secrets.ECHO_TEST_APNS_P8_TEAM_ID }}
ECHO_TEST_APNS_P8_PEM: ${{ secrets.ECHO_TEST_APNS_P8_PEM }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
id: tf-plan-staging
uses: WalletConnect/actions/terraform/plan/@1.0.3
env:
GRAFANA_AUTH: ${{ steps.grafana-get-key.outputs.key }}
TF_VAR_grafana_auth: ${{ steps.grafana-get-key.outputs.key }}
TF_VAR_grafana_endpoint: ${{ steps.grafana-get-details.outputs.endpoint }}
TF_VAR_jwt_secret: ${{ secrets.JWT_SECRET }}
TF_VAR_relay_public_key: ${{ secrets.RELAY_PUBLIC_KEY }}
Expand Down
Loading
Loading