pushdeer/doc/安装文档.md

103 lines
3.4 KiB
Markdown
Raw Normal View History

2022-01-18 12:32:00 +08:00
# PushDeer 安装文档
- ⚠️ 当前PushDeer依然在开发中API和安装文档均有可能调整。
- ⚠️ 当前安装文档仅 iOS 版可用
## API服务器的安装
默认的 `docker-compose` 是为开发准备的,不适合放置到线上,以下做调整:
1. 将`MySQL`服务独立出来,建议直接采用云厂商的数据库服务。
1. 设置环境变量,关闭调试信息和接口
1. 配置https
### STEP0clone 项目代码
`git clone https://github.com/easychen/pushdeer.git`
2022-01-18 13:35:32 +08:00
### STEP1 :编写线上环境的 docker-compose.yml ,替换环境变量
2022-01-18 12:32:00 +08:00
```yml
version: '2'
services:
2022-01-19 15:00:29 +08:00
redis:
image: 'bitnami/redis:6.0.16'
environment:
- ALLOW_EMPTY_PASSWORD=yes
2022-01-18 12:32:00 +08:00
app:
#image: 'webdevops/php-apache:8.0-alpine'
build: './docker/web/'
ports:
- '80:80'
2022-01-18 13:35:32 +08:00
- '443:443' # 开放 https 需要的接口
2022-01-19 15:00:29 +08:00
depends_on:
- redis
2022-01-18 12:32:00 +08:00
volumes:
- './:/app'
environment:
- DB_DATABASE=pushdeer
- DB_HOST=clouddb.com
- DB_PASSWORD=thep@ssw0rd
- DB_PORT=3306
- DB_TIMEZONE=+08:00
- DB_USERNAME=pushdeer
- APP_DEBUG=false
```
### STEP2配置 SSL 证书
#### 放置证书文件
申请域名对应的 SSL 证书,获得证书文件( `example.crt` )和私钥文件( `example.key`)。
在项目根目录下建立 `ssl` 目录,将证书文件重命名为 `server.crt` 和 私钥文件重命名为 `server.key`
如果你下载的证书中还包含根证书(root_crt),可将根证书文本追加到 `server.crt` 之后。
#### 修改虚拟host配置
修改 `docker/web/vhost.conf` 中被注释掉的[这三行](https://github.com/easychen/pushdeer/blob/10e4d3bb62d8d66d4739598a8f4af32eda4cceef/docker/web/vhost.conf#L27)。
```conf
<VirtualHost *:443>
ServerName yourdomain.com
ServerAlias *.vm docker.vm
DocumentRoot "/app/api/public"
<Directory /app/api/public>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
SSLEngine on
SSLCertificateFile /app/ssl/server.crt
SSLCertificateKeyFile /app/ssl/server.key
</VirtualHost>
```
### STEP3配置推送证书
进入 push 目录,修改 `*.yml.sample``*.yml`。其中iOS应用和Clip使用两个分开的证书进行推送`ios.yml` 是APP的配置、`clip.yml` 是Clip的配置。注意根据开发和产品状态修改`yml`中的值`production`。
默认配置中,`c.p12` 是APP的推送证书、`cc.p12`是Clip的推送证书。
### STEP4构建并运行镜像
运行 `docker-compose up -d --build`启动API。访问 `https://yourdomain.com` 即可查看到API服务器默认网页。
## iOS客户端的编译
### 编译
参考 ios 目录下的[安装说明](https://github.com/easychen/pushdeer/tree/main/ios/PushDeer-iOS),配置项目
修改以下内容:
1. 更换项目中的名称和标识( 请勿直接使用PushDeer的名称和标识
1. 将项目中的 Bundle Identifier xcode.proj文件、General标签 )改为和通知证书响应的
1. 将项目中的 签名和team更换为用于上架的开发者的xcode.proj文件、Signing & Capabilities标签
1. 修改[API接口中的域名](https://github.com/easychen/pushdeer/blob/10e4d3bb62d8d66d4739598a8f4af32eda4cceef/ios/PushDeer-iOS/PushDeer/Service/PushDeerApi.swift#L37),替换为之前安装的服务