Skip to content

Commit

Permalink
Install and use gunicorn inside the virtualenv.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazoyer committed Jul 8, 2018
1 parent 03a8fae commit 360c372
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
3 changes: 2 additions & 1 deletion tasks/setup-web-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
pip:
name: gunicorn
extra_args: "--upgrade"
executable: "{{ netbox_pip_binary }}"
virtualenv: "{{ netbox_install_directory }}"
virtualenv_python: "{{ netbox_python_binary }}"

- name: configure gunicorn
template:
Expand Down
4 changes: 2 additions & 2 deletions templates/gunicorn_config.py.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# {{ ansible_managed }}

command = '{{ gunicorn_binary_path }}'
command = '{{ netbox_install_directory }}/bin/gunicorn'
pythonpath = '{{ netbox_install_directory }}/netbox'
bind = '{{ netbox_gunicorn_address }}:{{ netbox_gunicorn_port }}'
workers = {{ netbox_gunicorn_workers_number }}
user = '{{ netbox_gunicorn_user }}'
user = '{{ netbox_gunicorn_user }}'
4 changes: 2 additions & 2 deletions templates/netbox.conf.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# {{ ansible_managed }}

[program:netbox]
command = gunicorn -c {{ netbox_install_directory }}/gunicorn_config.py netbox.wsgi
command = {{ netbox_install_directory }}/bin/gunicorn -c {{ netbox_install_directory }}/gunicorn_config.py netbox.wsgi
directory = {{ netbox_install_directory }}/netbox/
user = {{ netbox_supervisor_user }}
user = {{ netbox_supervisor_user }}
2 changes: 0 additions & 2 deletions vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ become_method_to_use: su
postgresql_service: postgresql
postgresql_user: postgres

gunicorn_binary_path: /usr/local/bin/gunicorn

supervisord_service: supervisor
supervisord_config_directory: /etc/supervisor/conf.d

Expand Down
2 changes: 0 additions & 2 deletions vars/Ubuntu-18.04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ become_method_to_use: su
postgresql_service: postgresql
postgresql_user: postgres

gunicorn_binary_path: /usr/local/bin/gunicorn

supervisord_service: supervisor
supervisord_config_directory: /etc/supervisor/conf.d

Expand Down

0 comments on commit 360c372

Please sign in to comment.