Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
A push notification server written in Go
1
Bo-Yi Wu
Mopcon @ 2017.10.28
 Why I create the Gorush Project?
 Detail implementation in Golang
 Testing and deploy Go project.
 Run Gorush in Kube...
 Mediatek Engineer
 DevOps
 Golang, PHP, Node.js ..
 Some open source
 Gitea
 Gin
 Drone
 appleboy @GitHub
 apple...
 drone/drone
 go-gitea/gitea
 gin-gonic/gin
 appleboy/gorush
4
 drone/drone
 go-gitea/gitea
 gin-gonic/gin
 appleboy/gorush
5
https://mcs.mediatek.com/
6
Mediatek
Cloud
Sandbox
Trigger
Push
Email
hook
MQTT
TCP
HTTP
7
Mediatek
Cloud
Sandbox
Trigger
Push
Email
hook
MQTT
TCP
HTTP
8Forcus on Push notification
https://github.com/appleboy/gorush
9
A general push notification server
for smartphone application
10
Written in Go
Push requests to APNs and FCM
Simple HTTP APIs (JSON)
RPC Protocol (gRPC)
11
Client
FCM
APN
s
Gorush
POST /push
JSON Body
HTTPS
APNs
Protocol
12
 System Requirement
 Good Performance
 High Concurrency
 Simple net/http Package
 Easy to Learn
13
https://github.com/golang/go/wiki/FromXToGo
14
https://github.com/golangtw/jobs
15
16
FCM
APNs
API Server
API Server
API Server
PUSH
17
FCM
APNs
Worker
Worker
Worker
PUSHQueue
API
API
API
de-queue
Asynchronous Notification
AWS
en-queue
18
Nginx
Traefik
FCM
APNs
Gorush
Gorush
Gorush
PUSH
API
API
API
Http
Post /push
Gorush = Queue + Worker
19
How to implement simple notification service
20
Client
FCM
APN
s
Gorush
POST /push
JSON Body
HTTPS
APNs
Protocol
21
Http Server
gRPC Server
Push API
Worker
22
23
24
25
26
27
28
29
GET /api/stat/go
GET /api/stat/app
GET /sys/stats
GET /metrics
POST /api/push
GET /healthz
30
31
32
33
34
$ for i in {1..99999}; do bat -b.N=1000 -b.C=100 POST local:8088/api/push
35
36
https://github.com/appleboy/gorush/#post-apipush
37
Push API Support Sync Mode
38
Notification
Notification
Notification
Notification
worker
worker
worker
Client
Notification
worker
WaitGroup
39
Notification
Log
Wait response
Send to Work
Queue
40
41
$ gorush
42
$ gorush –c config.yml
43
$ GORUSH_CORE_PORT=8089 gorush
44
 /etc/gorush/config.yml
 $HOME/.gorush/config.yml
 . (Current Folder)
45
Server Confg
Route Config
46
Server Config
Route Config
47
48
Integrate Let's Encrypt
49
https://goo.gl/pfeC5Q
50
Android Config
iOS Config
Log Config
51
API Key From Request
52
53
Supports new Apple Token Based Authentication (JWT)
54
55
memory, blotdb, buntdb, leveldb, redis
56
57
58
package flg
59
60
Docker Container
61
62
$ gorush -android –m="message" -k="API Key" –t="token"
63
$ gorush -ios -m="message" -i="certificate path"
-t="token" -topic="topic"
64
write once run anywhere
65
https://github.com/mitchellh/gox
66
67
https://github.com/facebookgo/grace
68
How to resolve this problem?
69
// +build windows
https://golang.org/pkg/go/build/
70
71
72
$ docker build -t appleboy/gorush .
https://goo.gl/zQbhmu
73
74
75
Continuous Delivery system
built on container technology
76
77
Using .drone.yml file
Git Test Release Docker Notify
78
 Testing Code
 Analytic Code
 Code Quality
 Build Binary
 Deploy Binary
 Build Docker Image
 Deploy Docker Containe...
Git Test Release Docker Notify
80
81
Git Test Release Docker Notify
82
Choose Image
Testing Process
83
84
85
86
87
$ coverage all
https://github.com/appleboy/golang-testing
88
Git Test Release Docker Notify
89
Choose Image
Step Name
Run on for Git tag event
90
91
92
Git Test Release Docker Notify
93
Drone Envars
Drone Secrets
Plugin Image
94
Git Test Release Docker Notify
95
Plugin Image
96
97
98
99
100
101
$ kubectl create -f k8s
$ kubectl get services
$ minikube service frontend
102
http://bit.ly/devops-drone
103
Thanks All coming.
104
Upcoming SlideShare
Loading in …5
×

Gorush: A push notification server written in Go

5,547 views

Published on

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

Published in: Technology
  • Be the first to comment

Gorush: A push notification server written in Go

  1. 1. A push notification server written in Go 1 Bo-Yi Wu Mopcon @ 2017.10.28
  2. 2.  Why I create the Gorush Project?  Detail implementation in Golang  Testing and deploy Go project.  Run Gorush in Kubernetes. 2
  3. 3.  Mediatek Engineer  DevOps  Golang, PHP, Node.js ..  Some open source  Gitea  Gin  Drone  appleboy @GitHub  appleboy @twitter  appleboy @slideshare  appleboy46 @facebook 3
  4. 4.  drone/drone  go-gitea/gitea  gin-gonic/gin  appleboy/gorush 4
  5. 5.  drone/drone  go-gitea/gitea  gin-gonic/gin  appleboy/gorush 5
  6. 6. https://mcs.mediatek.com/ 6
  7. 7. Mediatek Cloud Sandbox Trigger Push Email hook MQTT TCP HTTP 7
  8. 8. Mediatek Cloud Sandbox Trigger Push Email hook MQTT TCP HTTP 8Forcus on Push notification
  9. 9. https://github.com/appleboy/gorush 9
  10. 10. A general push notification server for smartphone application 10
  11. 11. Written in Go Push requests to APNs and FCM Simple HTTP APIs (JSON) RPC Protocol (gRPC) 11
  12. 12. Client FCM APN s Gorush POST /push JSON Body HTTPS APNs Protocol 12
  13. 13.  System Requirement  Good Performance  High Concurrency  Simple net/http Package  Easy to Learn 13
  14. 14. https://github.com/golang/go/wiki/FromXToGo 14
  15. 15. https://github.com/golangtw/jobs 15
  16. 16. 16
  17. 17. FCM APNs API Server API Server API Server PUSH 17
  18. 18. FCM APNs Worker Worker Worker PUSHQueue API API API de-queue Asynchronous Notification AWS en-queue 18
  19. 19. Nginx Traefik FCM APNs Gorush Gorush Gorush PUSH API API API Http Post /push Gorush = Queue + Worker 19
  20. 20. How to implement simple notification service 20
  21. 21. Client FCM APN s Gorush POST /push JSON Body HTTPS APNs Protocol 21
  22. 22. Http Server gRPC Server Push API Worker 22
  23. 23. 23
  24. 24. 24
  25. 25. 25
  26. 26. 26
  27. 27. 27
  28. 28. 28
  29. 29. 29
  30. 30. GET /api/stat/go GET /api/stat/app GET /sys/stats GET /metrics POST /api/push GET /healthz 30
  31. 31. 31
  32. 32. 32
  33. 33. 33
  34. 34. 34
  35. 35. $ for i in {1..99999}; do bat -b.N=1000 -b.C=100 POST local:8088/api/push 35
  36. 36. 36
  37. 37. https://github.com/appleboy/gorush/#post-apipush 37
  38. 38. Push API Support Sync Mode 38
  39. 39. Notification Notification Notification Notification worker worker worker Client Notification worker WaitGroup 39
  40. 40. Notification Log Wait response Send to Work Queue 40
  41. 41. 41
  42. 42. $ gorush 42
  43. 43. $ gorush –c config.yml 43
  44. 44. $ GORUSH_CORE_PORT=8089 gorush 44
  45. 45.  /etc/gorush/config.yml  $HOME/.gorush/config.yml  . (Current Folder) 45
  46. 46. Server Confg Route Config 46
  47. 47. Server Config Route Config 47
  48. 48. 48 Integrate Let's Encrypt
  49. 49. 49
  50. 50. https://goo.gl/pfeC5Q 50
  51. 51. Android Config iOS Config Log Config 51
  52. 52. API Key From Request 52
  53. 53. 53 Supports new Apple Token Based Authentication (JWT)
  54. 54. 54
  55. 55. 55
  56. 56. memory, blotdb, buntdb, leveldb, redis 56
  57. 57. 57
  58. 58. 58
  59. 59. package flg 59
  60. 60. 60
  61. 61. Docker Container 61
  62. 62. 62
  63. 63. $ gorush -android –m="message" -k="API Key" –t="token" 63
  64. 64. $ gorush -ios -m="message" -i="certificate path" -t="token" -topic="topic" 64
  65. 65. write once run anywhere 65
  66. 66. https://github.com/mitchellh/gox 66
  67. 67. 67
  68. 68. https://github.com/facebookgo/grace 68
  69. 69. How to resolve this problem? 69
  70. 70. // +build windows https://golang.org/pkg/go/build/ 70
  71. 71. 71
  72. 72. 72
  73. 73. $ docker build -t appleboy/gorush . https://goo.gl/zQbhmu 73
  74. 74. 74
  75. 75. 75
  76. 76. Continuous Delivery system built on container technology 76
  77. 77. 77 Using .drone.yml file
  78. 78. Git Test Release Docker Notify 78
  79. 79.  Testing Code  Analytic Code  Code Quality  Build Binary  Deploy Binary  Build Docker Image  Deploy Docker Container  Send Notification 79
  80. 80. Git Test Release Docker Notify 80
  81. 81. 81
  82. 82. Git Test Release Docker Notify 82
  83. 83. Choose Image Testing Process 83
  84. 84. 84
  85. 85. 85
  86. 86. 86
  87. 87. 87
  88. 88. $ coverage all https://github.com/appleboy/golang-testing 88
  89. 89. Git Test Release Docker Notify 89
  90. 90. Choose Image Step Name Run on for Git tag event 90
  91. 91. 91
  92. 92. 92
  93. 93. Git Test Release Docker Notify 93
  94. 94. Drone Envars Drone Secrets Plugin Image 94
  95. 95. Git Test Release Docker Notify 95
  96. 96. Plugin Image 96
  97. 97. 97
  98. 98. 98
  99. 99. 99
  100. 100. 100
  101. 101. 101
  102. 102. $ kubectl create -f k8s $ kubectl get services $ minikube service frontend 102
  103. 103. http://bit.ly/devops-drone 103
  104. 104. Thanks All coming. 104

×