updated README

pull/135/head
13621160019@163.com 2022-03-13 14:17:46 +08:00
parent 38e9fc5996
commit a4a88ecfc0
3 changed files with 23 additions and 21 deletions

6
admin/README.md vendored
View File

@ -105,8 +105,8 @@ Add a new 'server' section with direstives as below:
root /var/www/html/admin; root /var/www/html/admin;
index index.html index.htm; index index.html index.htm;
} }
-- To avoid CORS issue, use Nginx to proxy myems-api to path /api ## To avoid CORS issue, use Nginx to proxy myems-api to path /api
-- Add another location /api in 'server ', replace demo address http://127.0.0.1:8000/ with actual url ## Add another location /api in 'server' and replace demo address http://127.0.0.1:8000/ with actual url
location /api { location /api {
proxy_pass http://127.0.0.1:8000/; proxy_pass http://127.0.0.1:8000/;
proxy_connect_timeout 75; proxy_connect_timeout 75;
@ -119,6 +119,8 @@ Add a new 'server' section with direstives as below:
* Install myems-admin : * Install myems-admin :
If the server can not connect to the internet, please compress the myems/admin folder and upload it to the server and extract it to ~/myems/admin If the server can not connect to the internet, please compress the myems/admin folder and upload it to the server and extract it to ~/myems/admin
```bash ```bash
sudo mkdir /var/www
sudo mkdir /var/www/html
sudo cp -r myems/admin /var/www/html/admin sudo cp -r myems/admin /var/www/html/admin
sudo chmod 0755 -R /var/www/html/admin sudo chmod 0755 -R /var/www/html/admin
``` ```

View File

@ -33,9 +33,9 @@ python-decouple
```bash ```bash
cd myems/myems-api cd myems/myems-api
pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com sudo pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
cp example.env .env cp example.env .env
chmod +x run.sh sudo chmod +x run.sh
./run.sh ./run.sh
``` ```
@ -110,50 +110,50 @@ In this section, you will online install myems-api on Ubuntu Server with interne
* Copy source code to a production Ubuntu Server and then install tools * Copy source code to a production Ubuntu Server and then install tools
```bash ```bash
cd myems/myems-api cd myems/myems-api
pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com sudo pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
``` ```
* Install myems-api service: * Install myems-api service:
```bash ```bash
cp -r myems/myems-api /myems-api sudo cp -r myems/myems-api /myems-api
``` ```
Create .env file based on example.env and edit the .env file if needed: Create .env file based on example.env and edit the .env file if needed:
```bash ```bash
cp /myems-api/example.env /myems-api/.env sudo cp /myems-api/example.env /myems-api/.env
nano /myems-api/.env sudo nano /myems-api/.env
``` ```
Check or change the listening port (default is 8000) in myems-api.service and myems-api.socket: Check or change the listening port (default is 8000) in myems-api.service and myems-api.socket:
```bash ```bash
nano /myems-api/myems-api.service sudo nano /myems-api/myems-api.service
``` ```
```bash ```bash
ExecStart=/usr/local/bin/gunicorn -b 0.0.0.0:8000 --pid /run/myems-api/pid --timeout 600 --workers=4 app:api ExecStart=/usr/local/bin/gunicorn -b 0.0.0.0:8000 --pid /run/myems-api/pid --timeout 600 --workers=4 app:api
``` ```
```bash ```bash
nano /myems-api/myems-api.socket sudo nano /myems-api/myems-api.socket
``` ```
```bash ```bash
ListenStream=0.0.0.0:8000 ListenStream=0.0.0.0:8000
``` ```
Add port to firewall: Add port to firewall:
```bash ```bash
ufw allow 8000 sudo ufw allow 8000
``` ```
Setup systemd configure files: Setup systemd configure files:
```bash ```bash
cp /myems-api/myems-api.service /lib/systemd/system/ sudo cp /myems-api/myems-api.service /lib/systemd/system/
cp /myems-api/myems-api.socket /lib/systemd/system/ sudo cp /myems-api/myems-api.socket /lib/systemd/system/
cp /myems-api/myems-api.conf /usr/lib/tmpfiles.d/ sudo cp /myems-api/myems-api.conf /usr/lib/tmpfiles.d/
``` ```
Next enable the services so that they autostart at boot: Next enable the services so that they autostart at boot:
```bash ```bash
systemctl enable myems-api.socket sudo systemctl enable myems-api.socket
systemctl enable myems-api.service sudo systemctl enable myems-api.service
``` ```
Start the services : Start the services :
```bash ```bash
systemctl start myems-api.socket sudo systemctl start myems-api.socket
systemctl start myems-api.service sudo systemctl start myems-api.service
``` ```
### Option 3: Offline install myems-api on Ubuntu Server without internet access ### Option 3: Offline install myems-api on Ubuntu Server without internet access

6
web/README.md vendored
View File

@ -130,7 +130,7 @@ refer to http://nginx.org/en/docs/install.html
* Configure NGINX * Configure NGINX
```bash ```bash
nano /etc/nginx/nginx.conf sudo nano /etc/nginx/nginx.conf
``` ```
In the 'http' section, add some directives: In the 'http' section, add some directives:
``` ```
@ -158,8 +158,8 @@ Add a new 'server' section with direstives as below:
# add try_files directive to avoid 404 error while refreshing pages # add try_files directive to avoid 404 error while refreshing pages
try_files $uri /index.html; try_files $uri /index.html;
} }
-- To avoid CORS issue, use Nginx to proxy myems-api to path /api ## To avoid CORS issue, use Nginx to proxy myems-api to path /api
-- Add another location /api in 'server ', replace demo address http://127.0.0.1:8000/ with actual url ## Add another location /api in 'server' and replace demo address http://127.0.0.1:8000/ with actual url
location /api { location /api {
proxy_pass http://127.0.0.1:8000/; proxy_pass http://127.0.0.1:8000/;
proxy_connect_timeout 75; proxy_connect_timeout 75;