forked from gergely/calendar-social
Add Vagrant related files
This commit is contained in:
56
ansible/roles/gunicorn/tasks/main.yml
Normal file
56
ansible/roles/gunicorn/tasks/main.yml
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
|
||||
- name: Install Supervisor
|
||||
dnf:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items:
|
||||
- supervisor
|
||||
|
||||
- name: Start supervisord
|
||||
service:
|
||||
name: supervisord
|
||||
state: restarted
|
||||
|
||||
- name: Create the Gunicorn config directory
|
||||
file:
|
||||
path: /etc/gunicorn
|
||||
state: directory
|
||||
owner: "{{ user_name }}"
|
||||
group: "{{ group_name }}"
|
||||
mode: 0700
|
||||
|
||||
- name: Create the Gunicorn config file in /etc/gunicorn
|
||||
template:
|
||||
src: gunicorn.conf.j2
|
||||
dest: /etc/gunicorn/gunicorn.conf
|
||||
|
||||
- name: Create the Gunicorn log directory
|
||||
file:
|
||||
path: /var/log/gunicorn
|
||||
state: directory
|
||||
owner: "{{ user_name }}"
|
||||
group: "{{ group_name }}"
|
||||
mode: 0700
|
||||
|
||||
- name: Create the Supervisor config file for Gunicorn
|
||||
template:
|
||||
src: supervisor.conf.j2
|
||||
dest: /etc/supervisord.d/gunicorn.ini
|
||||
|
||||
- name: Re-read the Supervisor config files
|
||||
supervisorctl:
|
||||
name: gunicorn
|
||||
state: present
|
||||
|
||||
- name: Start Gunicorn with supervisord
|
||||
supervisorctl:
|
||||
name: gunicorn
|
||||
state: restarted
|
||||
when: enabled
|
||||
|
||||
- name: Stop Gunicorn for local dev
|
||||
supervisorctl:
|
||||
name: gunicorn
|
||||
state: stopped
|
||||
when: not enabled
|
9
ansible/roles/gunicorn/templates/gunicorn.conf.j2
Normal file
9
ansible/roles/gunicorn/templates/gunicorn.conf.j2
Normal file
@@ -0,0 +1,9 @@
|
||||
import multiprocessing
|
||||
|
||||
workers = multiprocessing.cpu_count() * 2 + 1
|
||||
proc_name = 'gunicorn'
|
||||
bind = '127.0.0.1:8000'
|
||||
errorlog = '/var/log/gunicorn/gunicorn-error.log'
|
||||
accesslog = '/var/log/gunicorn/gunicorn-access.log'
|
||||
loglevel = 'warning'
|
||||
timeout = 60
|
8
ansible/roles/gunicorn/templates/supervisor.conf.j2
Normal file
8
ansible/roles/gunicorn/templates/supervisor.conf.j2
Normal file
@@ -0,0 +1,8 @@
|
||||
[program:gunicorn]
|
||||
command=pipenv run gunicorn wsgi:app -c /etc/gunicorn/gunicorn.conf --pythonpath {{ application_path }}
|
||||
directory={{ application_path }}
|
||||
user={{ user_name }}
|
||||
group={{ group_name }}
|
||||
autorestart=true
|
||||
autostart={{ autostart | bool | lower }}
|
||||
redirect_stderr=true
|
Reference in New Issue
Block a user