updated docker instruction in README

pull/139/head
13621160019@163.com 2022-04-03 09:30:12 +08:00
parent 47b954346a
commit 9e1c35bcb4
9 changed files with 65 additions and 43 deletions

View File

@ -4,9 +4,7 @@ services:
build: ./myems-api
command: gunicorn app:api -b 0.0.0.0:8000 --timeout 600 --workers=4
volumes:
- type: bind
source: /upload
target: /var/www/myems-admin/upload
- /myems-upload:/var/www/myems-admin/upload
restart: always
ports:
- "8000:8000"
@ -37,9 +35,7 @@ services:
healthcheck:
test: [ "CMD","nginx","-t" ]
volumes:
- type: bind
source: /upload
target: /var/www/myems-admin/upload
- /myems-upload:/var/www/myems-admin/upload
restart: always
ports:
- "8001:8001"

View File

@ -4,9 +4,7 @@ services:
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/myems-admin/upload
- c:\myems-upload:/var/www/myems-admin/upload
restart: always
ports:
- "8000:8000"
@ -37,9 +35,7 @@ services:
healthcheck:
test: [ "CMD","nginx","-t" ]
volumes:
- type: bind
source: c:\upload
target: /var/www/myems-admin/upload
- c:\myems-upload:/var/www/myems-admin/upload
restart: always
ports:
- "8001:8001"

View File

@ -43,25 +43,29 @@ docker build -t myems/myems-admin .
```
* Run a Docker container
If run on Windows host, bind-mount a share upload file folder at c:\myems-upload to the container and also bind-mount nginx.conf
-v parameter for upload folder must be same with that in myems-api
```bash
docker run -d -p 8001:8001 -v c:\myems-upload:/var/www/myems-admin/upload -v c:\myems-admin/nginx.conf:/etc/nginx/nginx.conf --restart always --name myems-admin myems/myems-admin
docker run -d -p 8001:8001 -v c:\myems-upload:/var/www/myems-admin/upload -v c:\myems-admin/nginx.conf:/etc/nginx/nginx.conf:ro --restart always --name myems-admin myems/myems-admin
```
If run on Linux host, bind-mount a share upload file folder at /myems-upload to the container and also bind-mount nginx.conf
```bash
docker run -d -p 8001:8001 -v /myems-upload:/var/www/myems-admin/upload -v /myems-admin/nginx.conf:/etc/nginx/nginx.conf --restart always --name myems-admin myems/myems-admin
docker run -d -p 8001:8001 -v /myems-upload:/var/www/myems-admin/upload -v /myems-admin/nginx.conf:/etc/nginx/nginx.conf:ro --restart always --name myems-admin myems/myems-admin
```
-d Run container in background and print container ID
* -d Run container in background and print container ID
-p Publish a container's port(s) to the host, 8001:8001 (Host:Container) binds port 8001 (right) of the container to TCP port 8001 (left) of the host machine.
* -p Publish a container's port(s) to the host, 8001:8001 (Host:Container) binds port 8001 (right) of the container to
TCP port 8001 (left) of the host machine.
-v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, -v creates the endpoint for you. It is always created as a directory.
* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host,
-v creates the endpoint for you. It is always created as a directory.
The ro option, if present, causes the bind mount to be mounted into the container as read-only.
--restart Restart policy to apply when a container exits
* --restart Restart policy to apply when a container exits
--name Assign a name to the container
* --name Assign a name to the container
If you want to immigrate the image to another computer,
* Export image to tarball file

View File

@ -56,17 +56,20 @@ cp example.env .env
docker build -t myems/myems-aggregation .
```
* Run a Docker container
On Windows host, bind-mount the .env to the container:
```bash
docker run -d -v c:\myems-aggregation\.env:/code/.env --restart always --name myems-aggregation myems/myems-aggregation
docker run -d -v c:\myems-aggregation\.env:/code/.env:ro --restart always --name myems-aggregation myems/myems-aggregation
```
On Linux host, bind-mount the .env to the container:
```bash
docker run -d -v /myems-aggregation/.env:/code/.env --restart always --name myems-aggregation myems/myems-aggregation
docker run -d -v /myems-aggregation/.env:/code/.env:ro --restart always --name myems-aggregation myems/myems-aggregation
```
* -d Run container in background and print container ID
* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, -v creates the endpoint for you. It is always created as a directory.
* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host,
-v creates the endpoint for you. It is always created as a directory.
The ro option, if present, causes the bind mount to be mounted into the container as read-only.
* --restart Restart policy to apply when a container exits

View File

@ -92,22 +92,26 @@ docker build -t myems/myems-api .
```
* Run a Docker container
On Windows host, bind-mount a share upload folder at c:\myems-upload to the container,
and also bind-mount the .env to the container:
```bash
docker run -d -p 8000:8000 -v c:\myems-upload:/var/www/myems-admin/upload -v c:\myems-api\.env:/code/.env --restart always --name myems-api myems/myems-api
docker run -d -p 8000:8000 -v c:\myems-upload:/var/www/myems-admin/upload -v c:\myems-api\.env:/code/.env:ro --restart always --name myems-api myems/myems-api
```
On Linux host, bind-mount a share upload file folder at /myems-upload to the container,
and also bind-mount the .env to the container:
```bash
docker run -d -p 8000:8000 -v /myems-upload:/var/www/myems-admin/upload -v /myems-api/.env:/code/.env --restart always --name myems-api myems/myems-api
docker run -d -p 8000:8000 -v /myems-upload:/var/www/myems-admin/upload -v /myems-api/.env:/code/.env:ro --restart always --name myems-api myems/myems-api
```
* -d Run container in background and print container ID
* -p Publish a container's port(s) to the host, 8000:8000 (Host:Container) binds port 8000 (right) of the container to TCP port 8000 (left) of the host machine.
* -p Publish a container's port(s) to the host, 8000:8000 (Host:Container) binds port 8000 (right) of the container to
TCP port 8000 (left) of the host machine.
* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, -v creates the endpoint for you. It is always created as a directory.
* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host,
-v creates the endpoint for you. It is always created as a directory.
The ro option, if present, causes the bind mount to be mounted into the container as read-only.
* --restart Restart policy to apply when a container exits

View File

@ -55,17 +55,20 @@ cp example.env .env
docker build -t myems/myems-cleaning .
```
* Run a Docker container
On Windows host, bind-mount the .env to the container:
```bash
docker run -d -v c:\myems-cleaning\.env:/code/.env --restart always --name myems-cleaning myems/myems-cleaning
docker run -d -v c:\myems-cleaning\.env:/code/.env:ro --restart always --name myems-cleaning myems/myems-cleaning
```
On Linux host, bind-mount the .env to the container:
```bash
docker run -d -v /myems-cleaning/.env:/code/.env --restart always --name myems-cleaning myems/myems-cleaning
docker run -d -v /myems-cleaning/.env:/code/.env:ro --restart always --name myems-cleaning myems/myems-cleaning
```
* -d Run container in background and print container ID
* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, -v creates the endpoint for you. It is always created as a directory.
* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host,
-v creates the endpoint for you. It is always created as a directory.
The ro option, if present, causes the bind mount to be mounted into the container as read-only.
* --restart Restart policy to apply when a container exits

View File

@ -1,6 +1,7 @@
## MyEMS Modbus TCP Service
### Introduction
This service is a component of MyEMS Community Edition to acquire data from Modbus TCP devices.
### Prerequisites
@ -55,17 +56,20 @@ cp example.env .env
docker build -t myems/myems-modbus-tcp .
```
* Run a Docker container
On Windows host, bind-mount the .env to the container:
```bash
docker run -d -v c:\myems-modbus-tcp\.env:/code/.env --restart always --name myems-modbus-tcp myems/myems-modbus-tcp
docker run -d -v c:\myems-modbus-tcp\.env:/code/.env:ro --restart always --name myems-modbus-tcp myems/myems-modbus-tcp
```
On Linux host, bind-mount the .env to the container:
```bash
docker run -d -v /myems-modbus-tcp/.env:/code/.env --restart always --name myems-modbus-tcp myems/myems-modbus-tcp
docker run -d -v /myems-modbus-tcp/.env:/code/.env:ro --restart always --name myems-modbus-tcp myems/myems-modbus-tcp
```
* -d Run container in background and print container ID
* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, -v creates the endpoint for you. It is always created as a directory.
* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host,
-v creates the endpoint for you. It is always created as a directory.
The ro option, if present, causes the bind mount to be mounted into the container as read-only.
* --restart Restart policy to apply when a container exits

View File

@ -51,7 +51,9 @@ cp -r myems/myems-normalization /
cd /myems-normalization
```
* Duplicate example.env file as .env file and modify the .env file
* Create .env file
Duplicate example.env file as .env file and modify the .env file
Replace ~~127.0.0.1~~ with real **HOST** IP address.
```bash
cp example.env .env
@ -62,17 +64,20 @@ cp example.env .env
docker build -t myems/myems-normalization .
```
* Run a Docker container
On Windows host, bind-mount the .env to the container:
```bash
docker run -d -v c:\myems-normalization\.env:/code/.env --restart always --name myems-normalization myems/myems-normalization
docker run -d -v c:\myems-normalization\.env:/code/.env:ro --restart always --name myems-normalization myems/myems-normalization
```
On Linux host, bind-mount the .env to the container:
```bash
docker run -d -v /myems-normalization/.env:/code/.env --restart always --name myems-normalization myems/myems-normalization
docker run -d -v /myems-normalization/.env:/code/.env:ro --restart always --name myems-normalization myems/myems-normalization
```
* -d Run container in background and print container ID
* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, -v creates the endpoint for you. It is always created as a directory.
* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host,
-v creates the endpoint for you. It is always created as a directory.
The ro option, if present, causes the bind mount to be mounted into the container as read-only.
* --restart Restart policy to apply when a container exits

View File

@ -1,6 +1,7 @@
# myems-web
## Introduction
Web用户界面用于MyEMS能源数据可视化
Web UI for MyEMS energy data visualization
@ -13,6 +14,7 @@ Node.js 17.0.0 or later
## Running in Local Environment for Development
* Install Node.js via binary archive on Linux
Download Current Linux Binaries (x64) from https://nodejs.org/en/download/current/
```bash
@ -25,7 +27,6 @@ sudo ln -s /usr/local/lib/nodejs/node-vxx.x.x-linux-x64/bin/npx /usr/bin/npx
Download the latest current version Windows installer (.msi) 64-bit from https://nodejs.org/en/download/current/
Install Node.js with Setup Wizard
Test installation
```bash
node -v
@ -90,22 +91,28 @@ docker build -t myems/myems-web .
```
* Run a Docker container
If run on Windows host, bind-mount nginx.conf to the container
```bash
docker run -d -p 80:80 -v c:\myems-web/nginx.conf:/etc/nginx/nginx.conf --restart always --name myems-web myems/myems-web
docker run -d -p 80:80 -v c:\myems-web/nginx.conf:/etc/nginx/nginx.conf:ro --restart always --name myems-web myems/myems-web
```
If run on Linux host, bind-mount nginx.conf
```bash
docker run -d -p 80:80 -v /myems-web/nginx.conf:/etc/nginx/nginx.conf --restart always --name myems-web myems/myems-web
docker run -d -p 80:80 -v /myems-web/nginx.conf:/etc/nginx/nginx.conf:ro --restart always --name myems-web myems/myems-web
```
-d Run container in background and print container ID
* -d Run container in background and print container ID
-p Publish a container's port(s) to the host, 80:80 (Host:Container) binds port 80 (right) of the container to TCP port 80 (left) of the host machine.
* -p Publish a container's port(s) to the host, 80:80 (Host:Container) binds port 80 (right) of the container to
TCP port 80 (left) of the host machine.
--restart Restart policy to apply when a container exits
* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host,
-v creates the endpoint for you. It is always created as a directory.
The ro option, if present, causes the bind mount to be mounted into the container as read-only.
--name Assign a name to the container
* --restart Restart policy to apply when a container exits
* --name Assign a name to the container
If you want to immigrate the image to another computer,
* Export image to tarball file