修复flyapps容器构建失败问题,优化部署文档

dependabot/npm_and_yarn/fir_admin/decode-uri-component-0.2.2
isummer 2 years ago
parent adff361c11
commit a064988f56
  1. 124
      README.md
  2. 85
      doc/docker.md
  3. BIN
      doc/images/img_1.png
  4. BIN
      doc/images/img_10.png
  5. BIN
      doc/images/img_11.png
  6. BIN
      doc/images/img_2.png
  7. BIN
      doc/images/img_3.png
  8. BIN
      doc/images/img_4.png
  9. BIN
      doc/images/img_5.png
  10. BIN
      doc/images/img_6.png
  11. BIN
      doc/images/img_7.png
  12. BIN
      doc/images/img_8.png
  13. BIN
      doc/images/img_9.png
  14. 86
      doc/local.md
  15. 81
      docker.md
  16. 2
      docker/flyapps/docker-compose.yml
  17. 2
      docker/scripts/build.sh
  18. 6
      fir_ser/Dockerfile
  19. 252
      fir_ser/dumpdata.json

@ -43,126 +43,8 @@
- 不开启,无需域名和证书 - 不开启,无需域名和证书
- Centos8Stream 服务器 - Centos8Stream 服务器
#### 修改配置文件 ## 部署方式
##### fir_ser配置文件 config.py
```python
class DOMAINCONF(object):
API_DOMAIN = "https://app.hehelucky.cn" # 用与开启本地存储,上传应用配置
WEB_DOMAIN = "https://app.hehelucky.cn" # 用于超级签跳转配置,该域名一般为前端页面域名
MOBILEPROVISION = "https://static.hehejoy.cn/embedded3.mobileprovision" # 用于苹果包企业签信任企业跳转
``` ### 1.[Docker 部署](./doc/docker.md) 【推荐】
##### fir_client配置文件 vue.confjg.js ### 2. [本地部署](./doc/local.md) 【推荐】
```javascript
const pro_base_env = {
baseUrl: '/', //该选项可以填写web-api的域名,类似 https://api.xxx.com/
index_static: '/', //若配置cdn等加速,可以填写cdn加速域名
baseShortUrl: '/', //该选项可以填写short-api的域名,也可以和web-api域名一样,类似 https://api.xxx.com/
short_static: '/short/', //若配置cdn等加速,可以填写cdn加速域名
version: version,
};
```
##### 从git上面下载源码
```shell
cd /data/
git clone https://github.com/nineaiyu/FlyApps
```
### [Docker 部署](./docker.md)
### FlyApp 本地部署 [python3 环境]
##### 搭建python env 环境
```shell
yum install python39 python39-devel redis mariadb-server mariadb-devel -y
python3.9 -m venv py39
source py39/bin/activate
```
###### 安装pip包
```shell
cd fir_ser/
pip install -U setuptools pip
pip install -r requirements.txt
```
###### 配置数据库
```
在 config.py 配置redis 和 mysql 数据库
```
###### 迁移数据库
```shell
#如果是mysql,需要做一下配置,如果是sqlite,需要升级sqlite
#记得根据配置创建数据库
#create database flyapp default character set utf8 COLLATE utf8_general_ci;
#grant all on flyapp.* to flyuser@'127.0.0.1' identified by 'flypwd00oo.1';
python manage.py makemigrations
python manage.py migrate
```
### FlyApp zsign ipa重签名工具安装
```shell
yum install openssl-devel -y
yum install gcc-c++ gcc -y
tar xvf v1.1.2.tar.gz
cd zsign-1.1.2/
g++ *.cpp common/*.cpp -lcrypto -O3 -std=c++11 -o zsign
cp zsign /usr/bin/
```
### FlyApp web端搭建
###### npm编译环境
```shell
yum install npm
npm install -g n
n 12.13 # 安装12版本的node或者14版本 ,最新版本会有问题
npm install -g yarn
```
###### 编译web端和下载页
```shell
cd FlyApps/fir_client/
vim vue.config.js #修改api接口地址
# pro_base_env 正式环境信息
# dev_base_env 开发环境信息
yarn install
yarn build index # web打包
yarn build short # 下载也打包
```
###### web目录操作
```shell
# web目录: /www/wwwroot/fly.dvcloud.xin/
cd /www/wwwroot/fly.dvcloud.xin/
cp -a /data/FlyApps/fir_client/dist/* .
cp -a /data/FlyApps/fir_download/dist/* .
```
##### 更新sqllite
```shell
tar xvf sqlite-autoconf-3310100.tar.gz
cd sqlite-autoconf-3310100
./configure --prefix=/usr/local/sqlite
make -j4
make install
rm -rf /usr/bin/sqlite3
ln -s /usr/local/sqlite/bin/sqlite3 /usr/bin/sqlite3
ll /usr/bin/sqlite3
echo "/usr/local/sqlite/lib" > /etc/ld.so.conf.d/sqlite3.conf
ldconfig
```

@ -0,0 +1,85 @@
### Docker最小化部署前准备
系统|Centos 8 Stream 纯净系统 [1cpu 4G内存]
----|----
域名|```app.hehelucky.cn```
域名SSL证书| nginx 格式证书 [阿里云和腾讯云都可以申请免费ssl证书]
数据路径| ```/data```
### 开始部署
##### 1.从git上面下载源码
```
cd /data/
dnf install git -y
git clone https://github.com/nineaiyu/FlyApps
```
## 注意,下面展示的相对路径,都是以```/data/FlyApps```为相对目录
#### 2.docker环境安装
```
cd /data/FlyApps/docker/init
sh init.sh
```
#### 3.配置域名和证书,如果有cdn或者oss,也要进行配置
a.将域名证书通过```sftp软件```或者```rz命令```复制到```/data/FlyApps/nginx.conf.d```目录中
b.将域名证书分别重命名为 ```域名.pem``` 和 ```域名.key``` .本次使用的域名是 ```app.hehelucky.cn``` ,因此,证书名称类似如下
```shell script
nginx.conf.d/app.hehelucky.cn.key
nginx.conf.d/app.hehelucky.cn.pem
```
c.修改NGINX配置文件```nginx.conf.d/flyapps-vhost.conf```,将```server_name```字段修改为域名,将```ssl_certificate```和
```ssl_certificate_key```修改为对应证书路径,修改之后,对应字段如下
```shell
server_name app.hehelucky.cn;
ssl_certificate /etc/nginx/conf.d/app.hehelucky.cn.pem;
ssl_certificate_key /etc/nginx/conf.d/app.hehelucky.cn.key;
```
#### 4.配置api服务需要修改api和web域名,如果有需求,还可以配置 短信,邮箱,geetest,存储等信息
##### fir_ser配置文件 ```fir_ser/config.py```
```python
class DOMAINCONF(object):
API_DOMAIN = "https://app.hehelucky.cn" # 用与开启本地存储,上传应用配置
WEB_DOMAIN = "https://app.hehelucky.cn" # 用于超级签跳转配置,该域名一般为前端页面域名
```
##### fir_client配置文件 ```fir_client/vue.confjg.js```
```javascript
const pro_base_env = {
baseUrl: '/', //该选项可以填写web-api的域名,类似 https://api.xxx.com/
index_static: '/', //若配置cdn等加速,可以填写cdn加速域名
baseShortUrl: '/', //该选项可以填写short-api的域名,也可以和web-api域名一样,类似 https://api.xxx.com/
short_static: '/short/', //若配置cdn等加速,可以填写cdn加速域名
version: version,
};
```
##### 构建静态资源
```
cd /data/FlyApps/docker/scripts
sh build.sh
```
##### 启动所有服务
```
cd /data/FlyApps/docker/scripts
sh start_all.sh
```
##### 关闭所有服务
```
cd /data/FlyApps/docker/scripts
sh stop_all.sh
```
##### 根据提示创建默认管理用户,用与访问管理后台
```shell
docker exec -it flyapps python manage.py createsuperuser
```
##### 测试访问
- 在浏览器输入自己配置的域名 https://app.hehelucky.cn/ 进行访问
- 管理后台访问 https://app.hehelucky.cn:3448/ 进行访问

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

@ -0,0 +1,86 @@
### 本地部署前准备
系统|Centos 8 Stream [1cpu 4G内存]
----|----
域名|```app.hehelucky.cn```
域名SSL证书| nginx 格式证书 [阿里云和腾讯云都可以申请免费ssl证书]
数据路径| ```/data```
##### 从git上面下载源码
```shell
cd /data/
git clone https://github.com/nineaiyu/FlyApps
```
### FlyApp 本地部署 [python3 环境]
##### 搭建python env 环境
```shell
yum install python39 python39-devel redis mariadb-server mariadb-devel -y
python3.9 -m venv py39
source py39/bin/activate
```
###### 安装pip包
```shell
cd fir_ser/
pip install -U setuptools pip
pip install -r requirements.txt
```
###### 配置数据库
```
在 config.py 配置redis 和 mysql 数据库
```
###### 迁移数据库
```shell
#如果是mysql,需要做一下配置,如果是sqlite,需要升级sqlite
#记得根据配置创建数据库
#create database flyapp default character set utf8 COLLATE utf8_general_ci;
#grant all on flyapp.* to flyuser@'127.0.0.1' identified by 'flypwd00oo.1';
python manage.py makemigrations
python manage.py migrate
```
### FlyApp zsign ipa重签名工具安装
```shell
yum install openssl-devel -y
yum install gcc-c++ gcc -y
tar xvf v1.1.2.tar.gz
cd zsign-1.1.2/
g++ *.cpp common/*.cpp -lcrypto -O3 -std=c++11 -o zsign
cp zsign /usr/bin/
```
### FlyApp web端搭建
###### npm编译环境
```shell
yum install npm
npm install -g n
n 12.13 # 安装12版本的node或者14版本 ,最新版本会有问题
npm install -g yarn
```
###### 编译web端和下载页
```shell
cd FlyApps/fir_client/
vim vue.config.js #修改api接口地址
# pro_base_env 正式环境信息
# dev_base_env 开发环境信息
yarn install
yarn build index # web打包
yarn build short # 下载也打包
```
###### 编译web管理后台
```shell
cd FlyApps/fir_admin/
yarn install
yarn build
```

@ -1,81 +0,0 @@
##### 从git上面下载源码
```
cd /data/
git clone https://github.com/nineaiyu/FlyApps
```
#### docker环境安装 [centos8]
```
cd /data/FlyApps/docker/init
sh init.sh
```
#### 域名证书准备
- 域名: app.hehelucky.cn
- 证书(nginx)
- app.hehelucky.cn.key
- app.hehelucky.cn.pem
#### 配置域名和证书,如果有cdn或者oss,也要进行配置
```shell script
nginx.conf.d/app.hehelucky.cn.key
nginx.conf.d/app.hehelucky.cn.pem
nginx.conf.d/flyapps-vhost.conf
```
#### api服务需要修改api和web域名,短信,邮箱,geetest,存储等信息
##### fir_ser配置文件 config.py
```python
class DOMAINCONF(object):
API_DOMAIN = "https://app.hehelucky.cn" # 用与开启本地存储,上传应用配置
WEB_DOMAIN = "https://app.hehelucky.cn" # 用于超级签跳转配置,该域名一般为前端页面域名
```
##### fir_client配置文件 vue.confjg.js
```javascript
const pro_base_env = {
baseUrl: '/', //该选项可以填写web-api的域名,类似 https://api.xxx.com/
index_static: '/', //若配置cdn等加速,可以填写cdn加速域名
baseShortUrl: '/', //该选项可以填写short-api的域名,也可以和web-api域名一样,类似 https://api.xxx.com/
short_static: '/short/', //若配置cdn等加速,可以填写cdn加速域名
version: version,
};
```
##### 构建静态资源和api服务
```
cd /data/FlyApps/docker/scripts
sh build.sh
```
##### 构建flyapps-cli
```shell
cd /data/FlyApps/fir_ser
docker build -t flyapps-cli -f Dockerfile.cli .
```
##### 构建镜像的同时,下载依赖镜像
```shell
docker pull 'bitnami/mariadb:10.7.3'
docker pull 'bitnami/redis:6.2.7'
docker pull 'nginx:1.21.3'
```
##### 启动所有服务
```
cd /data/FlyApps/docker/scripts
sh start_all.sh
```
##### 关闭所有服务
```
cd /data/FlyApps/docker/scripts
sh stop_all.sh
```
##### 根据提示创建默认管理用户
```shell
docker exec -it flyapps python manage.py createsuperuser
```
##### 测试访问
- 在浏览器输入自己配置的域名 https://app.hehelucky.cn/ 进行访问
- 管理后台访问 https://app.hehelucky.cn:3448/ 进行访问

@ -9,7 +9,7 @@ services:
flyapps: flyapps:
container_name: flyapps container_name: flyapps
restart: always restart: always
image: 'flyapps' image: 'nineven/flyapps'
working_dir: /data/fir_ser working_dir: /data/fir_ser
volumes: volumes:
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro

@ -3,4 +3,4 @@
# #
cd ../build/ cd ../build/
docker-compose up buildclient buildadmin buildflyapps docker-compose up buildclient buildadmin

@ -2,9 +2,9 @@ FROM python:3.9.14-slim
# Fixes some weird terminal issues such as broken clear / CTRL+L # Fixes some weird terminal issues such as broken clear / CTRL+L
RUN sed -i 's/deb.debian.org/mirrors.163.com/g' /etc/apt/sources.list \ #RUN sed -i 's/deb.debian.org/mirrors.163.com/g' /etc/apt/sources.list \
&& sed -i 's/security.debian.org/mirrors.163.com/g' /etc/apt/sources.list \ # && sed -i 's/security.debian.org/mirrors.163.com/g' /etc/apt/sources.list \
&& apt update \ RUN apt update \
&& apt-get install g++ wget zip unzip -y \ && apt-get install g++ wget zip unzip -y \
&& apt-get install libssl-dev openssl libmariadb-dev -y \ && apt-get install libssl-dev openssl libmariadb-dev -y \
&& apt-get clean \ && apt-get clean \

@ -1,252 +0,0 @@
[
{
"model": "api.price",
"pk": 1,
"fields": {
"name": "1k_times",
"title": "1k_times",
"description": "1k_times",
"price": 2500,
"package_size": 1000,
"download_count_gift": 100,
"is_enable": true,
"updated_time": "2021-05-25T16:22:23.744"
}
},
{
"model": "api.price",
"pk": 2,
"fields": {
"name": "10k_times",
"title": "10k_times",
"description": "10k_times",
"price": 22000,
"package_size": 10000,
"download_count_gift": 800,
"is_enable": true,
"updated_time": "2021-05-25T16:22:35.404"
}
},
{
"model": "api.price",
"pk": 3,
"fields": {
"name": "100k_times",
"title": "100k_times",
"description": "100k_times",
"price": 200000,
"package_size": 100000,
"download_count_gift": 8000,
"is_enable": true,
"updated_time": "2021-05-25T16:22:43.995"
}
},
{
"model": "api.domaincnameinfo",
"pk": 1,
"fields": {
"domain_record": "d.ashort.top",
"ip_address": "d.ashort.top.w.kunlunsl.com",
"is_enable": true,
"is_system": true,
"is_https": false,
"description": "d.ashort.top \u7cfb\u7edf\u81ea\u5e26\u57df\u540d\uff0c\u672a\u5907\u6848\uff0c\u56fd\u5916\u52a0\u901f\uff0c\u7528\u4e0e\u4e0b\u8f7d\u9875\u8df3\u8f6c\u57df\u540d",
"created_time": "2021-05-21T21:25:33"
}
},
{
"model": "api.domaincnameinfo",
"pk": 2,
"fields": {
"domain_record": "d.bshort.top",
"ip_address": "d.bshort.top.w.kunlunsl.com",
"is_enable": true,
"is_system": true,
"is_https": false,
"description": "d.bshort.top \u7cfb\u7edf\u81ea\u5e26\u57df\u540d\uff0c\u672a\u5907\u6848\uff0c\u56fd\u5916\u52a0\u901f\uff0c\u7528\u4e0e\u4e0b\u8f7d\u9875\u8df3\u8f6c\u57df\u540d",
"created_time": "2021-05-21T21:25:33"
}
},
{
"model": "api.domaincnameinfo",
"pk": 3,
"fields": {
"domain_record": "d.cshort.top",
"ip_address": "d.cshort.top.w.kunlunsl.com",
"is_enable": true,
"is_system": true,
"is_https": false,
"description": "d.cshort.top \u7cfb\u7edf\u81ea\u5e26\u57df\u540d\uff0c\u672a\u5907\u6848\uff0c\u56fd\u5916\u52a0\u901f\uff0c\u7528\u4e0e\u4e0b\u8f7d\u9875\u8df3\u8f6c\u57df\u540d",
"created_time": "2021-05-21T21:25:33"
}
},
{
"model": "api.domaincnameinfo",
"pk": 4,
"fields": {
"domain_record": "d.eshort.top",
"ip_address": "d.eshort.top.w.kunlunsl.com",
"is_enable": true,
"is_system": true,
"is_https": false,
"description": "d.eshort.top \u7cfb\u7edf\u81ea\u5e26\u57df\u540d\uff0c\u672a\u5907\u6848\uff0c\u56fd\u5916\u52a0\u901f\uff0c\u7528\u4e0e\u4e0b\u8f7d\u9875\u8df3\u8f6c\u57df\u540d",
"created_time": "2021-05-21T21:25:33"
}
},
{
"model": "api.domaincnameinfo",
"pk": 5,
"fields": {
"domain_record": "234bfdd02542cf838cff76b9.dshort.top",
"ip_address": "47.241.30.190",
"is_enable": true,
"is_system": false,
"is_https": false,
"description": "",
"created_time": "2021-05-25T16:10:37.180"
}
},
{
"model": "api.domaincnameinfo",
"pk": 6,
"fields": {
"domain_record": "03d9108cf7caf79ba2667a94.dshort.top",
"ip_address": "47.241.30.190",
"is_enable": true,
"is_system": false,
"is_https": false,
"description": "",
"created_time": "2021-05-25T16:14:17.624"
}
},
{
"model": "api.domaincnameinfo",
"pk": 7,
"fields": {
"domain_record": "e61cc922e0227d4febfdd681.fshort.top",
"ip_address": "47.241.30.190",
"is_enable": true,
"is_system": false,
"is_https": false,
"description": "",
"created_time": "2021-05-25T16:16:17.067"
}
},
{
"model": "api.domaincnameinfo",
"pk": 8,
"fields": {
"domain_record": "93bab80713ed87897d30e4db.fshort.top",
"ip_address": "47.241.30.190",
"is_enable": true,
"is_system": false,
"is_https": false,
"description": "",
"created_time": "2021-05-25T16:16:25.248"
}
},
{
"model": "api.domaincnameinfo",
"pk": 9,
"fields": {
"domain_record": "b1cf45592f107520a29475dc.eshort.top",
"ip_address": "47.241.30.190",
"is_enable": true,
"is_system": false,
"is_https": false,
"description": "",
"created_time": "2021-05-25T16:36:38.244"
}
},
{
"model": "api.domaincnameinfo",
"pk": 10,
"fields": {
"domain_record": "a897858c4775a288f99dd55e.eshort.top",
"ip_address": "47.241.30.190",
"is_enable": true,
"is_system": false,
"is_https": false,
"description": "",
"created_time": "2021-05-25T16:36:44.967"
}
},
{
"model": "api.domaincnameinfo",
"pk": 11,
"fields": {
"domain_record": "2f717ce5b6d2ad8bc8216808.ashort.top",
"ip_address": "47.241.30.190",
"is_enable": true,
"is_system": false,
"is_https": false,
"description": "",
"created_time": "2021-05-25T16:37:38.661"
}
},
{
"model": "api.domaincnameinfo",
"pk": 12,
"fields": {
"domain_record": "051466b64caf72a2de466400.ashort.top",
"ip_address": "47.241.30.190",
"is_enable": true,
"is_system": false,
"is_https": false,
"description": "",
"created_time": "2021-05-25T16:37:43.715"
}
},
{
"model": "api.domaincnameinfo",
"pk": 13,
"fields": {
"domain_record": "eb7a92ce0b9c613f2dead7d4.bshort.top",
"ip_address": "47.241.30.190",
"is_enable": true,
"is_system": false,
"is_https": false,
"description": "",
"created_time": "2021-05-25T16:38:32.069"
}
},
{
"model": "api.domaincnameinfo",
"pk": 14,
"fields": {
"domain_record": "798c2576b649ce38bdc16eb3.bshort.top",
"ip_address": "47.241.30.190",
"is_enable": true,
"is_system": false,
"is_https": false,
"description": "",
"created_time": "2021-05-25T16:38:36.919"
}
},
{
"model": "api.domaincnameinfo",
"pk": 15,
"fields": {
"domain_record": "42ff0f107683baf335162f78.cshort.top",
"ip_address": "47.241.30.190",
"is_enable": true,
"is_system": false,
"is_https": false,
"description": "",
"created_time": "2021-05-25T16:39:18.063"
}
},
{
"model": "api.domaincnameinfo",
"pk": 16,
"fields": {
"domain_record": "8fc3c8b4cc987c235a68b347.cshort.top",
"ip_address": "47.241.30.190",
"is_enable": true,
"is_system": false,
"is_https": false,
"description": "",
"created_time": "2021-05-25T16:39:23.235"
}
}
]
Loading…
Cancel
Save