From e505c10368aa880662a77ad7a7079906e2c4a729 Mon Sep 17 00:00:00 2001 From: Dorian Pula Date: Mon, 19 Jan 2015 23:22:58 -0500 Subject: [PATCH] Add documentation on variables to README. Change default port to 8000. --- README.md | 71 +++++++++++++++++++++++++++++++++++++++++------ defaults/main.yml | 2 +- 2 files changed, 63 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 58a4fd0..e7bd29d 100644 --- a/README.md +++ b/README.md @@ -17,16 +17,48 @@ theoretically work on older versions of Ubuntu or Debian based systems. Role Variables -------------- -TODO - A description of the settable variables for this role should go here, including any variables that are in -defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables -that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as -well. +### Default Variables + +TODO - Explanation + +# Web root paths + app name + home +app_name: app +web_root_path: /srv/www +web_server_group: www-data +app_home: "{{ web_root_path }}/{{ app_name }}_webapp" + +# NGINX +nginx_hostname: localhost +nginx_app_static: "{{ app_home }}/{{ app_name }}/static/" + +# UWSGI +uwsgi_port: 8001 +uwsgi_app_executable: "app:make_wsgi_app()" + + +### Main (Internal) Variables + +The following variables are part of the internals of the role. However if you really want to, you can tweak them to +work with your setup: + +- web_user: The non-root user who is allowed to control web + app servers on the target machine. + (Default: current user) +- virtualenv_root: 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) +- supervisor_app_config: The filename of the supervisor configuration for the app. (Default: app_name_supervisor.conf) +- uwsgi_config: The path to the UWSGI configurations. (Default: /srv/www/config/uwsgi) +- uwsgi_app_ini: The filename of the UWSGI INI configuration for the app. (Default: app_name_uwsgi.ini) +- uwsgi_service_name: The name of the UWSGI setup for the app according to supervisor. (Default: app_name_uwsgi) Example Playbook ---------------- -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for -users too: +The simplest way to include the role in your playbook is to copy the below configuration. Remember to modify the +app_name, nginx_hostname and uwsgi_app_executable parameters especially. - hosts: servers sudo: yes @@ -37,6 +69,27 @@ users too: nginx_hostname: app.domain.net, uwsgi_port: 8080, uwsgi_app_executable: "app.build:make_wsgi_app()" } + +Default File Structure +---------------------- + +By default the role will organize files in the following directory structure: + + /srv/www + ├── config + │   ├── nginx -> /etc/nginx + │   ├── supervisor -> /etc/supervisor + │   └── uwsgi + ├── logs + │   ├── nginx -> /var/log/nginx + │   ├── supervisor -> /var/log/supervisor + │   └── uwsgi + ├── app_webapp + │   ├── requirements.txt + │   └── app + └── virtualenvs + ├── app + └── uwsgi License ------- @@ -47,8 +100,8 @@ Author Information ------------------ Dorian Pula -email: dorian.pula at amber-penguin.software.ca -www: http://amber-penguin-software.ca +- email: dorian.pula at amber-penguin.software.ca +- www: http://amber-penguin-software.ca -This role is a spin-off of the technology developed for the Rookeries project: +This role is a spin-off of the technology developed for the [Rookeries project]: http://rookeries.amber-penguin-software.ca/ diff --git a/defaults/main.yml b/defaults/main.yml index c83de42..69aecc8 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -12,5 +12,5 @@ nginx_hostname: localhost nginx_app_static: "{{ app_home }}/{{ app_name }}/static/" # UWSGI -uwsgi_port: 8001 +uwsgi_port: 8000 uwsgi_app_executable: "app:make_wsgi_app()"