improve worker - timeout and start after
This commit is contained in:
parent
84277b9fcb
commit
1853850a40
|
@ -3,10 +3,13 @@ osp_git_root: 'https://gitlab.com/Deamos/flask-nginx-rtmp-manager.git'
|
|||
osp_git_commit: '0.7.9'
|
||||
osp_worker_start_port: 5000
|
||||
osp_worker_count: "{{ ansible_processor_nproc }}"
|
||||
osp_worker_timeout: 30
|
||||
# should not be edited
|
||||
osp_worker_worker: 1
|
||||
|
||||
osp_http_user: "http"
|
||||
osp_http_group: "http"
|
||||
osp_http_path: "/srv/http"
|
||||
osp_http_path: "/var/www"
|
||||
|
||||
osp_db_host: localhost
|
||||
osp_db_name: osp
|
||||
|
|
|
@ -155,7 +155,16 @@
|
|||
dest: "/opt/osp/conf/config.py"
|
||||
state: link
|
||||
|
||||
- name: Create logging directory
|
||||
file:
|
||||
path: /opt/osp
|
||||
owner: "{{ osp_http_user }}"
|
||||
group: "{{ osp_http_group }}"
|
||||
recurse: yes
|
||||
|
||||
- name: Init Database
|
||||
become: yes
|
||||
become_user: http
|
||||
command: python3 manage.py db init
|
||||
args:
|
||||
chdir: /opt/osp/
|
||||
|
|
|
@ -3,13 +3,17 @@ Description=Gunicorn instance to serve OSP Workers on port %i
|
|||
After=network.target ejabberd.service redis.service
|
||||
PartOf=osp.target
|
||||
|
||||
{% if osp_db_type == "postgresql" %}
|
||||
After=postgresql.service
|
||||
{% endif %}
|
||||
|
||||
[Service]
|
||||
User=http
|
||||
Group=http
|
||||
WorkingDirectory=/opt/osp
|
||||
Environment="VIRTUAL_ENV=/opt/osp-venv"
|
||||
Environment="PATH=/opt/osp-venv/bin:/usr/local/bin:/usr/bin:/bin"
|
||||
ExecStart=/opt/osp-venv/bin/gunicorn app:app -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 --bind 0.0.0.0:%i --reload --access-logfile /var/log/osp/access.log --error-logfile /var/log/osp/error.log
|
||||
ExecStart=/opt/osp-venv/bin/gunicorn app:app -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w {{ osp_worker_worker }} --bind 0.0.0.0:%i --timeout {{ osp_worker_timeout }} --reload --access-logfile /var/log/osp/access.log --error-logfile /var/log/osp/error.log
|
||||
Restart=on-failure
|
||||
RestartSec=5m
|
||||
|
||||
|
|
Loading…
Reference in New Issue