Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Gorush: A push notification server written in Go

Bo-Yi Wu
October 28, 2017

Gorush: A push notification server written in Go

* Why I create the Gorush Project?
* Detail implementation in Golang
* Testing and deploy Go project.
* Run Gorush in Kubernetes.

Bo-Yi Wu

October 28, 2017
Tweet

More Decks by Bo-Yi Wu

Other Decks in Technology

Transcript

  1. •Why I create the Gorush Project? •Detail implementation in Golang

    •Testing and deploy Go project. •Run Gorush in Kubernetes. 2 Outline
  2. • Mediatek Engineer • DevOps • Golang, PHP, Node.js ..

    • Some open source • Gitea • Gin • Drone • appleboy @GitHub • appleboy @twitter • appleboy @slideshare • appleboy46 @facebook About Me 3
  3. Mediatek Cloud Sandbox Trigger Push Email hook MQTT TCP HTTP

    Mediatek Cloud Sandbox 8 Forcus on Push notification
  4. •Written in Go •Push requests to APNs and FCM •Simple

    HTTP APIs (JSON) •RPC Protocol (gRPC) Gorush 11
  5. Before Two Years ago FCM APNs Worker Worker Worker PUSH

    Queue API API API de-queue Asynchronous Notification AWS en-queue 18
  6. Nginx Traefik Now… FCM APNs Gorush Gorush Gorush PUSH API

    API API Http Post /push Gorush = Queue + Worker 19
  7. How to send notification Client FCM APN s Gorush POST

    /push JSON Body HTTPS APNs Protocol 21
  8. GET /metrics (Prometheus + Grafana) $ for i in {1..99999};

    do bat -b.N=1000 -b.C=100 POST local:8088/api/push 35
  9. 41

  10. Write one line code to support 
 renew Let’s Encrypt

    automatically https://goo.gl/pfeC5Q 50
  11. iOS Support .p12, .pem or .p8 53 Supports new Apple

    Token Based Authentication (JWT)
  12. 67

  13. 
 Build small image using docker multi-stage $ docker build

    -t appleboy/gorush . https://goo.gl/zQbhmu 73
  14. • Testing Code • Analytic Code • Code Quality •

    Build Binary • Deploy Binary • Build Docker Image • Deploy Docker Container • Send Notification Pipeline Process in Go 79
  15. 101

  16. $ kubectl create -f k8s $ kubectl get services $

    minikube service frontend Three Steps 102