2022-01-19 10:53:18 +08:00
|
|
|
|
# 调试FAQ
|
|
|
|
|
|
2022-02-21 15:02:31 +08:00
|
|
|
|
## 服务启动调试
|
|
|
|
|
|
|
|
|
|
首先确定API服务是否正常启动。为了能查看到详细信息,请先将已经启动的服务停止:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
docker-compose down
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
然后将原来启动命令中的 `-d` 去掉,再次启动。比如使用自架版,则改为:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
docker-compose -f docker-compose.self-hosted.yml up --build
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
这时候就可以在终端中看到启动的详细信息了。正常情况下,最后显示的信息应该类似:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
app_1 | [SYSLOG] syslog-ng[87]: syslog-ng starting up; version='3.19.1'
|
|
|
|
|
app_1 | [Mon Feb 21 06:36:37.921458 2022] [mpm_event:notice] [pid 92:tid 140276671722624] AH00489: Apache/2.4.38 (Debian) OpenSSL/1.1.1d configured -- resuming normal operations
|
|
|
|
|
app_1 | [Mon Feb 21 06:36:37.922027 2022] [core:notice] [pid 92:tid 140276671722624] AH00094: Command line: 'apache2 -D FOREGROUND -D APACHE_LOCK_DIR'
|
|
|
|
|
app_1 | [21-Feb-2022 06:36:37] NOTICE: fpm is running, pid 91
|
|
|
|
|
app_1 | [21-Feb-2022 06:36:37] NOTICE: ready to handle connections
|
|
|
|
|
app_1 | 2022-02-21 06:36:38,997 INFO success: syslogd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
|
|
|
|
|
app_1 | 2022-02-21 06:36:38,997 INFO success: redis entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
|
|
|
|
|
app_1 | 2022-02-21 06:36:38,997 INFO success: push-ios entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
|
|
|
|
|
app_1 | 2022-02-21 06:36:38,997 INFO success: push-clip entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## End point 连通性测试
|
|
|
|
|
|
|
|
|
|
如果API服务启动没有报错信息,而客户端依然提示连接API错误,请测试 end point 和API服务器之间的连通性。
|
|
|
|
|
|
|
|
|
|
在安装APP的设备上打开浏览器,输入 API end point 地址访问,查看是否可以看到默认的提示信息。
|
|
|
|
|
|
|
|
|
|
也可以用 postman 等工具结合[API文档](https://github.com/easychen/pushdeer#api-%E8%AF%B4%E6%98%8E) 进行测试。
|
|
|
|
|
|
|
|
|
|
为了方便测试(比如使用模拟登入),可修改你使用的 `docker-compose` 文件,将 `APP_DEBUG` 设置为 `true`。比如使用自架版,请修改 `docker-compose.self-hosted.yml`:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
- GO_PUSH_IOS_TOPIC=com.pushdeer.self.ios
|
|
|
|
|
- GO_PUSH_IOS_CLIP_TOPIC=com.pushdeer.self.ios.Clip
|
|
|
|
|
- APP_DEBUG=true
|
|
|
|
|
```
|
|
|
|
|
|
2022-01-19 10:53:18 +08:00
|
|
|
|
## 推送调试
|
|
|
|
|
|
2022-02-21 15:02:31 +08:00
|
|
|
|
如果您的API服务架设成功,且除了推送之外的功能均可使用,那么您可以进入到 docker 容器中进一步调试推送服务。
|
|
|
|
|
|
|
|
|
|
首先运行
|
2022-01-19 10:53:18 +08:00
|
|
|
|
|
|
|
|
|
```bash
|
2022-02-21 15:02:31 +08:00
|
|
|
|
sudo docker ps
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
查看 app_1 对应的 contianer id。
|
|
|
|
|
|
|
|
|
|
然后运行
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
sudo docker exec -it <id> /bin/bash
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
进入容器。
|
|
|
|
|
|
|
|
|
|
接着就可以通过命令行进行推送了测试:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
cd /app/push && /data/gorush -ios -m "推送内容" -c "ios.yml" --topic "com.pushdeer.self.ios" -t "DeviceToken"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
其中 DeviceToken 可以通过[设备列表](https://github.com/easychen/pushdeer#%E8%AE%BE%E5%A4%87%E5%88%97%E8%A1%A8) 接口获得。
|