Skip to content

Commit

Permalink
添加 Supervisor 发布指南
Browse files Browse the repository at this point in the history
  • Loading branch information
MeiK2333 committed Jan 30, 2019
1 parent e21d209 commit 73e50f7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,34 @@ $ source venv/bin/activate

## Deploying

### Gunicorn

```bash
nohup gunicorn api:app --bind 0.0.0.0:8000 --worker-class sanic.worker.GunicornWorker --max-requests 1000 &
```

### Supervisor

你需要先将配置写入 `/etc/supervisord.conf`

```conf
[program:SDUT_RESTful_API]
command=/path/to/SDUT_RESTful_API/venv/bin/gunicorn api:app --bind 0.0.0.0:8000 --worker-class sanic.worker.GunicornWorker --max-requests 1000
directory=/path/to/SDUT_RESTful_API
stdout_logfile=/path/to/SDUT_RESTful_API/stdout.log
stderr_logfile=/path/to/SDUT_RESTful_API/stderr.log
redirect_stderr=True
environment=PRODUCTION=1
```

然后启动它:

```bash
$ sudo supervisorctl reread # 如果这句执行失败的话,可以尝试重启 `sudo supervisord`
$ sudo supervisorctl update
$ sudo supervisorctl start SDUT_RESTful_API
```

## TODO

因为放假期间没有通知和作业以及课程表可以测试,因此 `course` 的功能暂缓开发。
Expand Down

0 comments on commit 73e50f7

Please sign in to comment.