From 753b2a86ce479bf9878a085606fcf0b4de65ddd2 Mon Sep 17 00:00:00 2001 From: "13621160019@163.com" <13621160019@163.com> Date: Fri, 5 Nov 2021 17:52:22 +0800 Subject: [PATCH] added installation on docker to README --- myems-aggregation/README.md | 52 +++++++++++++++++++++++++++------ myems-api/README.md | 8 ++++-- myems-cleaning/README.md | 54 ++++++++++++++++++++++++++--------- myems-normalization/README.md | 51 +++++++++++++++++++++++++++------ 4 files changed, 133 insertions(+), 32 deletions(-) diff --git a/myems-aggregation/README.md b/myems-aggregation/README.md index 785cd111..e0e3a1aa 100644 --- a/myems-aggregation/README.md +++ b/myems-aggregation/README.md @@ -1,24 +1,60 @@ -## MyEMS Aggregation Service 数据汇总服务 +## myems-aggregation -### Introduction +MyEMS Aggregation Service -This service is a component of MyEMS and it aggregates normalized data up to multiple dimensions. +数据汇总服务 -### Prerequisites +## Introduction + +This service is a component of MyEMS. It aggregates normalized data up to multiple dimensions. + +## Prerequisites mysql-connector-python python-decouple -### Quick Run for Development + +## Quick Run for Development ```bash +cd myems/myems-aggregation pip install -r requirements.txt +cp example.env .env chmod +x run.sh -run.sh +./run.sh ``` -### Installation +## Installation + +### Option 1: Install myems-aggregation on Docker + +In this section, you will install myems-aggregation on Docker. + +* Copy example.env file to .env file and modify the .env file + +```bash +cd myems/myems-aggregation +cp example.env .env +``` +* Build a Docker image +```bash +docker build -t myems/myems-aggregation . +``` +* Run a Docker container +```bash +docker run -d --restart always --name myems-aggregation myems/myems-aggregation +``` + +-d Run container in background and print container ID + +--restart Restart policy to apply when a container exits + +--name Assign a name to the container + +### Option 2: Install myems-aggregation on Ubuntu Server (bare-metal or virtual machine) + +In this section, you will install myems-aggregation on Ubuntu Server. Download and install MySQL Connector: ```bash @@ -45,7 +81,7 @@ cd myems git checkout master (or the latest release tag) cp -R ~/myems/myems-aggregation /myems-aggregation ``` -Create .env file based on example.env and edit the .env file if needed: +Copy exmaple.env file to .env and modify the .env file: ```bash cp /myems-aggregation/example.env /myems-aggregation/.env nano /myems-aggregation/.env diff --git a/myems-api/README.md b/myems-api/README.md index 4c15c48d..9b2e82dc 100644 --- a/myems-api/README.md +++ b/myems-api/README.md @@ -39,7 +39,9 @@ chmod +x run.sh ./run.sh ``` -## Install myems-api on Docker +## Installation + +### Option 1: Install myems-api on Docker In this section, you will install myems-api on Docker. @@ -67,7 +69,7 @@ docker run -d -p 8000:8000 --restart always --name myems-api myems/myems-api --name Assign a name to the container -## Install myems-api on Ubuntu Server +### Option 2: Install myems-api on Ubuntu Server (bare-metal or virtual machine) In this section, you will install myems-api on Ubuntu Server. @@ -208,7 +210,7 @@ systemctl start myems-api.socket systemctl start myems-api.service ``` -## Install myems-api on macOS +### Option 3: Install myems-api on macOS Please refer to [Installation on macOS (Chinese)](./installation_macos_zh.md) diff --git a/myems-cleaning/README.md b/myems-cleaning/README.md index 8261ce68..5058630e 100644 --- a/myems-cleaning/README.md +++ b/myems-cleaning/README.md @@ -3,11 +3,11 @@ MyEMS Cleaning Service MyEMS 数据清洗服务 -### Introduction +## Introduction -This service is a component of MyEMS and it cleans the historical data. +This service is a component of MyEMS. It cleans the historical data. -### Prerequisites +## Prerequisites mysql-connector-python @@ -15,15 +15,47 @@ schedule python-decouple -### Quick Run for Development +## Quick Run for Development ```bash +cd myems/myems-cleaning pip install -r requirements.txt +cp example.env .env chmod +x run.sh -run.sh +./run.sh ``` -### Installation - +## Installation + +### Option 1: Install myems-cleaning on Docker + +In this section, you will install myems-cleaning on Docker. + +* Copy example.env file to .env file and modify the .env file + +```bash +cd myems/myems-cleaning +cp example.env .env +``` +* Build a Docker image +```bash +docker build -t myems/myems-cleaning . +``` +* Run a Docker container +```bash +docker run -d --restart always --name myems-cleaning myems/myems-cleaning +``` + +-d Run container in background and print container ID + +--restart Restart policy to apply when a container exits + +--name Assign a name to the container + + +### Option 2: Install myems-cleaning on Ubuntu Server (bare-metal or virtual machine) + +In this section, you will install myems-cleaning on Ubuntu Server. + Download and install MySQL Connector: ```bash cd ~/tools @@ -51,13 +83,9 @@ python3 setup.py install Install myems-cleaning service ```bash -cd ~ -git clone https://github.com/MyEMS/myems.git -cd myems -git checkout master (or the latest release tag) -cp -R ~/myems/myems-cleaning /myems-cleaning +cp -R myems/myems-cleaning /myems-cleaning ``` -Create .env file based on example.env and edit the .env file if needed: +Copy file example.env to .env and edit the .env file: ```bash cp /myems-cleaning/example.env /myems-cleaning/.env nano /myems-cleaning/.env diff --git a/myems-normalization/README.md b/myems-normalization/README.md index e8c7b7ab..b30312ae 100644 --- a/myems-normalization/README.md +++ b/myems-normalization/README.md @@ -1,12 +1,16 @@ -## MyEMS Normalization Service 数据规范化服务 +# myems-normalization -### Introduction +MyEMS Normalization Service -This service is a component of MyEMS and it normalizes energy data in historical database. +数据规范化服务 + +## Introduction + +This service is a component of MyEMS. It normalizes energy data in historical database. ![MyEMS Meter Normalization](../docs/images/meter-normalization.png) -### Prerequisites +## Prerequisites mysql-connector-python @@ -17,15 +21,46 @@ sympy python-decouple -### Quick Run for Development +## Quick Run for Development ```bash +cd myems/myems-normalization pip install -r requirements.txt +cp example.env .env chmod +x run.sh -run.sh +./run.sh ``` -### Installation +## Installation + +### Option 1: Install myems-normalization on Docker + +In this section, you will install myems-normalization on Docker. + +* Copy example.env file to .env file and modify the .env file + +```bash +cd myems/myems-normalization +cp example.env .env +``` +* Build a Docker image +```bash +docker build -t myems/myems-normalization . +``` +* Run a Docker container +```bash +docker run -d --restart always --name myems-normalization myems/myems-normalization +``` + +-d Run container in background and print container ID + +--restart Restart policy to apply when a container exits + +--name Assign a name to the container + +### Option 2: Install myems-normalization on Ubuntu Server (bare-metal or virtual machine) + +In this section, you will install myems-normalization on Ubuntu Server. Download and install MySQL Connector: ```bash @@ -96,7 +131,7 @@ cd myems git checkout master (or the latest release tag) cp -r ~/myems/myems-normalization /myems-normalization ``` -Create .env file based on example.env and edit the .env file if needed: +Copy example.env file to .env file and modify the .env file: ```bash cp /myems-normalization/example.env /myems-normalization/.env nano /myems-normalization/.env