|
| 1 | +# Pgwatch RPC Sinks |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +## Intro |
| 6 | + |
| 7 | +A **community-maintained** collection of gRPC sink implementations for pgwatch. |
| 8 | + |
| 9 | +This provides sinks for common data solutions but makes no guarantees about their suitability for real production use. |
| 10 | + |
| 11 | +Our main purpose is to provide examples and building blocks that users can extend to integrate with pgwatch and develop their own production-ready gRPC servers. |
| 12 | + |
| 13 | +Check out <a href="https://github.com/cybertec-postgresql/pgwatch">PgWatch</a> to get started with this project. |
| 14 | + |
| 15 | +## Running Sinks |
| 16 | + |
| 17 | +If you are using pgwatch's gRPC client sink with |
| 18 | +authentication credentials or TLS configured, you'll |
| 19 | +need to set the following environment variables |
| 20 | +to ensure the server works properly. |
| 21 | + |
| 22 | +``` |
| 23 | +# if empty, password is ignored during authentication |
| 24 | +export PGWATCH_RPC_SERVER_USERNAME="username" |
| 25 | +
|
| 26 | +# if empty, username is ignored during authentication |
| 27 | +export PGWATCH_RPC_SERVER_PASSWORD="password" |
| 28 | +
|
| 29 | +# if not set, TLS is not used |
| 30 | +export PGWATCH_RPC_SERVER_CERT="/path/to/server.crt" |
| 31 | +
|
| 32 | +# if not set, TLS is not used |
| 33 | +export PGWATCH_RPC_SERVER_KEY="/path/to/server.key" |
| 34 | +``` |
| 35 | + |
| 36 | +To start any of the provided receivers, you can use: |
| 37 | +```bash |
| 38 | +# generate golang code from protobuf |
| 39 | +go generate ./sinks/pb |
| 40 | +go run ./cmd/[receiver_dir] [OPTIONS] |
| 41 | + |
| 42 | +# OR |
| 43 | + |
| 44 | +# generate python gRPC code from protobuf |
| 45 | +python3 -m grpc_tools.protoc -I sinks/pb --python_out=cmd/pyiceberg_receiver --grpc_python_out=cmd/pyiceberg_receiver sinks/pb/pgwatch.proto |
| 46 | +python3 ./cmd/[receiver_dir] [OPTIONS] |
| 47 | +``` |
| 48 | +By default, all sinks will listen at `0.0.0.0` with the specified port number. |
| 49 | + |
| 50 | +Now once your receiver is up, run pgwatch with the argument: |
| 51 | +`--sink=grpc://<sink_ip/hostname>:<sink-port> [OPTIONS]` |
| 52 | + |
| 53 | +Voila! You have seamless integration between pgwatch and your custom sink. |
| 54 | + |
| 55 | +## Developing Custom Sinks |
| 56 | + |
| 57 | +To get started with developing your own custom sinks, refer to this mini [tutorial](TUTORIAL.md). |
| 58 | + |
| 59 | +You can also look at our [example sinks](./cmd/) to help with your implementation or extend them for your own use cases. |
| 60 | + |
| 61 | +## Credits |
| 62 | + |
| 63 | +[Akshat Jaimini](https://github.com/destrex271) |
| 64 | +[Ahmed Gouda](https://github.com/0xgouda) |
0 commit comments