Small project to build sign system with Rust and confluence platform
- each
signer-rest-api
pod will sendMsgToSign
to single topicsigner.v1
- each
signer-rest-api
pod will have separate response topicsigner.v1.resp<N>
and each instance will be the onlygroup.id
member - each
signer-service
will be produce response toresp_topic
topic that is know from request header - number of
signer-service
should be less or equal tosigner.v1
topic partitions to benefit from horizontal scaling
-
Run confluence platform for this example I used quickstart-deploy example as base. Here are commands that allowed me to run this on Linux machine. (This may require installion of additional software).
Prepare (in
signer-flow
working dictionary)minikube start --driver=kvm2 --memory 6144 --cpus 6 # here you need to wait a few secs kubectl create namespace confluent kubectl config set-context --current --namespace=confluent helm repo add confluentinc https://packages.confluent.io/helm helm upgrade --install operator confluentinc/confluent-for-kubernetes
-
Run confluent platform:
kubectl apply -f k8s/confluent-platform-singlenode.yaml
-
Run signer flow:
kubectl apply -f k8s/singer-flow.yaml
The value returned by commands below will probably be different in your case
-
Get current node ip:
minikube ip
In my case it was
192.168.39.211
-
Find
singer-rest-api
port:kubectl get services signer-rest-api
The port will be generated so output will be different. In my case the port is
32718
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE signer-rest-api NodePort 10.105.210.60 <none> 80:32718/TCP 36m
-
Get access in browser:
http://192.168.39.211:32718/sign
- to test - input some text to sign and press submit button. The app use base64 encoder to sign messages.
- the output will returned with
ok: <signed_msg>
orerr: <err>
if error occurs
- Monitor k8s local cluster
minikube dashboard --url
- Monitor confluent platform
now open control center website:
kubectl port-forward controlcenter-0 9021:9021
http://localhost:9021
Since this is a demo application here is a summary of improvements that could be added
- The biggest demo problem is with
./k8s/singer-flow.yaml
and runningsinger-rest-api
instances. There are 2 possible improvements to current boilerplate solution:- Use
helm
and template engine to generate instances in loop - Each
signer-rest-api
instance could create unique topic with prefixsigner.v1.resp
at startup (I would choose this as an improvment)
- Use
- Add system testing
Dockerfile
s files are nearly the same and could be unified in one Dockerfile with build arguments.- Rust:
0. Application run with tokio tasks if for example one such task panics other tasks can still be running. Application can stop working correctly but still be running.
- I use a lot of
expect()
andunwrap()
also for external input - Some code could be shared between
signer-service
andsigner-rest-api
- Error handling could be much improved (for example do not pass all KafkaError to end user)
- I use a lot of
- Topic schemas could be added
- browser js client could use json and distinguish error from correct responses
- Add CD to publish new releases to docker hub
Licensed under Boost Software License - Version 1.0 BSL-1.0 or https://www.boost.org/LICENSE_1_0.txt
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the BSL-1.0 license, should not contains any additional terms or conditions.
See CONTRIBUTING.md.