Skip to content

Commit e567257

Browse files
committed
fixups for bridge readme, CI, etc
Mostly this just is last touches prior to merging back to main. - Fleshing out some of the readme to be more aligned with the rest of the repo. - CI workflow updates for how they need to be IRL. - adds a LICENSE
1 parent 826bfa6 commit e567257

File tree

10 files changed

+251
-29
lines changed

10 files changed

+251
-29
lines changed

.github/workflows/bridge-release.yml

+58-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,61 @@
1-
name: Webhook Bridge Release
1+
name: Bridge Release
22

33
on:
4-
push:
5-
branches:
6-
- onelson/bridge
4+
release:
5+
types: [published]
76

87
jobs:
8+
release:
9+
name: release ${{ matrix.target }}
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
include:
15+
- target: x86_64-pc-windows-gnu
16+
os: windows-latest
17+
extension: ".exe"
18+
19+
- target: x86_64-unknown-linux-gnu
20+
os: ubuntu-latest
21+
extension: ""
22+
23+
- target: x86_64-apple-darwin
24+
os: macos-latest
25+
extension: ""
26+
27+
- target: aarch64-apple-darwin
28+
os: macos-latest
29+
extension: ""
30+
steps:
31+
- uses: actions/checkout@master
32+
33+
- name: Install Rust toolchain
34+
uses: actions-rs/toolchain@v1
35+
with:
36+
toolchain: stable
37+
override: true
38+
profile: minimal
39+
target: ${{ matrix.target }}
40+
41+
- name: Install musl for x86_64-unknown-linux-musl
42+
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
43+
run: sudo apt-get install -y musl-dev musl-tools
44+
45+
- name: Compile bridge
46+
uses: actions-rs/cargo@v1
47+
with:
48+
command: build
49+
args: --target ${{ matrix.target }} --release --manifest-path bridge/svix-bridge/Cargo.toml
50+
51+
- name: Release
52+
uses: actions/upload-artifact@v3
53+
with:
54+
name: svix-bridge-${{ matrix.target }}
55+
path: bridge/target/${{ matrix.target }}/release/svix-bridge${{ matrix.extension }}
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
959
docker:
1060
name: release docker
1161
runs-on: ubuntu-latest
@@ -25,16 +75,15 @@ jobs:
2575
uses: docker/setup-buildx-action@v2
2676

2777
- name: Derive Version Numbers
28-
# FIXME: don't have a release name when running on a branch push - hardcode to 0.0.0 for now
2978
run: |
30-
export REPO="${{ secrets.DOCKERHUB_USERNAME }}/svix-webhook-bridge"
31-
echo DOCKER_TAGS="$(echo "v0.0.0" | sed -E "s#v([0-9]+)\.([0-9]+)\.([0-9]+)#${REPO}:latest,${REPO}:v\1.\2.\3,${REPO}:v\1.\2,${REPO}:v\1#")" >> "$GITHUB_ENV"
79+
export REPO="${{ secrets.DOCKERHUB_USERNAME }}/svix-bridge"
80+
echo DOCKER_TAGS="$(echo "${{ github.event.release.tag_name }}" | sed -E "s#v([0-9]+)\.([0-9]+)\.([0-9]+)#${REPO}:latest,${REPO}:v\1.\2.\3,${REPO}:v\1.\2,${REPO}:v\1#")" >> "$GITHUB_ENV"
3281
3382
- name: Build and push Docker image
3483
uses: docker/build-push-action@v2
3584
with:
36-
context: ./webhook-bridge
37-
file: ./webhook-bridge/Dockerfile
85+
context: ./bridge
86+
file: ./bridge/Dockerfile
3887
push: true
3988
tags: ${{ env.DOCKER_TAGS }}
4089
platforms: linux/amd64

.github/workflows/bridge-security.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Bridge Security
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'bridge/**/Cargo.toml'
9+
- 'bridge/**/Cargo.lock'
10+
- '.github/workflows/bridge-security.yml'
11+
pull_request:
12+
paths:
13+
- 'bridge/**/Cargo.toml'
14+
- 'bridge/**/Cargo.lock'
15+
- '.github/workflows/bridge-security.yml'
16+
17+
jobs:
18+
security_audit:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
- uses: EmbarkStudios/cargo-deny-action@v1
23+
with:
24+
arguments: --manifest-path=bridge/Cargo.toml

bridge/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ RUN apt-get update ;\
6666
USER appuser
6767

6868
COPY --from=build /app/target/release/svix-bridge /usr/local/bin/svix-bridge
69+
EXPOSE 5000
6970

7071
# Will fail if there's no `svix-bridge.yaml` in the CWD or `SVIX_BRIDGE_CFG` is not set to a valid
7172
# path to a config.

bridge/LICENSE

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2021-2023 Svix Inc.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

bridge/README.md

+67-19
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,32 @@
1-
# Svix Bridge
1+
<h1 align="center">
2+
<a href="https://www.svix.com">
3+
<img width="120" src="https://avatars.githubusercontent.com/u/80175132?s=200&v=4" />
4+
<p align="center">Svix - Webhooks as a service</p>
5+
</a>
6+
</h1>
27

3-
`svix-bridge` is organized in terms of **senders** and **receivers**.
8+
![GitHub tag](https://img.shields.io/github/tag/svix/svix-webhooks.svg)
9+
[![Build Status](https://github.com/svix/svix-webhooks/workflows/Bridge%20CI/badge.svg)](https://github.com/svix/svix-webhooks/actions)
10+
[![Bridge Security](https://github.com/svix/svix-webhooks/actions/workflows/bridge-security.yml/badge.svg)](https://github.com/svix/svix-webhooks/actions/workflows/bridge-security.yml)
11+
[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
12+
[![Join our slack](https://img.shields.io/badge/Slack-join%20the%20community-blue?logo=slack&style=social)](https://www.svix.com/slack/)
13+
14+
# Svix Bridge (beta)
15+
16+
Bridge is an agent to help integrate webhooks into your existing messaging infrastructure.
17+
18+
Bridge is organized in terms of **senders** and **receivers**.
419

520
**Senders** are useful when you have a data source (an "input") such as a
621
message queue and want to generate Svix webhooks from those messages.
722

823
**Receivers** act as HTTP endpoints which wait for Svix webhooks to arrive, then
924
publish the payload on to a specified "output."
1025

26+
**Receivers** also (optionally) perform validation of the webhooks using Svix's signature verification.
27+
28+
Both **senders** and **receivers** are defined in terms of their input, and optional JavaScript transformation, and their output.
29+
1130
Currently the supported Sender inputs and Receiver outputs are the following
1231
messaging systems:
1332

@@ -16,13 +35,28 @@ messaging systems:
1635
- Redis
1736
- SQS
1837

19-
## Usage
38+
> Important to note that queues, exchanges, topics, etc should be created and configured independently,
39+
> prior to using launching Bridge. Bridge will not automatically attempt to create these resources, it will only try
40+
> (and fail) to read from or publish to the stream/queue in this case.
41+
42+
43+
## Installation
44+
45+
Docker images are available on [docker hub](https://registry.hub.docker.com/r/svix/svix-bridge)
2046

2147
```
22-
svix-bridge -c path/to/svix-bridge.yaml
48+
$ docker pull svix/svix-bridge
2349
```
2450

25-
## Configuration
51+
If you don't want to use docker, see [Building from Source](../README.md#building-from-source).
52+
53+
54+
55+
# Usage and Configuration
56+
57+
```
58+
$ svix-bridge -c path/to/svix-bridge.yaml
59+
```
2660

2761
The CLI itself exposes only a single flag (`-c`, `--cfg`) used to set the path for the config file.
2862
The location of the config file can also be set with the `SVIX_BRIDGE_CFG` env var.
@@ -34,7 +68,6 @@ Each sender and receiver can optionally specify a `transformation`.
3468
Transformations should define a function called `handler` that accepts an object and returns an object.
3569

3670
Senders should produce JSON following an expected shape:
37-
3871
```
3972
{
4073
// This indicates which Svix application to send the message to
@@ -52,21 +85,36 @@ Senders should produce JSON following an expected shape:
5285
> The comments in the above JSON are for illustrative purposes only ;)
5386
> That's not valid JSON! Sorry!
5487
55-
5688
For detail on the `message` field, see: <https://api.svix.com/docs#tag/Message/operation/v1.message.create>
5789

58-
Important to note that queues, exchanges, topics, or what have you, should be created and configured independently,
59-
prior to using the plugin. There's nothing in place to automatically create these resources.
60-
The plugin will only try (and fail) to read from the stream in such a case.
90+
See the example configs for how to configure each input and output in more detail:
91+
- [senders](./svix-bridge.example.senders.yaml)
92+
- [receivers](./svix-bridge.example.receivers.yaml)
6193

62-
- GCP Pub/Sub
63-
- RabbitMQ
64-
- Redis
65-
- SQS
94+
# Building from source
6695

67-
The HTTP server also (optionally) performs validation of the webhooks using Svix's signature verification method.
96+
You would need a working Rust compiler in order to build Svix Bridge.
97+
The easiest way is to use [rustup](https://rustup.rs/).
6898

69-
The `verification` section for each route can be set one of two ways:
70-
* `none` which accepts and forwards any JSON POST HTTP request.
71-
* `svix` that takes a Svix endpoint secret (starting with `whsec_`) and
72-
validating it using an official Svix library
99+
```
100+
# Clone the repository
101+
git clone https://github.com/svix/svix-webhooks
102+
# Change to the source directory
103+
cd svix-webhooks/bridge/
104+
# Build
105+
cargo install --path svix-bridge
106+
```
107+
108+
Some system dependencies are required for Bridge to build successfully.
109+
Consult the [Dockerfile](./Dockerfile) for a good reference of what's required at build time.
110+
111+
# Building with Docker
112+
113+
```
114+
# Clone the repository
115+
git clone https://github.com/svix/svix-webhooks
116+
# Change to the source directory
117+
cd svix-webhooks/bridge/
118+
# Build
119+
docker build --tag svix-bridge:local .
120+
```

bridge/generic-queue/LICENSE

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2021-2023 Svix Inc.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2021-2023 Svix Inc.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

bridge/svix-bridge-types/LICENSE

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2021-2023 Svix Inc.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

bridge/svix-bridge.example.receivers.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@ receivers:
107107
# - `AWS_ACCESS_KEY_ID`
108108
# - `AWS_SECRET_ACCESS_KEY`
109109
type: "sqs"
110-
queue_dsn: "https://example.aws.com/my-queue"
110+
queue_dsn: "https://aws.example.com/my-queue"

bridge/svix-bridge/LICENSE

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2021-2023 Svix Inc.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)