Skip to content

Commit

Permalink
feat(docker): 添加compose文件,优化makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
am6737 committed Mar 8, 2024
1 parent 6ac8641 commit b393fce
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 16 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
PKG := "github.com/cossim/hipush"
IMG ?= hub.hitosea.com/cossim/hipush:latest
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
PLATFORM ?= linux/amd64 # 默认平台参数为 linux/amd64

.PHONY: dep
dep: ## Get the dependencies
Expand Down Expand Up @@ -37,9 +38,9 @@ gen: ## generate protobuf file
# If you wish built the manager image targeting other platforms you can use the --platform flag.
# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
docker-build: dep test## Build docker image with the manager.
docker build -t "${IMG}" .
docker-build: dep test ## Build docker image with the manager.
docker build --no-cache --platform ${PLATFORM} -t "${IMG}" .

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
docker push ${IMG}
docker push ${IMG}
13 changes: 7 additions & 6 deletions config/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ storage:
enabled: true
# 存储类型 memory redis
type: "memory"

# 本地持久化路径
path: ""
ios:
- enabled: true

# 应用程序的 Bundle ID
# ios capacitor.config文件中的appId 例如com.hitosea.apptest
appid: com.hitosea.apptest
appid: ""

# APNs 密钥文件路径
key_path: ""
Expand Down Expand Up @@ -67,8 +68,8 @@ android:

huawei:
- enabled: true
app_id: huawei-appid-1
app_secret: huawei-app-secret-1
app_id: "huawei-appid-1"
app_secret: "huawei-app-secret-1"

# 华为认证URL
auth_url: https://oauth-login.cloud.huawei.com/oauth2/v3/token
Expand Down Expand Up @@ -102,14 +103,14 @@ xiaomi:

meizu:
- enabled: true
app_id: "2882303761520159644"
app_id: ""
package: ""
app_key: ""
max_retry: 5

honor:
- enabled: true
app_id: "2882303761520159644"
app_id: ""
client_id: ""
client_secret: ""
max_retry: 5
16 changes: 16 additions & 0 deletions deploy/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3.9'
services:
hipush:
container_name: hipush
platform: linux/amd64
image: hub.hitosea.com/cossim/hipush
volumes:
- ./config.yaml:/config/config.yaml
# 如果启用了ios推送,需要将推送证书挂载到容器中
#- /Users/macos-15/Desktop/key/AuthKey_UU2D9Z4ANF.p8:/config/key/AuthKey_UU2D9Z4ANF.p8
command:
- "-config"
- "/config/config.yaml"
ports:
- "7070:7070"
- "7071:7071"
116 changes: 116 additions & 0 deletions deploy/docker/example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
http:
enabled: true
address: "0.0.0.0"
port: 7070

grpc:
enabled: true
address: "0.0.0.0"
port: 7071

storage:
enabled: true
# 存储类型 memory redis
type: "memory"
# 本地持久化路径
path: ""
ios:
- enabled: true

# 应用程序的 Bundle ID
# ios capacitor.config文件中的appId 例如com.hitosea.apptest
appid: ""

# APNs 密钥文件路径
key_path: ""

# 密钥类型(例如:pem)
key_type: pem

# 密钥文件的密码(如果有)
password: ""

# 是否为生产环境
production: false

# 最大并发推送数
max_concurrent_pushes: 100
# 最大重试次数

max_retry: 5

# 密钥 ID
key_id: ""

# 开发团队 ID
team_id: ""

- enabled: true
app_id: ""
key_path: ""
key_type: pem
password: ""
production: false
max_concurrent_pushes: 100
max_retry: 0
key_id: ""
team_id: ""

android:
- enabled: true

appid: ""

# Firebase Admin SDK AccountKey.json
key_path: ""

max_retry: 0

huawei:
- enabled: true
app_id: "huawei-appid-1"
app_secret: "huawei-app-secret-1"

# 华为认证URL
auth_url: https://oauth-login.cloud.huawei.com/oauth2/v3/token

# 华为推送URL
push_url: https://push-api.cloud.huawei.com
max_retry: 5

vivo:
- enabled: true
app_id: ""
app_key: ""
app_secret: ""
max_retry: 5

oppo:
- enabled: true
app_id: ""
app_key: ""
# 这里的secret是oppo的masterSecret,
app_secret: ""
max_retry: 5

xiaomi:
- enabled: true
app_id: ""
package:
- xxx.xx.xx
app_secret: ""
max_retry: 5

meizu:
- enabled: true
app_id: ""
package: ""
app_key: ""
max_retry: 5

honor:
- enabled: true
app_id: ""
client_id: ""
client_secret: ""
max_retry: 5
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/316014408/oppo-push v0.0.0-20190427030828-462d62e6b171
github.com/appleboy/go-fcm v0.1.6
github.com/cossim/go-hms-push v0.0.0-20240301034220-38310a1d80e5
github.com/cossim/go-meizu-push-sdk v0.0.0-20240306071207-456c3a8650c6
github.com/cossim/go-meizu-push-sdk v0.0.0-20240308111828-f4255aaae3ac
github.com/cossim/vivo-push v0.0.0-20240301025332-148acd987861
github.com/gin-gonic/gin v1.9.1
github.com/go-logr/logr v1.4.1
Expand All @@ -16,9 +16,10 @@ require (
github.com/google/uuid v1.6.0
github.com/mitchellh/mapstructure v1.5.0
github.com/sideshow/apns2 v0.23.0
github.com/thoas/stats v0.0.0-20190407194641-965cb2de1678
github.com/yilee/xiaomi-push v0.0.0-20170213073944-562fbb07388e
go.uber.org/zap v1.27.0
google.golang.org/api v0.168.0
google.golang.org/api v0.169.0
google.golang.org/grpc v1.62.1
google.golang.org/protobuf v1.33.0
gopkg.in/yaml.v3 v3.0.1
Expand Down Expand Up @@ -58,7 +59,6 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/satori/go.uuid v1.2.0 // indirect
github.com/thoas/stats v0.0.0-20190407194641-965cb2de1678 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
go.opencensus.io v0.24.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cossim/go-hms-push v0.0.0-20240301034220-38310a1d80e5 h1:AGXSM5ClpfmtNEFQvJUncqHDbnxp9ZzcpymKKvSpHIY=
github.com/cossim/go-hms-push v0.0.0-20240301034220-38310a1d80e5/go.mod h1:QqZK9q8Ecb/frr2gWxb4+wz4MAFRzlVelNCr1VFRZrQ=
github.com/cossim/go-meizu-push-sdk v0.0.0-20240306071207-456c3a8650c6 h1:6/X78DqpAbBkcTtg4UZWfqFOYCd+CiELdDomTulLJBk=
github.com/cossim/go-meizu-push-sdk v0.0.0-20240306071207-456c3a8650c6/go.mod h1:DVwayap9H6AjUZ0a79Of0W9mdgksF54uPlAX1LwIhQk=
github.com/cossim/go-meizu-push-sdk v0.0.0-20240308111828-f4255aaae3ac h1:JTkGqCyzrVd5/z/kikebm26O9mx3F+7L8UZzid1jZ6Y=
github.com/cossim/go-meizu-push-sdk v0.0.0-20240308111828-f4255aaae3ac/go.mod h1:XwwjjCpZvHHtdhsetBDoZ46WTnzaGWrr+DlVRQasiEE=
github.com/cossim/vivo-push v0.0.0-20240301025332-148acd987861 h1:7VkgDgzr3C38pLkyDjhKRqOIrlhb1nVz8JL+0lSi4Xw=
github.com/cossim/vivo-push v0.0.0-20240301025332-148acd987861/go.mod h1:PHaZK+wOOXEZR4B8pt2MYWpV1o+jGZ1CcAh4858IvTg=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
Expand Down Expand Up @@ -251,8 +251,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU=
google.golang.org/api v0.168.0 h1:MBRe+Ki4mMN93jhDDbpuRLjRddooArz4FeSObvUMmjY=
google.golang.org/api v0.168.0/go.mod h1:gpNOiMA2tZ4mf5R9Iwf4rK/Dcz0fbdIgWYWVoxmsyLg=
google.golang.org/api v0.169.0 h1:QwWPy71FgMWqJN/l6jVlFHUa29a7dcUy02I8o799nPY=
google.golang.org/api v0.169.0/go.mod h1:gpNOiMA2tZ4mf5R9Iwf4rK/Dcz0fbdIgWYWVoxmsyLg=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
Expand Down

0 comments on commit b393fce

Please sign in to comment.