updated upload folder path
parent
90e097306f
commit
56588a7c0d
|
@ -1,10 +1,12 @@
|
||||||
# myems-admin
|
# myems-admin
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
系统管理用户界面,用于MyEMS系统配置
|
系统管理用户界面,用于MyEMS系统配置
|
||||||
Providing Admin UI for MyEMS system settings
|
Admin UI for MyEMS system settings
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
nginx-1.18.0 or later
|
nginx-1.18.0 or later
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ FROM python:slim
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
|
|
||||||
# todo: share upload folder with admin container on Docker
|
# todo: share upload folder with admin container on Docker
|
||||||
RUN mkdir -p /var/www/html/admin/upload
|
RUN mkdir -p /var/www/myems-admin/upload
|
||||||
|
|
||||||
COPY . /code
|
COPY . /code
|
||||||
RUN pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
|
RUN pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# MyEMS API Service
|
# MyEMS API Service
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
Providing RESTful API service for [MyEMS](https://github.com/MyEMS/myems) components and third party applications.
|
|
||||||
|
RESTful API service for [MyEMS](https://github.com/MyEMS/myems) components and third party applications.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
|
@ -71,12 +72,12 @@ docker build -t myems/myems-api .
|
||||||
On Windows host, bind-mount a share upload folder at c:\myems-upload to the 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:
|
and also bind-mount the .env to the container:
|
||||||
```bash
|
```bash
|
||||||
docker run -d -p 8000:8000 -v c:\myems-upload:/var/www/html/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 --restart always --name myems-api myems/myems-api
|
||||||
```
|
```
|
||||||
On Linux host, bind-mount a share upload file folder at /myems-upload to the container,
|
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:
|
and also bind-mount the .env to the container:
|
||||||
```bash
|
```bash
|
||||||
docker run -d -p 8000:8000 -v /myems-upload:/var/www/html/admin/upload -v /myems-api/.env:/.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:/.env --restart always --name myems-api myems/myems-api
|
||||||
```
|
```
|
||||||
|
|
||||||
* -d Run container in background and print container ID
|
* -d Run container in background and print container ID
|
||||||
|
|
|
@ -94,9 +94,9 @@ working_day_start_time_local = config('WORKING_DAY_START_TIME_LOCAL', default='0
|
||||||
|
|
||||||
# indicates where user uploaded files will be saved to
|
# indicates where user uploaded files will be saved to
|
||||||
# must use the root folder of myems-admin web application
|
# must use the root folder of myems-admin web application
|
||||||
# for example if you serve myems-admin at /var/www/html/admin
|
# for example if you serve myems-admin at /var/www/myems-admin
|
||||||
# you should set the upload_path as below
|
# you should set the upload_path as below
|
||||||
upload_path = config('UPLOAD_PATH', default='/var/www/html/admin/upload/')
|
upload_path = config('UPLOAD_PATH', default='/var/www/myems-admin/upload/')
|
||||||
|
|
||||||
# main currency unit
|
# main currency unit
|
||||||
currency_unit = config('CURRENCY_UNIT', default='CNY')
|
currency_unit = config('CURRENCY_UNIT', default='CNY')
|
||||||
|
|
|
@ -81,9 +81,9 @@ WORKING_DAY_START_TIME_LOCAL=00:00:00
|
||||||
|
|
||||||
# indicates where user uploaded files will be saved to
|
# indicates where user uploaded files will be saved to
|
||||||
# must use the root folder of myems-admin web application
|
# must use the root folder of myems-admin web application
|
||||||
# for example if you serve myems-admin at /var/www/html/admin
|
# for example if you serve myems-admin at /var/www/myems-admin
|
||||||
# you should set the upload_path as below
|
# you should set the upload_path as below
|
||||||
UPLOAD_PATH=/var/www/html/admin/upload/
|
UPLOAD_PATH=/var/www/myems-admin/upload/
|
||||||
|
|
||||||
# main currency unit
|
# main currency unit
|
||||||
CURRENCY_UNIT=CNY
|
CURRENCY_UNIT=CNY
|
||||||
|
|
|
@ -11,9 +11,9 @@ $ xcode-select --install
|
||||||
然后安装python3
|
然后安装python3
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ brew search python3 //默认安装最新版3.9
|
$ brew search python3 //默认安装最新版3.10
|
||||||
$ python3 -V
|
$ python3 -V
|
||||||
Python 3.9.1 //安装Python3 OK
|
Python 3.10.1 //安装Python3 OK
|
||||||
```
|
```
|
||||||
国内网络可能会出现安装慢的问题,配置下国内的资源镜像
|
国内网络可能会出现安装慢的问题,配置下国内的资源镜像
|
||||||
```shell
|
```shell
|
||||||
|
@ -45,18 +45,20 @@ Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
||||||
|
|
||||||
mysql>
|
mysql>
|
||||||
```
|
```
|
||||||
然后初始化数据库,克隆[myems-database](https://github.com/myems/myems-database)到本地。
|
然后初始化数据库,克隆[myems](https://github.com/myems/myems)到本地。
|
||||||
```shell
|
```shell
|
||||||
$ git clone https://github.com/myems/myems-database.git
|
$ git clone https://github.com/myems/myems.git
|
||||||
$ cd myems-database
|
$ cd myems/myems-database
|
||||||
$ mysql -u root -p密码 //用root登录mysql
|
$ mysql -u root -p密码 //用root登录mysql
|
||||||
mysql>
|
mysql>
|
||||||
source myems_billing_baseline_db.sql
|
source myems_billing_baseline_db.sql
|
||||||
source myems_billing_db.sql
|
source myems_billing_db.sql
|
||||||
|
source myems_carbon_db.sql
|
||||||
source myems_energy_baseline_db.sql
|
source myems_energy_baseline_db.sql
|
||||||
source myems_energy_db.sql
|
source myems_energy_db.sql
|
||||||
source myems_fdd_db.sql
|
source myems_fdd_db.sql
|
||||||
source myems_historical_db.sql
|
source myems_historical_db.sql
|
||||||
|
source myems_production_db.sql
|
||||||
source myems_reporting_db.sql
|
source myems_reporting_db.sql
|
||||||
source myems_system_db.sql
|
source myems_system_db.sql
|
||||||
source myems_user_db.sql
|
source myems_user_db.sql
|
||||||
|
@ -68,10 +70,12 @@ mysql> show databases; // 查看数据库是否导入OK
|
||||||
| information_schema |
|
| information_schema |
|
||||||
| myems_billing_baseline_db |
|
| myems_billing_baseline_db |
|
||||||
| myems_billing_db |
|
| myems_billing_db |
|
||||||
|
| myems_carbon_db |
|
||||||
| myems_energy_baseline_db |
|
| myems_energy_baseline_db |
|
||||||
| myems_energy_db |
|
| myems_energy_db |
|
||||||
| myems_fdd_db |
|
| myems_fdd_db |
|
||||||
| myems_historical_db |
|
| myems_historical_db |
|
||||||
|
| myems_production_db |
|
||||||
| myems_reporting_db |
|
| myems_reporting_db |
|
||||||
| myems_system_db |
|
| myems_system_db |
|
||||||
| myems_user_db |
|
| myems_user_db |
|
||||||
|
@ -135,7 +139,6 @@ $ source ~/.zshrc
|
||||||
|
|
||||||
### 4.运行myems-api服务
|
### 4.运行myems-api服务
|
||||||
```shell
|
```shell
|
||||||
$ git clone https://github.com/kuuyee/myems-api.git
|
|
||||||
$ cd myems/myems-api
|
$ cd myems/myems-api
|
||||||
$ gunicorn -b 0.0.0.0:8000 app:api
|
$ gunicorn -b 0.0.0.0:8000 app:api
|
||||||
[2021-02-16 22:21:46 +0800] [3252] [INFO] Starting gunicorn 20.0.4
|
[2021-02-16 22:21:46 +0800] [3252] [INFO] Starting gunicorn 20.0.4
|
||||||
|
@ -149,11 +152,11 @@ $ gunicorn -b 0.0.0.0:8000 app:api
|
||||||
### 5.验证myems-api服务
|
### 5.验证myems-api服务
|
||||||
|
|
||||||
打开浏览器访问[http://0.0.0.0:8000/version](http://0.0.0.0:8000/version)
|
打开浏览器访问[http://0.0.0.0:8000/version](http://0.0.0.0:8000/version)
|
||||||
如果看到如下输出就表示服务启动正常。
|
如果看到输出版本信息就表示服务启动正常。
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"version": "MyEMS 1.3.2",
|
"version": "MyEMS 1.8.2",
|
||||||
"release-date": "2021-10-22",
|
"release-date": "2022-03-16",
|
||||||
"website": "https://myems.io"
|
"website": "https://myems.io"
|
||||||
}
|
}
|
||||||
```
|
```
|
|
@ -1,8 +1,8 @@
|
||||||
# myems-web
|
# myems-web
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
Web 用户界面,用于能源数据可视化
|
Web用户界面,用于MyEMS能源数据可视化
|
||||||
Providing Web UI for energy data visualization
|
Web UI for MyEMS energy data visualization
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
|
@ -38,11 +38,13 @@ npx -v
|
||||||
cd myems/myems-web
|
cd myems/myems-web
|
||||||
npm i --unsafe-perm=true --allow-root --legacy-peer-deps
|
npm i --unsafe-perm=true --allow-root --legacy-peer-deps
|
||||||
```
|
```
|
||||||
|
|
||||||
* If you modified any scss files then you need to compile SCSS, else you can safely ignore this step.
|
* If you modified any scss files then you need to compile SCSS, else you can safely ignore this step.
|
||||||
Run below command in your project directory to compile scss.
|
Run below command in your project directory to compile scss.
|
||||||
```bash
|
```bash
|
||||||
npm run scss
|
npm run scss
|
||||||
```
|
```
|
||||||
|
|
||||||
* Starting the Development Server
|
* Starting the Development Server
|
||||||
A local web server will start at http://localhost:3000.
|
A local web server will start at http://localhost:3000.
|
||||||
We are using webpack and webpack-serve to automatically detect file changes. So, if you edit and save a file, your browser will automatically refresh and preview the change.
|
We are using webpack and webpack-serve to automatically detect file changes. So, if you edit and save a file, your browser will automatically refresh and preview the change.
|
||||||
|
@ -175,19 +177,21 @@ sudo systemctl restart nginx
|
||||||
|
|
||||||
* Install MyEMS Web UI:
|
* Install MyEMS Web UI:
|
||||||
|
|
||||||
Check and change the config file if necessary:
|
Check and change the config file if necessary:
|
||||||
```bash
|
```bash
|
||||||
cd myems/myems-web
|
cd myems/myems-web
|
||||||
sudo nano src/config.js
|
sudo nano src/config.js
|
||||||
```
|
```
|
||||||
Build and Compress
|
|
||||||
|
Build and Compress
|
||||||
```bash
|
```bash
|
||||||
sudo npm run build
|
sudo npm run build
|
||||||
tar czvf myems-web.tar.gz build
|
tar czvf myems-web.tar.gz build
|
||||||
```
|
```
|
||||||
Install
|
|
||||||
Upload the file myems-web.tar.gz to you web server.
|
Install
|
||||||
Note that the following path should be same as that was configured in nginx.conf.
|
Upload the file myems-web.tar.gz to you web server.
|
||||||
|
Note that the following path should be same as that was configured in nginx.conf.
|
||||||
```bash
|
```bash
|
||||||
tar xzf myems-web.tar.gz
|
tar xzf myems-web.tar.gz
|
||||||
sudo rm -r /var/www/myems-web
|
sudo rm -r /var/www/myems-web
|
||||||
|
@ -228,20 +232,22 @@ Add a new 'VirtualHost' as below
|
||||||
|
|
||||||
* Install MyEMS Web UI:
|
* Install MyEMS Web UI:
|
||||||
|
|
||||||
Check and change the config file if necessary:
|
Check and change the config file if necessary:
|
||||||
```bash
|
```bash
|
||||||
cd myems/myems-web
|
cd myems/myems-web
|
||||||
sudo nano src/config.js
|
sudo nano src/config.js
|
||||||
```
|
```
|
||||||
Build and Compress
|
|
||||||
|
Build and Compress
|
||||||
```bash
|
```bash
|
||||||
cd myems/myems-web/
|
cd myems/myems-web/
|
||||||
sudo npm run build
|
sudo npm run build
|
||||||
tar czvf myems-web.tar.gz build
|
tar czvf myems-web.tar.gz build
|
||||||
```
|
```
|
||||||
Install
|
|
||||||
Upload the file myems-web.tar.gz to you web server.
|
Install
|
||||||
Note that the following path should be same as that was configured in 000-default.conf
|
Upload the file myems-web.tar.gz to you web server.
|
||||||
|
Note that the following path should be same as that was configured in 000-default.conf
|
||||||
```bash
|
```bash
|
||||||
tar xzf myems-web.tar.gz
|
tar xzf myems-web.tar.gz
|
||||||
sudo rm -r /var/www/myems-web
|
sudo rm -r /var/www/myems-web
|
||||||
|
@ -275,12 +281,14 @@ LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
|
||||||
|
|
||||||
### Option 4: Install myems-web on Node.js Web Server
|
### Option 4: Install myems-web on Node.js Web Server
|
||||||
* Run below command in your project directory to make the Production build.
|
* Run below command in your project directory to make the Production build.
|
||||||
This will create an optimized production build by compililing, merging and minifying all the source files as necessary and put them in the build/ folder.
|
|
||||||
|
This will create an optimized production build by compiling, merging and minifying all the source files as necessary and put them in the build/ folder.
|
||||||
```bash
|
```bash
|
||||||
sudo npm run build
|
sudo npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
* Run the production build locally at http://localhost:80.
|
* Run the production build locally at http://localhost:80.
|
||||||
If you want to listen on other port, change it in myems/myems-web/server.js
|
If you want to listen on other port, change it in myems/myems-web/server.js
|
||||||
```
|
```bash
|
||||||
sudo node server.js
|
sudo node server.js
|
||||||
```
|
```
|
Loading…
Reference in New Issue