updated bind mount directory of api and adin in docker compose

pull/103/head
13621160019@163.com 2021-12-25 22:39:48 +08:00
parent abadf16516
commit 1c8daa74e8
2 changed files with 18 additions and 8 deletions

View File

@ -71,15 +71,18 @@ cp myems-normalization/example.env myems-normalization/.env
sed -i 's/127.0.0.1/192.168.0.2/g' myems-normalization/.env
```
3.3 测试数据库是否可以正确连接
3.3 修改docker-compose.yml中upload文件夹
如果是Windows主机在api和admin服务中volumes/source使用 c:\upload
如果是Linux主机在api和admin服务中volumes/source使用 /upload
应确保api和admin共享同一主机文件夹。
3.4 验证数据库连接
```
cd myems
python3 myems-api/test_mysql.py
```
注:如果测试通过,继续下一步操作,否则请修改.env配置。
4. Web UI 打包 (Web UI 为React项目需要打包为产品文件)
4. 编译Web UI
```
cd myems/web
@ -94,15 +97,14 @@ cd myems
docker-compose up -d
```
6. 测试
6. 验证
| | 网址 | 结果 |
| ----- | ----------------------- | ---------------- |
| web | 192.168.0.1:80 | 输入账号密码登成功 |
| web | 192.168.0.1:80 | 输入账号密码登成功 |
| admin | 192.168.0.1:8001 | 输入账号密码登录成功 |
| api | 192.168.0.1:8000/version| 返回版本信息 |
如果api测试报错,请确认.env里的数据库IP数据库账号数据库密码是否正确如果不正确请修改.env后执行
如果api报错请确认.env里的数据库IP数据库账号数据库密码是否正确如果不正确请修改.env后执行
```
docker-compose up --build -d
```

View File

@ -3,6 +3,10 @@ services:
api:
build: ./myems-api
command: gunicorn app:api -b 0.0.0.0:8000 --timeout 600 --workers=4
volumes:
- type: bind
source: c:\upload
target: /var/www/html/admin/upload
restart: always
ports:
- "8000:8000"
@ -32,6 +36,10 @@ services:
command: nginx -c /etc/nginx/nginx.conf -g "daemon off;"
healthcheck:
test: [ "CMD","nginx","-t" ]
volumes:
- type: bind
source: c:\upload
target: /var/www/html/admin/upload
restart: always
ports:
- "8001:8001"