updated README for Docker

Merge branch 'develop'
pull/64/head
13621160019@163.com 2021-08-06 18:47:21 +08:00
commit 906eb79c9d
10 changed files with 102 additions and 19570 deletions

View File

@ -42,10 +42,6 @@ MyEMS项目由下列组件构成:
[安装 myems-modbus-tcp](./myems-modbus-tcp/README.md)
### MyEMS MQTT数据转发服务 (Python)
[安装 myems-mqtt-publisher](./myems-mqtt-publisher/README.md)
### MyEMS 数据清洗服务 (Python)
[安装 myems-cleaning](./myems-cleaning/README.md)
@ -64,14 +60,39 @@ MyEMS项目由下列组件构成:
### Docker Docker-compose 安装
```
git clone https://gitee.com/myems/myems.git
```
# for generate the static direction: 'build'
修改以下文件中的数据库IP
假定数据库IP为: 192.168.2.2
```
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'
```
修改web和admin文件夹下nginx.conf中的location '/api'
假定本机IP为: 192.168.2.3
```
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/;
```
将Web打包生成产品文件
```
cd myems/web
npm install
npm run build
```
使用docker-compose安装
```
cd myems
docker-compose up -d
```

View File

@ -43,10 +43,6 @@ Dieses Projekt besteht aus folgenden Komponenten:
[Installieren myems-modbus-tcp](./myems-modbus-tcp/README.md)
### MyEMS MQTT Data vorwärts Service (Python)
[Installieren myems-mqtt-publisher](./myems-mqtt-publisher/README.md)
### MyEMS Cleaning Service (Python)
[Installieren myems-cleaning](./myems-cleaning/README.md)
@ -63,16 +59,40 @@ Dieses Projekt besteht aus folgenden Komponenten:
[Installieren web UI](./web/README.md)
### Docker Docker-compose Installieren
### Docker Docker-compose
```
git clone https://gitee.com/myems/myems.git
```
# for generate the static direction: 'build'
Ändern Sie die Datenbankkonfiguration in den folgenden Dateien
Angenommen, die Datenbank-IP lautet 192.168.2.2
```
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'
```
Ändern Sie den location '/api' von nginx.conf in web und admin
Angenommen, die Host-IP lautet 192.168.2.3
```
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/;
```
Verpacken Sie das web, um Produktdateien zu generieren
```
cd myems/web
npm install
npm run build
```
Mit docker-compose installieren
```
cd myems
docker-compose up -d
```

View File

@ -43,10 +43,6 @@ This project is compose of following components:
[Install myems-modbus-tcp](./myems-modbus-tcp/README.md)
### MyEMS MQTT Data Forwarding Service (Python)
[Install myems-mqtt-publisher](./myems-mqtt-publisher/README.md)
### MyEMS Cleaning Service (Python)
[Install myems-cleaning](./myems-cleaning/README.md)
@ -64,14 +60,39 @@ This project is compose of following components:
[Install web UI](./web/README.md)
### Docker Docker-compose
```
git clone https://gitee.com/myems/myems.git
```
# for generate the static direction: 'build'
修改文件夹下config.py中的host为数据库IP
假定数据库IP为: 192.168.2.2
```
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'
```
修改web,admin下中nginx.conf的127.0.0.1为本机IP
假定本机IP为: 192.168.2.3
```
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/;
```
将Web打包生成产品文件
```
cd myems/web
npm install
npm run build
```
使用docker-compose安装
```
cd myems
docker-compose up -d
```

5
admin/Dockerfile vendored
View File

@ -3,9 +3,10 @@ FROM nginx
# remove the config
RUN rm /etc/nginx/conf.d/default.conf && \
rm /etc/nginx/nginx.conf && \
mkdir -p /usr/share/nginx/admin
mkdir -p /var/www/html/admin
# copy the config and web codes
COPY nginx.conf /etc/nginx/
COPY . /usr/share/nginx/admin
COPY . /var/www/html/admin
EXPOSE 8001
CMD ['nginx', '-c /etc/nginx/nginx.conf', '-g "daemon off;"']

6
admin/nginx.conf vendored
View File

@ -27,12 +27,12 @@ http {
server {
listen 8001;
server_name localhost;
server_name myems-admin;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/admin;
root /var/www/html/admin;
index index.html index.htm;
}
@ -42,7 +42,7 @@ http {
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
root /var/www/html/admin;
}
location /api {

View File

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

View File

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

9
web/Dockerfile vendored
View File

@ -3,11 +3,10 @@ FROM nginx
# remove the config
RUN rm /etc/nginx/conf.d/default.conf && \
rm /etc/nginx/nginx.conf && \
mkdir -p /usr/share/nginx/web
mkdir -p /var/www/html/web
# copy the config and web codes
# Attention:
# You should run 'npm run build' in the web direction to generate the build direction because this's a react projection.
# Note: You should run 'npm run build' in the web direction to generate the production build.
COPY nginx.conf /etc/nginx/
COPY . /usr/share/nginx/web
COPY ./build/ /var/www/html/web
EXPOSE 80
CMD ['nginx', '-c /etc/nginx/nginx.conf', '-g "daemon off;"']

6
web/nginx.conf vendored
View File

@ -26,12 +26,12 @@ http {
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
server_name myems-web;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/web;
root /var/www/html/web;
index index.html index.htm;
}
@ -41,7 +41,7 @@ http {
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
root /var/www/html/web;
}
location /api {

19529
web/package-lock.json generated vendored

File diff suppressed because it is too large Load Diff