From 56588a7c0d97727a0434f26d2b1baf8147da49b3 Mon Sep 17 00:00:00 2001 From: "13621160019@163.com" <13621160019@163.com> Date: Sat, 19 Mar 2022 14:01:03 +0800 Subject: [PATCH] updated upload folder path --- myems-admin/README.md | 4 ++- myems-api/Dockerfile | 2 +- myems-api/README.md | 7 ++-- myems-api/config.py | 4 +-- myems-api/example.env | 4 +-- myems-api/installation_macos_zh.md | 21 ++++++----- myems-web/README.md | 58 +++++++++++++++++------------- 7 files changed, 57 insertions(+), 43 deletions(-) diff --git a/myems-admin/README.md b/myems-admin/README.md index 98d59cc4..aa2391a8 100644 --- a/myems-admin/README.md +++ b/myems-admin/README.md @@ -1,10 +1,12 @@ # myems-admin ## Introduction + 系统管理用户界面,用于MyEMS系统配置 -Providing Admin UI for MyEMS system settings +Admin UI for MyEMS system settings ## Prerequisites + nginx-1.18.0 or later diff --git a/myems-api/Dockerfile b/myems-api/Dockerfile index 599fa8a9..9392e18e 100644 --- a/myems-api/Dockerfile +++ b/myems-api/Dockerfile @@ -2,7 +2,7 @@ FROM python:slim WORKDIR /code # 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 RUN pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com diff --git a/myems-api/README.md b/myems-api/README.md index afca0100..3143cb0a 100644 --- a/myems-api/README.md +++ b/myems-api/README.md @@ -1,7 +1,8 @@ # MyEMS API Service ## 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 @@ -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, and also bind-mount the .env to the container: ```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, and also bind-mount the .env to the container: ```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 diff --git a/myems-api/config.py b/myems-api/config.py index 631b4903..3e697d6a 100644 --- a/myems-api/config.py +++ b/myems-api/config.py @@ -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 # 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 -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 currency_unit = config('CURRENCY_UNIT', default='CNY') diff --git a/myems-api/example.env b/myems-api/example.env index 61b5aea6..151b7e8d 100644 --- a/myems-api/example.env +++ b/myems-api/example.env @@ -81,9 +81,9 @@ WORKING_DAY_START_TIME_LOCAL=00:00:00 # indicates where user uploaded files will be saved to # 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 -UPLOAD_PATH=/var/www/html/admin/upload/ +UPLOAD_PATH=/var/www/myems-admin/upload/ # main currency unit CURRENCY_UNIT=CNY diff --git a/myems-api/installation_macos_zh.md b/myems-api/installation_macos_zh.md index 8d94cbf5..17fffdb3 100644 --- a/myems-api/installation_macos_zh.md +++ b/myems-api/installation_macos_zh.md @@ -11,9 +11,9 @@ $ xcode-select --install 然后安装python3 ```shell -$ brew search python3 //默认安装最新版3.9 +$ brew search python3 //默认安装最新版3.10 $ python3 -V -Python 3.9.1 //安装Python3 OK +Python 3.10.1 //安装Python3 OK ``` 国内网络可能会出现安装慢的问题,配置下国内的资源镜像 ```shell @@ -45,18 +45,20 @@ Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> ``` -然后初始化数据库,克隆[myems-database](https://github.com/myems/myems-database)到本地。 +然后初始化数据库,克隆[myems](https://github.com/myems/myems)到本地。 ```shell -$ git clone https://github.com/myems/myems-database.git -$ cd myems-database +$ git clone https://github.com/myems/myems.git +$ cd myems/myems-database $ mysql -u root -p密码 //用root登录mysql mysql> source myems_billing_baseline_db.sql source myems_billing_db.sql +source myems_carbon_db.sql source myems_energy_baseline_db.sql source myems_energy_db.sql source myems_fdd_db.sql source myems_historical_db.sql +source myems_production_db.sql source myems_reporting_db.sql source myems_system_db.sql source myems_user_db.sql @@ -68,10 +70,12 @@ mysql> show databases; // 查看数据库是否导入OK | information_schema | | myems_billing_baseline_db | | myems_billing_db | +| myems_carbon_db | | myems_energy_baseline_db | | myems_energy_db | | myems_fdd_db | | myems_historical_db | +| myems_production_db | | myems_reporting_db | | myems_system_db | | myems_user_db | @@ -135,7 +139,6 @@ $ source ~/.zshrc ### 4.运行myems-api服务 ```shell -$ git clone https://github.com/kuuyee/myems-api.git $ cd myems/myems-api $ gunicorn -b 0.0.0.0:8000 app:api [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服务 打开浏览器访问[http://0.0.0.0:8000/version](http://0.0.0.0:8000/version) -如果看到如下输出就表示服务启动正常。 +如果看到输出版本信息就表示服务启动正常。 ```json { -"version": "MyEMS 1.3.2", -"release-date": "2021-10-22", +"version": "MyEMS 1.8.2", +"release-date": "2022-03-16", "website": "https://myems.io" } ``` \ No newline at end of file diff --git a/myems-web/README.md b/myems-web/README.md index 75c7442f..b84e0e34 100644 --- a/myems-web/README.md +++ b/myems-web/README.md @@ -1,8 +1,8 @@ # myems-web ## Introduction -Web 用户界面,用于能源数据可视化 -Providing Web UI for energy data visualization +Web用户界面,用于MyEMS能源数据可视化 +Web UI for MyEMS energy data visualization ## Prerequisites @@ -12,7 +12,7 @@ Node.js 17.0.0 or later ## Running in Local Environment for Development -* Install Node.js via binary archive on Linux +* Install Node.js via binary archive on Linux Download Current Linux Binaries (x64) from https://nodejs.org/en/download/current/ ```bash @@ -33,17 +33,19 @@ npm version npx -v ``` -* Download all the necessary dependencies into the node_modules directory. +* Download all the necessary dependencies into the node_modules directory. ```bash cd myems/myems-web 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. ```bash npm run scss -``` -* Starting the Development Server +``` + +* Starting the Development Server 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. ```bash @@ -173,21 +175,23 @@ Restart NGINX 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 cd myems/myems-web sudo nano src/config.js ``` - Build and Compress + +Build and Compress ```bash sudo npm run build tar czvf myems-web.tar.gz build ``` - Install - 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. + +Install +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 tar xzf myems-web.tar.gz sudo rm -r /var/www/myems-web @@ -195,11 +199,11 @@ sudo mv build /var/www/myems-web ``` ### Option 3: Install on Apache2 Server -* Install Apache2 Server +* Install Apache2 Server refer to https://httpd.apache.org/docs/2.4/install.html -* Configure Apache2 +* Configure Apache2 ```bash sudo vi /etc/apache2/ports.conf ``` @@ -226,22 +230,24 @@ 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 cd myems/myems-web sudo nano src/config.js ``` - Build and Compress + +Build and Compress ```bash cd myems/myems-web/ sudo npm run build tar czvf myems-web.tar.gz build ``` - Install - 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 + +Install +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 tar xzf myems-web.tar.gz sudo rm -r /var/www/myems-web @@ -274,13 +280,15 @@ LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so ``` ### Option 4: Install myems-web on Node.js Web Server -* 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. +* Run below command in your project directory to make the Production build. + +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 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 -``` +```bash sudo node server.js ``` \ No newline at end of file