Updated Dockfiles

Merge branch 'PR59' into develop
pull/60/head
13621160019@163.com 2021-08-06 17:44:55 +08:00
commit 0b3457d7b9
9 changed files with 139 additions and 19541 deletions

View File

@ -65,15 +65,49 @@ MyEMS项目由下列组件构成:
### Docker Docker-compose 安装 ### Docker Docker-compose 安装
``` ```
# 假定你的本机IP为: 192.168.2.3 MySQL所在IP为: 192.168.2.2
# 步骤一: 克隆仓库
git clone https://gitee.com/myems/myems.git git clone https://gitee.com/myems/myems.git
# for generate the static direction: 'build'
# 步骤二: 修改IP地址
# 你应该修改所有文件夹下中config.py的host为你的本机IP
sudo nano myems-api/config.py
sudo nano myems-aggregation/config.py
sudo nano myems-cleaning/config.py
sudo nano myems-modbus-tcp/config.py
sudo nano myems-normalization/config.py
# host: '127.0.0.1' => 'host': '192.168.2.2', (127.0.0.1 => mysql_ip)
# 你应该修改web,admin下中nginx.conf的127.0.0.1为你的本机IP
sudo nano admin/nginx.conf
sudo nano web/nginx.conf
# proxy_pass http://127.0.0.1:8000/; => proxy_pass http://192.168.2.3:8000/; (127.0.0.1 => local_ip)
# 步骤三: 将'web'打包生成静态文件 (React)
cd myems/web cd myems/web
npm install npm install
npm run build npm run build
# 步骤四: 使用docker-compose安装
cd myems cd myems
docker-compose up -d docker-compose up -d
# 步骤五: 测试是否成功 (use local_ip:192.168.2.3)
谷歌浏览器打开:
web page: http://192.168.2.3:8001 - 用户administrator@myems.io 密码: !MyEMS1
admin page: http://192.168.2.3:8002 - 用户administrator 密码: !MyEMS1
rest api: http://192.168.2.3:8000/spaces
``` ```
## 功能版本对比 ## 功能版本对比

View File

@ -63,6 +63,51 @@ Dieses Projekt besteht aus folgenden Komponenten:
[Installieren web UI](./web/README.md) [Installieren web UI](./web/README.md)
### Docker Docker-compose Installieren
```
# Angenommen, Ihre lokale IP: 192.168.2.3 und mysql IP: 192.168.2.2
# Schritt 01: Klon
git clone https://gitee.com/myems/myems.git
# Schritt 02: Ändern Sie die IP (mysql_ip: 192.168.2.2)
# Sie sollten den Host von config.py:
sudo nano myems-api/config.py
sudo nano myems-aggregation/config.py
sudo nano myems-cleaning/config.py
sudo nano myems-modbus-tcp/config.py
sudo nano myems-normalization/config.py
# host: '127.0.0.1' => 'host': '192.168.2.2', (127.0.0.1 => mysql_ip)
# Sie sollten den proxy_pass von nginx.conf:
sudo nano admin/nginx.conf
sudo nano web/nginx.conf
# proxy_pass http://127.0.0.1:8000/; => proxy_pass http://192.168.2.3:8000/; (127.0.0.1 => local_ip)
# Schritt 03: Generieren Sie die statische Richtung: 'build' for web (react)
cd myems/web
npm install
npm run build
# Schritt 04: Installieren
cd myems
docker-compose up -d
# Schritt 05: Prüfen (lokale ip: 192.168.2.3)
# mit dem Google-Browser öffnen
web: http://192.168.2.3:8001 - Benutzeradministrator@myems.io Passwort !MyEMS1
admin: http://192.168.2.3:8002 - Benutzeradministrator Passwort !MyEMS1
api: http://192.168.2.3:8000/spaces
```
### Docker Docker-compose ### Docker Docker-compose
``` ```

View File

@ -76,6 +76,53 @@ cd myems
docker-compose up -d docker-compose up -d
``` ```
### Docker Docker-compose Install
```
# Supposed that your local ip is: 192.168.2.3 and mysql ip is: 192.168.2.2
# Step 01: Clone
git clone https://gitee.com/myems/myems.git
# Step 02: Modify the ip (use mysql_ip: 192.168.2.2)
# You should modify the host of config.py in these directions:
sudo nano myems-api/config.py
sudo nano myems-aggregation/config.py
sudo nano myems-cleaning/config.py
sudo nano myems-modbus-tcp/config.py
sudo nano myems-normalization/config.py
# host: '127.0.0.1' => 'host': '192.168.2.2', (127.0.0.1 => mysql_ip)
# You should modify the proxy_pass of nginx.conf in these directions:
sudo nano admin/nginx.conf
sudo nano web/nginx.conf
# proxy_pass http://127.0.0.1:8000/; => proxy_pass http://192.168.2.3:8000/; (127.0.0.1 => local_ip)
# Step 03: Generate the static direction: 'build' for web (react)
cd myems/web
npm install
npm run build
# Step 04: Install
cd myems
docker-compose up -d
# Step 05: Test (use local_ip: 192.168.2.3)
# open with the google browser
web page: http://192.168.2.3:8001 - useradministrator@myems.io password !MyEMS1
admin page: http://192.168.2.3:8002 - useradministrator password !MyEMS1
rest api: http://192.168.2.3:8000/spaces
```
## Compare Editions ## Compare Editions
| Features | Community Edition | Enterprise Edition | Explanation | | Features | Community Edition | Enterprise Edition | Explanation |

1
admin/Dockerfile vendored
View File

@ -8,4 +8,5 @@ RUN rm /etc/nginx/conf.d/default.conf && \
# copy the config and web codes # copy the config and web codes
COPY nginx.conf /etc/nginx/ COPY nginx.conf /etc/nginx/
COPY . /usr/share/nginx/admin COPY . /usr/share/nginx/admin
EXPOSE 80
CMD ['nginx', '-c /etc/nginx/nginx.conf', '-g "daemon off;"'] CMD ['nginx', '-c /etc/nginx/nginx.conf', '-g "daemon off;"']

2
admin/nginx.conf vendored
View File

@ -26,7 +26,7 @@ http {
keepalive_timeout 65; keepalive_timeout 65;
server { server {
listen 8001; listen 80;
server_name localhost; server_name localhost;
#access_log /var/log/nginx/host.access.log main; #access_log /var/log/nginx/host.access.log main;

View File

@ -3,31 +3,28 @@ services:
api: api:
build: ./myems-api build: ./myems-api
command: gunicorn app:api -b 0.0.0.0:8000 command: gunicorn app:api -b 0.0.0.0:8000
network_mode: "host"
restart: always restart: always
ports:
- "8000:8000"
aggregation: aggregation:
build: ./myems-aggregation build: ./myems-aggregation
command: python main.py command: python main.py
network_mode: "host"
restart: always restart: always
cleaning: cleaning:
build: ./myems-cleaning build: ./myems-cleaning
command: python main.py command: python main.py
network_mode: "host"
restart: always restart: always
modbus_tcp: modbus_tcp:
build: ./myems-modbus-tcp build: ./myems-modbus-tcp
command: python main.py command: python main.py
network_mode: "host"
restart: always restart: always
normalization: normalization:
build: ./myems-normalization build: ./myems-normalization
command: python main.py command: python main.py
network_mode: "host"
restart: always restart: always
admin: admin:
@ -35,13 +32,14 @@ services:
command: nginx -c /etc/nginx/nginx.conf -g "daemon off;" command: nginx -c /etc/nginx/nginx.conf -g "daemon off;"
healthcheck: healthcheck:
test: [ "CMD","nginx","-t" ] test: [ "CMD","nginx","-t" ]
network_mode: "host"
restart: always restart: always
ports:
- "8001:80"
web: web:
build: ./web build: ./web
command: nginx -c /etc/nginx/nginx.conf -g "daemon off;" command: nginx -c /etc/nginx/nginx.conf -g "daemon off;"
healthcheck: healthcheck:
test: [ "CMD","nginx","-t" ] test: [ "CMD","nginx","-t" ]
network_mode: "host" restart: always
restart: always ports:
- "8002:80"

View File

@ -3,4 +3,5 @@ WORKDIR /code
COPY . /code COPY . /code
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
EXPOSE 8000
CMD ['gunicorn', 'app:api', '-b 0.0.0.0:8000'] CMD ['gunicorn', 'app:api', '-b 0.0.0.0:8000']

3
web/Dockerfile vendored
View File

@ -9,5 +9,6 @@ RUN rm /etc/nginx/conf.d/default.conf && \
# Attention: # Attention:
# You should run 'npm run build' in the web direction to generate the build direction because this's a react projection. # You should run 'npm run build' in the web direction to generate the build direction because this's a react projection.
COPY nginx.conf /etc/nginx/ COPY nginx.conf /etc/nginx/
COPY . /usr/share/nginx/web COPY ./build/ /usr/share/nginx/web
EXPOSE 80
CMD ['nginx', '-c /etc/nginx/nginx.conf', '-g "daemon off;"'] CMD ['nginx', '-c /etc/nginx/nginx.conf', '-g "daemon off;"']

19529
web/package-lock.json generated vendored

File diff suppressed because it is too large Load Diff