2022-01-19 10:53:18 +08:00
|
|
|
|
# 调试FAQ
|
|
|
|
|
|
2022-03-04 15:21:38 +08:00
|
|
|
|
## 重装容器
|
|
|
|
|
|
|
|
|
|
启动过的容器会将数据存储在数据目录,如果需要完全重装,需要手动清除 volume 中的数据。
|
|
|
|
|
|
|
|
|
|
首先通过 docker ps 查到 pushdeer_app_1 容器对应的 id。
|
|
|
|
|
然后运行以下命令删除容器并同时删除 volume。
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
docker rm -v <id>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
你也可以通过 docker volume 命令手工删除数据目录。首先通过 `docker volume ls` 查找数据目录:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
DRIVER VOLUME NAME
|
|
|
|
|
local pushdeer_mariadb_data
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
然后运行:
|
|
|
|
|
|
|
|
|
|
`docker volume inspect pushdeer_mariadb_data` 查看详细信息:
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
"CreatedAt": "2022-03-04T15:18:11+08:00",
|
|
|
|
|
"Driver": "local",
|
|
|
|
|
"Labels": null,
|
|
|
|
|
"Mountpoint": "/var/lib/docker/volumes/pushdeer_mariadb_data/_data",
|
|
|
|
|
"Name": "pushdeer_mariadb_data",
|
|
|
|
|
"Options": null,
|
|
|
|
|
"Scope": "local"
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
删除对应数据目录 `/var/lib/docker/volumes/pushdeer_mariadb_data/_data` 。
|
|
|
|
|
|
|
|
|
|
|
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) 进行测试。
|
|
|
|
|
|
2022-03-04 14:51:14 +08:00
|
|
|
|
为了方便测试(比如使用模拟登入),可修改你使用的 `docker-compose` 文件,将 `APP_DEBUG` 设置为 `true`。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
比如使用自架版,请修改 `docker-compose.self-hosted.yml`:
|
2022-02-21 15:02:31 +08:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
- GO_PUSH_IOS_TOPIC=com.pushdeer.self.ios
|
|
|
|
|
- GO_PUSH_IOS_CLIP_TOPIC=com.pushdeer.self.ios.Clip
|
|
|
|
|
- APP_DEBUG=true
|
|
|
|
|
```
|
|
|
|
|
|
2022-03-04 14:51:14 +08:00
|
|
|
|
## 获取报错信息
|
|
|
|
|
|
|
|
|
|
如果某些请求返回状态码不是200,为了进一步获取错误信息,在确保`docker-compose` 文件中 `APP_DEBUG` 设置为 `true` 的前提下,通过浏览器(GET请求)或者postman等工具(POST请求)访问对应的接口,即可看到详细的错误信息。
|
|
|
|
|
|
2022-03-04 14:59:46 +08:00
|
|
|
|
[postman使用教程](https://blog.51cto.com/u_10698621/3646204)
|
|
|
|
|
|
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) 接口获得。
|