diff --git a/README.md b/README.md index 982523b..9b11fa7 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ -Ansible nginx-uwsgi-supervisor +Ansible nginx-supervisor ============================== -An Ansible role to setup and manage a UWSGI app via supervisor, and served up on a NGINX web server. The goal of this -role is to make deployment of WSGI app as a simple and sane as possible. Additionally the role provides sane defaults -for logging and folder structure setup. +A base Ansible role that setups and manages a webapp via supervisor, and served up on a NGINX web server. The goal of +this role is to extract the common elements of deploying a webapp into this infrastructure, in a simple and sane manner. +Additionally the role provides sane defaults for logging and folder structure setup. + +**This role is under development and is unstable.** Requirements ------------ @@ -72,17 +74,6 @@ into sections and described below: - app_uwsgi_envs: - (Optional) A dictionary of environment variables to pass into an app. - Default: empty dictionary - -### Virtual Environments - -**NEW** - On occassion it is necessary to change the setup of the virtual environments on a system. - -- virtualenv_root_path: - - Path to where the virtual environments are installed - - Default: web_root_path/virtualenvs -- app_venv: - - Path to the application's virtualenv. - - Default: virtualenv_root_path/app_name ### General Web @@ -104,18 +95,12 @@ By default the role will organize files in the following directory structure: /srv/www ├── config │   ├── nginx -> /etc/nginx - │   ├── supervisor -> /etc/supervisor - │   └── uwsgi + │   └── supervisor -> /etc/supervisor ├── logs │   ├── nginx -> /var/log/nginx - │   ├── supervisor -> /var/log/supervisor - │   └── uwsgi - ├── app_webapp - │   ├── requirements.txt - │   └── app - └── virtualenvs - ├── app - └── uwsgi + │   └── supervisor -> /var/log/supervisor + └── app_webapp +    └── app Internal Variables ------------------ @@ -130,12 +115,6 @@ work with your setup: - The common root directory of Python virtual environments associated with running the UWSGI app + server. - Default: /srv/www/virtualenvs/ -- uwsgi_venv: - - The virtual environment where UWSGI is installed. - - Default: virtualenv_root/uwsgi -- app_venv: - - The virtual environment where the dependencies of the WSGI app is installed. - - Default: virtualenv_root/app_name - nginx_app_conf: - The filename of the NGINX configuration for the app. - Default: app_name_uwsgi_nginx.conf @@ -172,7 +151,5 @@ This role is a spin-off of the technology developed for the [Rookeries project] Repositories ------------ -- Main: https://bitbucket.org/dorianpula/ansible-nginx-uwsgi-supervisor +- Main: https://bitbucket.org/dorianpula/ansible-nginx-supervisor - All development and issues are worked on this repo. -- Clone: https://github.com/dorianpula/ansible-nginx-uwsgi-supervisor - - A clone to work with Ansible Galaxy and Github diff --git a/defaults/main.yml b/defaults/main.yml index 358d204..f484d7f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -11,12 +11,3 @@ app_root_path: "{{ web_root_path }}/{{ app_name }}_webapp" # NGINX app_nginx_hostname: localhost app_nginx_static_path: "{{ app_root_path }}/{{ app_name }}/static/" - -# UWSGI -app_uwsgi_port: 8000 -app_uwsgi_executable: "app:make_wsgi_app()" -app_uwsgi_envs: {} - -# Virtualenvs -virtualenv_root_path: "{{ web_root_path }}/virtualenvs" -app_venv: "{{ virtualenv_root_path }}/{{ app_name }}" diff --git a/handlers/main.yml b/handlers/main.yml index c06bb10..112f236 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,9 +1,5 @@ --- # handlers file for ansible-nginx-uwsgi-supervisor -- name: restart uwsgi app - supervisorctl: name={{ uwsgi_app_service_name }} state=restarted config=/etc/supervisor/supervisord.conf - sudo: yes - - name: start supervisord service: name=supervisor state=started sudo: yes diff --git a/tasks/main.yml b/tasks/main.yml index 9cba9eb..67c67b4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -3,5 +3,3 @@ - include: nginx.yaml - include: supervisor.yaml - include: web_data_folders.yaml -- include: python.yaml -- include: uwsgi.yaml diff --git a/tasks/python.yaml b/tasks/python.yaml deleted file mode 100644 index 012bd2b..0000000 --- a/tasks/python.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -- name: install python dev - sudo: yes - apt: pkg={{ item }} state=present - with_items: - - python-dev - - python-setuptools - -- name: install pip - sudo: yes - easy_install: name=pip - -- name: install virtualenv - sudo: yes - pip: name={{ item }} state=present extra_args='--upgrade' - with_items: - - pip - - virtualenv diff --git a/tasks/uwsgi.yaml b/tasks/uwsgi.yaml deleted file mode 100644 index 24aaad4..0000000 --- a/tasks/uwsgi.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: install uwsgi server - pip: name=uwsgi virtualenv={{ uwsgi_venv }} version=2.0 - sudo: yes - -- name: configure app on uwsgi server - template: src=uwsgi/app_uwsgi.ini dest={{ uwsgi_config_path }}/{{ uwsgi_app_ini }} - sudo: yes diff --git a/templates/uwsgi/app_uwsgi.ini b/templates/uwsgi/app_uwsgi.ini deleted file mode 100644 index f66a20e..0000000 --- a/templates/uwsgi/app_uwsgi.ini +++ /dev/null @@ -1,12 +0,0 @@ -[uwsgi] -socket = :{{ app_uwsgi_port }} -master = true -processes = 8 - -chdir = {{ app_root_path }} -virtualenv = {{ app_venv }} -module = {{ app_uwsgi_executable }} - -{% for env_var, env_value in app_uwsgi_envs.items() %} -env = {{ env_var | upper }}={{ env_value }} -{% endfor %} diff --git a/vars/main.yml b/vars/main.yml index 8f60a11..c700403 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -9,9 +9,3 @@ nginx_app_config: "{{ app_name }}_uwsgi_nginx.conf" # Supervisor supervisor_app_config: "{{ app_name }}_supervisor.conf" - -# UWSGI -uwsgi_venv: "{{ virtualenv_root_path }}/uwsgi" -uwsgi_config_path: "{{ web_root_path }}/config/uwsgi" -uwsgi_app_ini: "{{ app_name }}_uwsgi.ini" -uwsgi_app_service_name: "{{ app_name }}_uwsgi"