Skip to content

add request logs for iOS:APNS and Android:FCM #562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 0 additions & 64 deletions .appveyor.yml

This file was deleted.

66 changes: 7 additions & 59 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,11 @@ platform:
arch: amd64

steps:
- name: vet
pull: always
image: golang:1.16
commands:
- make vet
volumes:
- name: gopath
path: /go

- name: lint
pull: always
image: golang:1.16
commands:
- make lint
volumes:
- name: gopath
path: /go

- name: misspell
pull: always
image: golang:1.16
image: golangci/golangci-lint:v1.41.1
commands:
- make misspell-check
- golangci-lint run -v
volumes:
- name: gopath
path: /go
Expand Down Expand Up @@ -80,6 +62,11 @@ services:
- name: redis
image: redis

- name: nsq
image: nsqio/nsq
commands:
- /nsqd

volumes:
- name: gopath
temp: {}
Expand Down Expand Up @@ -122,19 +109,6 @@ steps:
commands:
- ./release/linux/amd64/gorush --help

- name: dryrun
pull: always
image: plugins/docker:linux-amd64
settings:
cache_from: appleboy/gorush
dockerfile: docker/Dockerfile.linux.amd64
dry_run: true
repo: appleboy/gorush
tags: linux-amd64
when:
event:
- pull_request

- name: publish
pull: always
image: plugins/docker:linux-amd64
Expand Down Expand Up @@ -201,19 +175,6 @@ steps:
commands:
- ./release/linux/arm64/gorush --help

- name: dryrun
pull: always
image: plugins/docker:linux-arm64
settings:
cache_from: appleboy/gorush
dockerfile: docker/Dockerfile.linux.arm64
dry_run: true
repo: appleboy/gorush
tags: linux-arm64
when:
event:
- pull_request

- name: publish
pull: always
image: plugins/docker:linux-arm64
Expand Down Expand Up @@ -280,19 +241,6 @@ steps:
commands:
- ./release/linux/arm/gorush --help

- name: dryrun
pull: always
image: plugins/docker:linux-arm
settings:
cache_from: appleboy/gorush
dockerfile: docker/Dockerfile.linux.arm
dry_run: true
repo: appleboy/gorush
tags: linux-arm
when:
event:
- pull_request

- name: publish
pull: always
image: plugins/docker:linux-arm
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ custom
release
coverage.txt
node_modules
config.yml
19 changes: 8 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ DEPLOY_ACCOUNT := appleboy
DEPLOY_IMAGE := $(EXECUTABLE)
GOFMT ?= gofumpt -l -s -extra

TARGETS ?= linux darwin windows openbsd
ARCHS ?= amd64 386
TARGETS ?= linux darwin windows
ARCHS ?= amd64
GOFILES := $(shell find . -name "*.go" -type f)
TAGS ?= sqlite
LDFLAGS ?= -X 'main.Version=$(VERSION)'
NODE_PROTOC_PLUGIN := $(shell which grpc_tools_node_protoc_plugin)

ifneq ($(shell uname), Darwin)
EXTLDFLAGS = -extldflags "-static" $(null)
Expand Down Expand Up @@ -149,16 +148,14 @@ clean:
find . -name *.db -delete
-rm -rf release dist .cover

rpc/example/node/gorush_*_pb.js: rpc/proto/gorush.proto
@hash grpc_tools_node_protoc_plugin > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
npm install -g grpc-tools; \
fi
protoc -I rpc/proto rpc/proto/gorush.proto --js_out=import_style=commonjs,binary:rpc/example/node/ --grpc_out=rpc/example/node/ --plugin=protoc-gen-grpc=$(NODE_PROTOC_PLUGIN)
generate_proto_js:
npm install grpc-tools
protoc -I rpc/proto rpc/proto/gorush.proto --js_out=import_style=commonjs,binary:rpc/example/node/ --grpc_out=rpc/example/node/ --plugin=protoc-gen-grpc="node_modules/.bin/grpc_tools_node_protoc_plugin"

rpc/proto/gorush.pb.go: rpc/proto/gorush.proto
protoc -I rpc/proto rpc/proto/gorush.proto --go_out=plugins=grpc:rpc/proto
generate_proto_go:
protoc -I rpc/proto rpc/proto/gorush.proto --go_out=rpc/proto --go-grpc_out=require_unimplemented_servers=false:rpc/proto

generate_proto: rpc/proto/gorush.pb.go rpc/example/node/gorush_*_pb.js
generate_proto: generate_proto_go generate_proto_js

version:
@echo $(VERSION)
51 changes: 33 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@ A push notification micro server using [Gin](https://github.com/gin-gonic/gin) f

[![GoDoc](https://godoc.org/github.com/appleboy/gorush?status.svg)](https://godoc.org/github.com/appleboy/gorush)
[![Build Status](https://cloud.drone.io/api/badges/appleboy/gorush/status.svg)](https://cloud.drone.io/appleboy/gorush)
[![Build status](https://ci.appveyor.com/api/projects/status/ka4hvplssp1q2s5u?svg=true)](https://ci.appveyor.com/project/appleboy/gorush-fp5dh)
[![codecov](https://codecov.io/gh/appleboy/gorush/branch/master/graph/badge.svg)](https://codecov.io/gh/appleboy/gorush)
[![Go Report Card](https://goreportcard.com/badge/github.com/appleboy/gorush)](https://goreportcard.com/report/github.com/appleboy/gorush)
[![codebeat badge](https://codebeat.co/badges/0a4eff2d-c9ac-46ed-8fd7-b59942983390)](https://codebeat.co/projects/github-com-appleboy-gorush)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/c82e0ed283474c5686d705ce64d004f7)](https://www.codacy.com/app/appleboy/gorush?utm_source=github.com&utm_medium=referral&utm_content=appleboy/gorush&utm_campaign=Badge_Grade)
[![Docker Pulls](https://img.shields.io/docker/pulls/appleboy/gorush.svg)](https://hub.docker.com/r/appleboy/gorush/)
[![microbadger](https://images.microbadger.com/badges/image/appleboy/gorush.svg)](https://microbadger.com/images/appleboy/gorush "Get your own image badge on microbadger.com")
[![Release](https://github-release-version.herokuapp.com/github/appleboy/gorush/release.svg?style=flat)](https://github.com/appleboy/gorush/releases/latest)
[![Netlify Status](https://api.netlify.com/api/v1/badges/8ab14c9f-44fd-4d9a-8bba-f73f76d253b1/deploy-status)](https://app.netlify.com/sites/gorush/deploys)
[![Financial Contributors on Open Collective](https://opencollective.com/gorush/all/badge.svg?label=financial+contributors)](https://opencollective.com/gorush)

Expand Down Expand Up @@ -94,6 +90,7 @@ A push notification micro server using [Gin](https://github.com/gin-gonic/gin) f
- Support send notification through [RPC](https://en.wikipedia.org/wiki/Remote_procedure_call) protocol, we use [gRPC](https://grpc.io/) as default framework.
- Support running in Docker, [Kubernetes](https://kubernetes.io/) or [AWS Lambda](https://aws.amazon.com/lambda) ([Native Support in Golang](https://aws.amazon.com/blogs/compute/announcing-go-support-for-aws-lambda/))
- Support graceful shutdown that workers and queue have been sent to APNs/FCM before shutdown service.
- Support different Queue as backend like [NSQ](https://nsq.io/) or [NATS](https://nats.io/), defaut engine is local [Channel](https://tour.golang.org/concurrency/2).

See the default [YAML config example](config/testdata/config.yml):

Expand Down Expand Up @@ -145,11 +142,22 @@ android:
max_retry: 0 # resend fail notification, default value zero is disabled

huawei:
enabled: true
enabled: false
appsecret: "YOUR_APP_SECRET"
appid: "YOUR_APP_ID"
max_retry: 0 # resend fail notification, default value zero is disabled

queue:
engine: "local" # support "local", "nsq" and "nats " default value is "local"
nsq:
addr: 127.0.0.1:4150
topic: gorush
channel: gorush
nats:
addr: 127.0.0.1:4222
subj: gorush
queue: gorush

ios:
enabled: false
key_path: "key.pem"
Expand All @@ -173,7 +181,8 @@ log:
stat:
engine: "memory" # support memory, redis, boltdb, buntdb or leveldb
redis:
addr: "localhost:6379"
cluster: false
addr: "localhost:6379" # if cluster is true, you may set this to "localhost:6379,localhost:6380,localhost:6381"
password: ""
db: 0
boltdb:
Expand Down Expand Up @@ -216,19 +225,19 @@ go get -u -v github.com/appleboy/gorush
On linux

```sh
wget https://github.com/appleboy/gorush/releases/download/v1.13.0/gorush-v1.13.0-linux-amd64 -O gorush
wget https://github.com/appleboy/gorush/releases/download/v1.14.0/gorush-v1.14.0-linux-amd64 -O gorush
```

On OS X

```sh
wget https://github.com/appleboy/gorush/releases/download/v1.13.0/gorush-v1.13.0-darwin-amd64 -O gorush
wget https://github.com/appleboy/gorush/releases/download/v1.14.0/gorush-v1.14.0-darwin-amd64 -O gorush
```

On Windows

```sh
wget https://github.com/appleboy/gorush/releases/download/v1.13.0/gorush-v1.13.0-windows-amd64.exe -O gorush.exe
wget https://github.com/appleboy/gorush/releases/download/v1.14.0/gorush-v1.14.0-windows-amd64.exe -O gorush.exe
```

On macOS, use Homebrew.
Expand Down Expand Up @@ -294,7 +303,7 @@ Huawei Options:
Common Options:
--topic <topic> iOS or Android topic message
-h, --help Show this message
-v, --version Show version
-V, --version Show version
```

### Send Android notification
Expand Down Expand Up @@ -1042,7 +1051,7 @@ func main() {
Badge: 1,
Category: "test",
Sound: "test",
Priority: proto.Priority_High,
Priority: proto.NotificationRequest_HIGH,
Alert: &proto.Alert{
Title: "Test Title",
Body: "Test Alert Body",
Expand All @@ -1062,10 +1071,13 @@ func main() {
},
})
if err != nil {
log.Fatalf("could not greet: %v", err)
log.Println("could not greet: ", err)
}

if r != nil {
log.Printf("Success: %t\n", r.Success)
log.Printf("Count: %d\n", r.Counts)
}
log.Printf("Success: %t\n", r.Success)
log.Printf("Count: %d\n", r.Counts)
}
```

Expand Down Expand Up @@ -1144,7 +1156,7 @@ func main() {
Badge: 1,
Category: "test",
Sound: "test",
Priority: proto.Priority_High,
Priority: proto.NotificationRequest_HIGH,
Alert: &proto.Alert{
Title: "Test Title",
Body: "Test Alert Body",
Expand All @@ -1164,10 +1176,13 @@ func main() {
},
})
if err != nil {
log.Fatalf("could not greet: %v", err)
log.Println("could not greet: ", err)
}

if r != nil {
log.Printf("Success: %t\n", r.Success)
log.Printf("Count: %d\n", r.Counts)
}
log.Printf("Success: %t\n", r.Success)
log.Printf("Count: %d\n", r.Counts)
}
```

Expand Down
Loading