James Iter 8 years ago
parent
commit
c4f65fac56
6 changed files with 407 additions and 223 deletions
  1. 152 0
      INSTALL.sh
  2. 10 222
      README.md
  3. 238 0
      docs/install.md
  4. 1 1
      gunicorn_config.py
  5. 3 0
      start.sh
  6. 3 0
      stop.sh

+ 152 - 0
INSTALL.sh

@@ -0,0 +1,152 @@
+#!/usr/bin/env bash
+#
+# JimV-C
+#
+# Copyright (C) 2017 JimV <james.iter.cn@gmail.com>
+#
+# Author: James Iter <james.iter.cn@gmail.com>
+#
+#  This script will help you to automation install JimV-C.
+#
+
+export PYPI='https://mirrors.aliyun.com/pypi/simple/'
+export RDB_PSWD='your_rdb_root_password'
+export RDB_JIMV_PSWD='your_rdb_jimv_password'
+export REDIS_PSWD='your_jimv_redis_passwordddddddddddddddddddddddddddddddddddddddddddddddddddddddd'
+export JWT_SECRET='kcMsj4qj0EAvAvj3nlFlPZd2x7P9kBBQ$deae64883a03982913e6c5f0ba265c2c5dfd0cfx'
+export SECRET_KEY='QSYI73re6x553wmcNwT9tk4OCNK9OUS9xNUulDShEcvRw00YhCKaqHhEGYOGKOSB'
+export SMTP_HOST=''
+export SMTP_USER=''
+export SMTP_PASSWORD=''
+
+function check_precondition() {
+    source /etc/os-release
+    case ${ID} in
+    centos|fedora|rhel)
+        if [ ${VERSION_ID} -lt 7 ]; then
+            echo "System version must greater than or equal to 7, We found ${VERSION_ID}."
+	        exit 1
+        fi
+        ;;
+    *)
+        echo "${ID} is unknown, Please to be installed manually."
+	    exit 1
+        ;;
+    esac
+}
+
+function prepare() {
+    yum install python2-pip git -y
+    pip install --upgrade pip -i ${PYPI}
+    pip install virtualenv -i ${PYPI}
+}
+
+function install_MariaDB() {
+    # 安装 MariaDB
+    yum install mariadb mariadb-server -y
+
+    # 配置 MariaDB
+    mkdir -p /etc/systemd/system/mariadb.service.d
+    echo '[Service]' > /etc/systemd/system/mariadb.service.d/limits.conf
+    echo 'LimitNOFILE=65535' >> /etc/systemd/system/mariadb.service.d/limits.conf
+    systemctl --system daemon-reload
+
+    sed -i '/\[mysqld\]/a\bind-address = 127.0.0.1' /etc/my.cnf
+    sed -i '/\[mysqld\]/a\log-bin' /etc/my.cnf
+    sed -i '/\[mysqld\]/a\expire_logs_days = 1' /etc/my.cnf
+    sed -i '/\[mysqld\]/a\innodb_file_per_table' /etc/my.cnf
+    sed -i '/\[mysqld\]/a\max_connections = 1000' /etc/my.cnf
+
+    # 启动并使其随机启动
+    systemctl enable mariadb.service
+    systemctl start mariadb.service
+
+# 初始化 MariaDB
+mysql_secure_installation << EOF
+
+Y
+${RDB_PSWD}
+${RDB_PSWD}
+Y
+Y
+Y
+Y
+EOF
+
+    # 测试是否部署成功
+    mysql -u root -p${RDB_PSWD} -e 'show databases'
+}
+
+function install_Redis() {
+    # 安装 Redis
+    yum install redis -y
+
+    # 配置 Redis
+    echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
+    sysctl -p
+    sed -i '@^daemonize no@daemonize yes@g' /etc/redis.conf
+    sed -i 's@^bind 127.0.0.1@bind 0.0.0.0@g' /etc/redis.conf
+    sed -i 's@^appendonly no@appendonly yes@g' /etc/redis.conf
+    echo 'requirepass ${REDIS_PSWD}' >> /etc/redis.conf
+
+    # 启动并使其随机启动
+    systemctl enable redis.service
+    systemctl start redis.service
+}
+
+function create_web_user() {
+    useradd -m www
+}
+
+function create_web_sites_directory() {
+    su - www -c "mkdir ~/sites"
+}
+
+function clone_and_checkout_JimV-C() {
+    su - www -c "git clone https://github.com/jamesiter/JimV-C.git ~/sites/JimV-C"
+}
+
+function install_dependencies_library() {
+    # 创建 python 虚拟环境
+    su - www -c "virtualenv --system-site-packages ~/venv"
+
+    # 导入 python 虚拟环境
+    su - www -c "source ~/venv/bin/activate"
+
+    # 使切入 www 用户时自动导入 python 虚拟环境
+    su - www -c "echo '. ~/venv/bin/activate' >> .bashrc"
+
+    # 安装JimV-C所需扩展库
+    su - www -c "pip install -r ~/sites/JimV-C/requirements.txt -i ${PYPI}"
+}
+
+function initialization_db() {
+    # 建立 JimV 数据库专属用户
+    mysql -u root -p${RDB_PSWD} -e "grant all on jimv.* to jimv@localhost identified by \"${RDB_JIMV_PSWD}\"; flush privileges"
+
+    # 初始化数据库
+    su - www -c "mysql -u jimv -p${RDB_JIMV_PSWD} < ~/sites/JimV-C/misc/init.sql"
+
+    # 确认是否初始化成功
+    mysql -u jimv -p${RDB_JIMV_PSWD} -e 'show databases'
+}
+
+function generate_config_file() {
+    cp -v /home/www/sites/JimV-C/jimvc.conf /etc/jimvc.conf
+    sed -i "s/\"db_password\".*$/\"db_password\": \"${RDB_JIMV_PSWD}\",/" /etc/jimvc.conf
+    sed -i "s/\"redis_password\".*$/\"redis_password\": \"${REDIS_PSWD}\",/" /etc/jimvc.conf
+    sed -i "s/\"jwt_secret\".*$/\"jwt_secret\": \"${JWT_SECRET}\",/" /etc/jimvc.conf
+    sed -i "s/\"SECRET_KEY\".*$/\"SECRET_KEY\": \"${SECRET_KEY}\",/" /etc/jimvc.conf
+    sed -i "s/\"smtp_host\".*$/\"smtp_host\": \"${SMTP_HOST}\",/" /etc/jimvc.conf
+    sed -i "s/\"smtp_user\".*$/\"smtp_user\": \"${SMTP_USER}\",/" /etc/jimvc.conf
+    sed -i "s/\"smtp_password\".*$/\"smtp_password\": \"${SMTP_PASSWORD}\",/" /etc/jimvc.conf
+}
+
+function start() {
+    mkdir -p /var/log/jimv
+    chown www.www /var/log/jimv
+
+    mkdir -p /run/jimv
+    chown www.www /run/jimv
+}
+

+ 10 - 222
README.md

@@ -11,17 +11,9 @@
 - [功能指标](#功能指标)
 - [未来计划](#未来计划)
 - [安装](#安装)
-    - [安装必要软件](#安装必要软件)
-    - [部署 MariaDB](#部署-mariadb)
-    - [部署 Redis](#部署-redis)
-    - [创建 Web 用户](#创建-web-用户)
-    - [创建站点发布目录](#创建站点发布目录)
-    - [克隆JimV-C项目](#克隆jimv-c项目)
-    - [安装所需库](#安装所需库)
-    - [初始化JimV MySQL数据库](#初始化jimv-mysql数据库)
-    - [修改配置文件](#修改配置文件)
-    - [启动服务](#启动服务)
-    - [部署 Nginx](#部署-nginx)
+    - [单机版一键安装](#单机版一键安装)
+    - [JimV-C 一键安装](#jimv-c-一键安装)
+    - [[JimV-C 手动安装](docs/install.md)](#jimv-c-手动安装)
 - [API](#api)
     - [[状态码参考列表](docs/state_code.md)](#状态码参考列表)
     - [[过滤器操作符原语](docs/filter_primitive.md)](#过滤器操作符原语)
@@ -96,225 +88,21 @@
 
 ## 安装
 
-### 安装必要软件
+### 单机版一键安装
+> 在一台服务器上部署 JimV(包含 JimV-C 与 JimV-N)。适合用于本地单机虚拟化作业,或测试等用途。
 
 ``` bash
-yum install screen python2-pip -y
-pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/
-pip install virtualenv -i https://mirrors.aliyun.com/pypi/simple/
+curl https://raw.githubusercontent.com/jamesiter/JimV-C/master/STANDALONE_INSTALL.sh | bash -
 ```
 
-### 部署 MariaDB
-``` bash
-# 安装 MariaDB
-yum install mariadb mariadb-server -y
-
-# 配置 MariaDB
-mkdir -p /etc/systemd/system/mariadb.service.d
-echo '[Service]' > /etc/systemd/system/mariadb.service.d/limits.conf
-echo 'LimitNOFILE=65535' >> /etc/systemd/system/mariadb.service.d/limits.conf
-systemctl --system daemon-reload
-
-sed -i '/\[mysqld\]/a\bind-address = 127.0.0.1' /etc/my.cnf
-sed -i '/\[mysqld\]/a\log-bin' /etc/my.cnf
-sed -i '/\[mysqld\]/a\expire_logs_days = 1' /etc/my.cnf
-sed -i '/\[mysqld\]/a\innodb_file_per_table' /etc/my.cnf
-sed -i '/\[mysqld\]/a\max_connections = 1000' /etc/my.cnf
-
-# 启动并使其随机启动
-systemctl enable mariadb.service
-systemctl start mariadb.service
-
-# 初始化 MariaDB
-mysql_secure_installation << EOF
-
-Y
-your_root_db_password
-your_root_db_password
-Y
-Y
-Y
-Y
-EOF
-
-# 测试是否部署成功
-mysql -u root -pyour_root_db_password -e 'show databases'
-```
-
-### 部署 Redis
-``` bash
-# 安装 Redis
-yum install redis -y
-
-# 配置 Redis
-echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
-sysctl -p
-sed -i '@^daemonize no@daemonize yes@g' /etc/redis.conf
-sed -i 's@^bind 127.0.0.1@bind 0.0.0.0@g' /etc/redis.conf
-sed -i 's@^appendonly no@appendonly yes@g' /etc/redis.conf
-echo 'requirepass your_jimv_redis_passwordddddddddddddddddddddddddddddddddddddddddddddddddddddddd' >> /etc/redis.conf
-
-# 启动并使其随机启动
-systemctl enable redis.service
-systemctl start redis.service
-```
-
-### 创建 Web 用户
-
-```bash
-useradd -m www
-echo "www:www.pswd.com" | chpasswd
-echo "www ALL = (root) ALL" >> /etc/sudoers.d/www; chmod 0440 /etc/sudoers.d/www
-```
-
-### 创建站点发布目录
-
-```bash
-su - www
-mkdir ~/sites
-```
-
-### 克隆JimV-C项目
-
-```bash
-git clone https://github.com/jamesiter/JimV-C.git ~/sites/JimV-C
-```
-
-### 安装所需库
-
-```bash
-# 创建 python 虚拟环境
-virtualenv --system-site-packages venv
+### JimV-C 一键安装
+> 在一台服务器上仅部署 JimV-C。与其它部署 JimV-N 的计算节点一起协同工作。
 
-# 导入 python 虚拟环境
-source ~/venv/bin/activate
-
-# 使切入 www 用户时自动导入 python 虚拟环境
-echo '. ~/venv/bin/activate' >> .bashrc
-
-# 安装JimV-C所需扩展库
-pip install -r ~/sites/JimV-C/requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
-```
-
-### 初始化JimV MySQL数据库
-
-```bash
-# 建立 JimV 数据库专属用户
-mysql -u root -pyour_root_db_password -e 'grant all on jimv.* to jimv@localhost identified by "your_jimv_db_password"; flush privileges'
-# 初始化数据库
-mysql -u jimv -pyour_jimv_db_password < ~/sites/JimV-C/misc/init.sql
-# 确认是否初始化成功
-mysql -u jimv -pyour_jimv_db_password -e 'show databases'
-```
-
-### 修改配置文件
-
-配置文件的默认读取路径:`/etc/jimvc.conf`
 ``` bash
-sudo cp ~/sites/JimV-C/jimvc.conf /etc/jimvc.conf
+curl https://raw.githubusercontent.com/jamesiter/JimV-C/master/INSTALL.sh | bash -
 ```
-**提示:**
-> 下表中凸显的配置项,需要用户根据自己的环境手动修改。
-
-| 配置项             | 默认值                   | 说明              |
-|:------------------|:------------------------|:-----------------|
-| listen            | 127.0.0.1               | JimV-C 侦听的地址 |
-| port              | 8008                    | JimV-C 侦听的端口 |
-| db_name           | jimv                    | 数据库名称        |
-| db_host           | localhost               | 数据库地址        |
-| db_port           | 3306                    | 数据库端口        |
-| db_user           | jimv                    | 连接数控的用户名   |
-| **`db_password`** | your_jimv_db_password   | 连接数控的密码     |
-| redis_host        | localhost               | redis数据库地址   |
-| redis_port        | 6379                    | redis数据库端口   |
-| **`redis_password`**                       || redis数据库密码   |
-| redis_dbid        | 0                       | 连接的redis数据库  |
-| log_file_path     | /var/log/jimv/jimvc.log | 日志存储路径       |
-| **`jwt_secret`**                           || token安全码       |
-| **`SECRET_KEY`**  |                         | session安全码     |
-| **`smtp_host`**                            || SMTP 服务器地址   |
-| smtp_port         | 25                      | SMTP 服务器端口   |
-| **`smtp_user`**                            || SMTP 用户         |
-| **`smtp_password`**                        || SMTP 密码         |
-| smtp_starttls     | true                    | SMTP 是否开启 TLS |
-
-
-### 启动服务
-
-```bash
-sudo mkdir -p /var/log/jimv
-sudo chown www.www /var/log/jimv
-# 进入JimV-C目录
-cd ~/sites/JimV-C
-# 启动JimV-C
-gunicorn -c gunicorn_config.py main:app
-```
-
-### 部署 Nginx
-
-``` bash
-# 安装 Nginx
-yum install nginx -y
 
-# 配置 Nginx
-sed -i 's@^user nginx;@user www;@g' /etc/nginx/nginx.conf
-chown -R www.www /var/log/nginx
-
-# 启动并使其随机启动
-systemctl enable nginx.service
-systemctl start nginx.service
-```
-
-```nginx
-    gzip on;
-    gzip_min_length 1100;
-    gzip_buffers 4 8k;
-    gzip_types text/plain application/javascript text/css;
-
-    autoindex off;
-    add_header X-Frame-Options SAMEORIGIN;
-    add_header X-Content-Type-Options: nosniff;
-
-    server {
-        listen 443;
-        server_name jimv.your-domain;
-
-        access_log  /var/log/nginx/jimv.access.log;
-        error_log  /var/log/nginx/jimv.error.log;
-
-        ssl on;
-        ssl_certificate /opt/pki/tls/certs/jimv.your.crt;
-        ssl_certificate_key /opt/pki/tls/certs/jimv.your.key;
-        ssl_session_timeout 5m;
-        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
-        ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
-        ssl_prefer_server_ciphers on;
-
-        root /home/www/sites/JimV-C;
-
-        # 拒绝访问隐藏文件(如:.git、.svn等目录)
-        location ~ /\..* {
-            return 403;
-        }
-        location ~ .(sql|py|pyc|ini|conf|log|svn|git|cfg)$ {
-            return 403;
-        }
-        location ~ /$ {
-            rewrite http://$host/index.html break;
-        }
-        location / {
-            try_files $uri @inner;
-        }
-
-        location @inner {
-            proxy_pass         http://127.0.0.1:8008;
-            proxy_redirect     off;
-            proxy_set_header   Host             $host;
-            proxy_set_header   X-Real-IP        $remote_addr;
-            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
-        }
-    }
-```
+### [JimV-C 手动安装](docs/install.md)
 
 
 ## API

+ 238 - 0
docs/install.md

@@ -0,0 +1,238 @@
+# 手动安装
+
+[TOC]: # "手动安装"
+
+# 手动安装
+- [安装必要软件](#安装必要软件)
+- [部署 MariaDB](#部署-mariadb)
+- [部署 Redis](#部署-redis)
+- [创建 Web 用户](#创建-web-用户)
+- [创建站点发布目录](#创建站点发布目录)
+- [克隆JimV-C项目](#克隆jimv-c项目)
+- [安装所需库](#安装所需库)
+- [初始化JimV MySQL数据库](#初始化jimv-mysql数据库)
+- [修改配置文件](#修改配置文件)
+- [启动服务](#启动服务)
+- [部署 Nginx](#部署-nginx)
+
+
+## 安装必要软件
+
+``` bash
+yum install screen python2-pip -y
+pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/
+pip install virtualenv -i https://mirrors.aliyun.com/pypi/simple/
+```
+
+## 部署 MariaDB
+``` bash
+# 安装 MariaDB
+yum install mariadb mariadb-server -y
+
+# 配置 MariaDB
+mkdir -p /etc/systemd/system/mariadb.service.d
+echo '[Service]' > /etc/systemd/system/mariadb.service.d/limits.conf
+echo 'LimitNOFILE=65535' >> /etc/systemd/system/mariadb.service.d/limits.conf
+systemctl --system daemon-reload
+
+sed -i '/\[mysqld\]/a\bind-address = 127.0.0.1' /etc/my.cnf
+sed -i '/\[mysqld\]/a\log-bin' /etc/my.cnf
+sed -i '/\[mysqld\]/a\expire_logs_days = 1' /etc/my.cnf
+sed -i '/\[mysqld\]/a\innodb_file_per_table' /etc/my.cnf
+sed -i '/\[mysqld\]/a\max_connections = 1000' /etc/my.cnf
+
+# 启动并使其随机启动
+systemctl enable mariadb.service
+systemctl start mariadb.service
+
+# 初始化 MariaDB
+mysql_secure_installation << EOF
+
+Y
+your_root_db_password
+your_root_db_password
+Y
+Y
+Y
+Y
+EOF
+
+# 测试是否部署成功
+mysql -u root -pyour_root_db_password -e 'show databases'
+```
+
+## 部署 Redis
+``` bash
+# 安装 Redis
+yum install redis -y
+
+# 配置 Redis
+echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
+sysctl -p
+sed -i '@^daemonize no@daemonize yes@g' /etc/redis.conf
+sed -i 's@^bind 127.0.0.1@bind 0.0.0.0@g' /etc/redis.conf
+sed -i 's@^appendonly no@appendonly yes@g' /etc/redis.conf
+echo 'requirepass your_jimv_redis_passwordddddddddddddddddddddddddddddddddddddddddddddddddddddddd' >> /etc/redis.conf
+
+# 启动并使其随机启动
+systemctl enable redis.service
+systemctl start redis.service
+```
+
+## 创建 Web 用户
+
+```bash
+useradd -m www
+echo "www:www.pswd.com" | chpasswd
+echo "www ALL = (root) ALL" >> /etc/sudoers.d/www; chmod 0440 /etc/sudoers.d/www
+```
+
+## 创建站点发布目录
+
+```bash
+su - www
+mkdir ~/sites
+```
+
+## 克隆JimV-C项目
+
+```bash
+git clone https://github.com/jamesiter/JimV-C.git ~/sites/JimV-C
+```
+
+## 安装所需库
+
+```bash
+# 创建 python 虚拟环境
+virtualenv --system-site-packages venv
+
+# 导入 python 虚拟环境
+source ~/venv/bin/activate
+
+# 使切入 www 用户时自动导入 python 虚拟环境
+echo '. ~/venv/bin/activate' >> .bashrc
+
+# 安装JimV-C所需扩展库
+pip install -r ~/sites/JimV-C/requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
+```
+
+## 初始化JimV MySQL数据库
+
+```bash
+# 建立 JimV 数据库专属用户
+mysql -u root -pyour_root_db_password -e 'grant all on jimv.* to jimv@localhost identified by "your_jimv_db_password"; flush privileges'
+# 初始化数据库
+mysql -u jimv -pyour_jimv_db_password < ~/sites/JimV-C/misc/init.sql
+# 确认是否初始化成功
+mysql -u jimv -pyour_jimv_db_password -e 'show databases'
+```
+
+## 修改配置文件
+
+配置文件的默认读取路径:`/etc/jimvc.conf`
+``` bash
+sudo cp ~/sites/JimV-C/jimvc.conf /etc/jimvc.conf
+```
+**提示:**
+> 下表中凸显的配置项,需要用户根据自己的环境手动修改。
+
+| 配置项             | 默认值                   | 说明              |
+|:------------------|:------------------------|:-----------------|
+| listen            | 127.0.0.1               | JimV-C 侦听的地址 |
+| port              | 8008                    | JimV-C 侦听的端口 |
+| db_name           | jimv                    | 数据库名称        |
+| db_host           | localhost               | 数据库地址        |
+| db_port           | 3306                    | 数据库端口        |
+| db_user           | jimv                    | 连接数控的用户名   |
+| **`db_password`** | your_jimv_db_password   | 连接数控的密码     |
+| redis_host        | localhost               | redis数据库地址   |
+| redis_port        | 6379                    | redis数据库端口   |
+| **`redis_password`**                       || redis数据库密码   |
+| redis_dbid        | 0                       | 连接的redis数据库  |
+| log_file_path     | /var/log/jimv/jimvc.log | 日志存储路径       |
+| **`jwt_secret`**                           || token安全码       |
+| **`SECRET_KEY`**  |                         | session安全码     |
+| **`smtp_host`**                            || SMTP 服务器地址   |
+| smtp_port         | 25                      | SMTP 服务器端口   |
+| **`smtp_user`**                            || SMTP 用户         |
+| **`smtp_password`**                        || SMTP 密码         |
+| smtp_starttls     | true                    | SMTP 是否开启 TLS |
+
+
+## 启动服务
+
+```bash
+sudo mkdir -p /var/log/jimv
+sudo chown www.www /var/log/jimv
+# 进入JimV-C目录
+cd ~/sites/JimV-C
+# 启动JimV-C
+gunicorn -c gunicorn_config.py main:app
+```
+
+## 部署 Nginx
+
+``` bash
+# 安装 Nginx
+yum install nginx -y
+
+# 配置 Nginx
+sed -i 's@^user nginx;@user www;@g' /etc/nginx/nginx.conf
+chown -R www.www /var/log/nginx
+
+# 启动并使其随机启动
+systemctl enable nginx.service
+systemctl start nginx.service
+```
+
+```nginx
+    gzip on;
+    gzip_min_length 1100;
+    gzip_buffers 4 8k;
+    gzip_types text/plain application/javascript text/css;
+
+    autoindex off;
+    add_header X-Frame-Options SAMEORIGIN;
+    add_header X-Content-Type-Options: nosniff;
+
+    server {
+        listen 443;
+        server_name jimv.your-domain;
+
+        access_log  /var/log/nginx/jimv.access.log;
+        error_log  /var/log/nginx/jimv.error.log;
+
+        ssl on;
+        ssl_certificate /opt/pki/tls/certs/jimv.your.crt;
+        ssl_certificate_key /opt/pki/tls/certs/jimv.your.key;
+        ssl_session_timeout 5m;
+        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
+        ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
+        ssl_prefer_server_ciphers on;
+
+        root /home/www/sites/JimV-C;
+
+        # 拒绝访问隐藏文件(如:.git、.svn等目录)
+        location ~ /\..* {
+            return 403;
+        }
+        location ~ .(sql|py|pyc|ini|conf|log|svn|git|cfg)$ {
+            return 403;
+        }
+        location ~ /$ {
+            rewrite http://$host/index.html break;
+        }
+        location / {
+            try_files $uri @inner;
+        }
+
+        location @inner {
+            proxy_pass         http://127.0.0.1:8008;
+            proxy_redirect     off;
+            proxy_set_header   Host             $host;
+            proxy_set_header   X-Real-IP        $remote_addr;
+            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
+        }
+    }
+```
+

+ 1 - 1
gunicorn_config.py

@@ -32,6 +32,6 @@ accesslog = '/'.join([log_file_dir, 'access.log'])
 errorlog = '/'.join([log_file_dir, 'error.log'])
 loglevel = 'info'
 
-pidfile = '/run/jimv/jimv.pid'
+pidfile = '/run/jimv/jimvc.pid'
 
 

+ 3 - 0
start.sh

@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+su - www -c "cd ~/sites/JimV-C; gunicorn -c gunicorn_config.py main:app"

+ 3 - 0
stop.sh

@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+kill `cat /home/www/sites/JimV-C/jimid.pid`