[ganeti/ganeti_webmgr] 5e02398 Add prod requirements to dev.txt (254 commits)

2 views
Skip to first unread message

g...@osuosl.org

unread,
Dec 19, 2013, 6:56:31 PM12/19/13
to ganeti-web...@googlegroups.com
The branch, develop has been updated

Old revision: 4fda8aa53f2bfce6c5801614e0b864c9c1df4fa3, new revision: 5e02398ae5189d5ae4826379138ea2135c72812f.
via 5e02398ae5189d5ae4826379138ea2135c72812f (commit)
via 9510c93ea87dcc7e0a6e8e7fb2ab860cf9c0a9e1 (commit)
via 1083a9ebc043c44f0e891acaf87ed993ac79787f (commit)
via 74ec7884ae541a1e7160c2437e6382199dbde0a4 (commit)
via 919f3878732288aab994d61bf0e10dde166fd612 (commit)
via ac2d5433ba0510a6f6c0d47cae6348e9df7f7830 (commit)
via b80a8e0a3051def46d839b45de52e14419b72040 (commit)
via 78559adf17efaf20e18867cc6eb11f0112fff1be (commit)
via dd5e04b21f5c02088d034f1fd08012640d2d875e (commit)
via a419d13840fef330d973967df8b8b81ca2701898 (commit)
via 51dc355ca244584bbd7727d2a851d6c9fc8fa819 (commit)
via fb52ccdd4f344b6bb1f57643ef276afbd42f8916 (commit)
via b063b691f50d51f95b6a02b7108cb6aeb4441283 (commit)
via 406c78301547eef5c30ee3cb844183e6b8b57091 (commit)
via 2c81a780c240e17b896520b29cd85a645ca59cce (commit)
from 4fda8aa53f2bfce6c5801614e0b864c9c1df4fa3 (commit)

- Log -----------------------------------------------------------------
commit 5e02398ae5189d5ae4826379138ea2135c72812f
Author: Chance Zibolski <chance....@gmail.com>
Date: Thu Dec 19 13:41:59 2013 -0800

Add prod requirements to dev.txt

commit 9510c93ea87dcc7e0a6e8e7fb2ab860cf9c0a9e1
Merge: 4fda8aa 1083a9e
Author: Chance Zibolski <chance....@gmail.com>
Date: Thu Dec 19 11:47:07 2013 -0800

Merge branch 'enhancement/14949' into develop

* enhancement/14949:
Fix reference errors
Remove getting_started/deploying in favor of new deploy docs.
Finish Nginx + uWSGI deployment doc
Add static files section to deployment/intro
Add reference to apache conf file.
Update nginx and uwsgi settings files for docs.
Update nginx conf and uwsgi conf for GWM.
Beginning of Nginx/uWSGI docs.
Add static directory to apache vhost.
Fix links to deployment.
Update references from deploying to deployment/intro
Add Nginx to deployment.
Add apache + mod_wsgi deployment documentation


Summary of changes:
docs/source/deployment/apache.conf | 18 +++++++
docs/source/deployment/apache.rst | 48 +++++++++++++++++
docs/source/deployment/intro.rst | 52 +++++++++++++++++++
docs/source/deployment/nginx.rst | 35 +++++++++++++
docs/source/deployment/nginx_site.conf | 19 +++++++
docs/source/deployment/uwsgi.ini | 14 +++++
docs/source/deprecated/old_installing.rst | 8 ++--
docs/source/dev/vagrant.rst | 2 +-
docs/source/getting_started/deploying.rst | 77 ----------------------------
docs/source/getting_started/installing.rst | 4 +-
docs/source/index.rst | 10 +++-
requirements/dev.txt | 1 +
12 files changed, 203 insertions(+), 85 deletions(-)
create mode 100644 docs/source/deployment/apache.conf
create mode 100644 docs/source/deployment/apache.rst
create mode 100644 docs/source/deployment/intro.rst
create mode 100644 docs/source/deployment/nginx.rst
create mode 100644 docs/source/deployment/nginx_site.conf
create mode 100644 docs/source/deployment/uwsgi.ini
delete mode 100644 docs/source/getting_started/deploying.rst

diff --git a/docs/source/deployment/apache.conf b/docs/source/deployment/apache.conf
new file mode 100644
index 0000000..3ddefdd
--- /dev/null
+++ b/docs/source/deployment/apache.conf
@@ -0,0 +1,18 @@
+WSGIDaemonProcess ganeti_web processes=4 threads=1 \
+ python-path=/path/to/ganeti_webmgr/ganeti_web:/path/to/ganeti_webmgr/venv/lib/python2.7/site-packages
+WSGIProcessGroup ganeti_web
+WSGIScriptAlias / /path/to/ganeti_webmgr/ganeti_web/ganeti_web/wsgi.py
+
+Alias /static/ /path/to/ganeti_webmgr/collected_static/
+
+<Directory /path/to/ganeti_webmgr/collected_static>
+ Order deny,allow
+ Allow from all
+</Directory>
+
+<Directory /path/to/ganeti_webmgr>
+<Files wsgi.py>
+ Order allow,deny
+ Allow from all
+</Files>
+</Directory>
\ No newline at end of file

diff --git a/docs/source/deployment/apache.rst b/docs/source/deployment/apache.rst
new file mode 100644
index 0000000..7986ff1
--- /dev/null
+++ b/docs/source/deployment/apache.rst
@@ -0,0 +1,48 @@
+.. _apache:
+
+=================
+Apache + mod_wsgi
+=================
+
+Overview
+========
+
+Before beginning deploying |gwm| using Apache, read the following Django article
+on `deploying Django with apache and mod_wsgi <https://docs.djangoproject.com/en/1.4/howto/deployment/wsgi/modwsgi/>`_.
+
+To get |gwm| installed there are a few steps.
+
+* Install Apache
+* Configure/install ``mod_wsgi`` and other Apache modules
+* Create the |gwm| VirtualHost
+
+Configuration
+-------------
+Make sure you have mod_wsgi installed and enabled in Apache before beginning.
+
+Next you want to create a vhost which will contain the Apache settings
+that will point to our Django app. In the Apache config or ``<VirualHost>``
+you will need at least the following:
+
+.. _apache_conf:
+
+.. literalinclude:: apache.conf
+ :language: apache
+
+``WSGIDaemonProcess``:
+ ``processes`` should be set to the number of CPU cores available.
+ ``threads`` is fine to be left at 1.
+ ``python-path`` is adding our virtualenv's site packages and |gwm| to the
+ python path before executing the wsgi app.
+ More info on this particular directive can be found on the `mod_wsgi docs
+ <https://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide#Delegation_To_Daemon_Process>`_.
+
+``WSGIScriptAlias``:
+ This is the base URL path that |gwm| will be served at. In this case its at
+ ``/`` (the root url).
+
+``Alias``:
+ Defines where to find the static assets (css, js, images) for |gwm|. This
+ lets Apache serve the static files instead of having Django do it.
+ You can leave this as is unless you modified the ``end_user.py`` settings.
+

diff --git a/docs/source/deployment/intro.rst b/docs/source/deployment/intro.rst
new file mode 100644
index 0000000..2eb0481
--- /dev/null
+++ b/docs/source/deployment/intro.rst
@@ -0,0 +1,52 @@
+.. _deployment:
+
+===========
+Development
+===========
+
+|gwm| supports various methods of deployment. By default Django ships with a
+simple python web server for development purposes. If your just trying to get
+|gwm| up and running, or you simply want to contribute to the project then using
+the :ref:`development-server` is probably your best bet. Otherwise check out
+:ref:`static-files`.
+
+.. _development-server:
+
+Development Server
+----------------------
+
+If you are just testing |gwm| out, run::
+
+ $ python ganeti_webmgr/manage.py runserver
+
+Then open a web browser, and navigate to
+`http://localhost:8000`::
+
+ firefox http://localhost:8000
+
+.. Note:: This should only be used to *test*. This should never be used in a
+ *production* environment.
+
+
+.. _static-files:
+
+============
+Static Files
+============
+
+Django is not very good at serving static files like CSS and Javascript.
+This is why we use web servers like Apache or Nginx. So we need to collect all
+of our static files into a single directory. To do this from the project root
+edit `ganeti_web/ganeti_web/settings/end_user.py` and update the `STATIC_ROOT`
+value to be the full absolute path to a where you would like to collect all
+the static assets at. After this run the following commands from the project root
+
+::
+
+ source venv/bin/activate
+ python ganeti_webmgr/manage.py collectstatic
+
+Once you've done that, you can move on to deploying using your prefered web server.
+
+* :ref:`Apache <apache>`
+* :ref:`Nginx <nginx>`
\ No newline at end of file

diff --git a/docs/source/deployment/nginx.rst b/docs/source/deployment/nginx.rst
new file mode 100644
index 0000000..c909d9b
--- /dev/null
+++ b/docs/source/deployment/nginx.rst
@@ -0,0 +1,35 @@
+.. _nginx:
+
+=====
+Nginx
+=====
+
+uWSGI
+=====
+
+Before you begin, it is adviced you read over the following uWSGI article on
+`setting up Django with uWSGI and Nginx <https://uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html>`_
+
+Configuration
+-------------
+
+First you will want to install uWSGI to the virtualenv which is easily done
+with the following commands::
+
+ cd /path/to/ganeti_webmgr
+ source venv/bin/activate
+ pip install uwsgi
+
+Once uWSGI is installed you should configure Nginx to handle serving our static
+assets and proxy the rest to uWSGI. Here is a sample nginx virtual host:
+
+
+.. _nginx_conf:
+
+.. literalinclude:: nginx_site.conf
+ :language: nginx
+
+Finally you will want to configure uWSGI. Here is a sample uWSGI configuration
+file that should properly work with GWM:
+
+.. literalinclude:: uwsgi.ini

diff --git a/docs/source/deployment/nginx_site.conf b/docs/source/deployment/nginx_site.conf
new file mode 100644
index 0000000..cc53160
--- /dev/null
+++ b/docs/source/deployment/nginx_site.conf
@@ -0,0 +1,19 @@
+upstream gwm {
+ # server unix:///path/to/gwm_uwsgi.sock; # for a file socket
+ server 127.0.0.1:8001;
+}
+
+server {
+ listen 80;
+ server_name example.org;
+
+ location /static {
+ alias /path/to/ganeti_webmgr/collected_static;
+
+ }
+
+ location / {
+ uwsgi_pass gwm;
+ include uwsgi_params;
+ }
+}
\ No newline at end of file

diff --git a/docs/source/deployment/uwsgi.ini b/docs/source/deployment/uwsgi.ini
new file mode 100644
index 0000000..fc74df1
--- /dev/null
+++ b/docs/source/deployment/uwsgi.ini
@@ -0,0 +1,14 @@
+[uwsgi]
+
+# GWM-related settings
+chdir = /path/to/ganeti_webmgr/ganeti_web
+# GWM's wsgi file
+module = ganeti_web.wsgi
+# the virtualenv (full path)
+home = /path/to/ganeti_webmgr/venv/
+
+# Configure based on needs
+master = true
+processes = 2
+socket = 127.0.0.1:8001
+vacuum = true

diff --git a/docs/source/deprecated/old_installing.rst b/docs/source/deprecated/old_installing.rst
index ec7efe2..bc62e61 100644
--- a/docs/source/deprecated/old_installing.rst
+++ b/docs/source/deprecated/old_installing.rst
@@ -116,8 +116,8 @@ Initializing
Next Steps
----------

-Congratulations! |gwm| is now installed and initialized. Next, you'll want
-to look into :ref:`configuring` and :ref:`deploying`, if you are going
-to be setting up a production instance. Otherwise, if you just want to
+Congradulations! |gwm| is now installed and initialized. Next, you'll want
+to look into :ref:`configuring` and :ref:`deployment <deployment>`, if you are
+going to be setting up a production instance. Otherwise, if you just want to
play around with |gwm|, or are :ref:`developing <development>`, take a look at
-:ref:`test-server`.
+:ref:`development-server`.

diff --git a/docs/source/dev/vagrant.rst b/docs/source/dev/vagrant.rst
index 1036fcc..494d79a 100644
--- a/docs/source/dev/vagrant.rst
+++ b/docs/source/dev/vagrant.rst
@@ -60,7 +60,7 @@ Then you need to run the following command to have it reprovision the VM::
Once Vagrant has finished running, and provisioning, your Virtual Machine will
be running and ready for use. You can get to the VM by using the ``vagrant ssh``
command to get to the VM. To run |gwm| you need to source your `virtualenv` and
-start the :ref:`test-server`::
+start the :ref:`development-server`::

source ~/venv/bin/activate
cd ~/ganeti_webmgr

diff --git a/docs/source/getting_started/deploying.rst b/docs/source/getting_started/deploying.rst
deleted file mode 100644
index c5acbdb..0000000
--- a/docs/source/getting_started/deploying.rst
+++ /dev/null
@@ -1,77 +0,0 @@
-.. _deploying:
-
-Deployment
-==========
-
-If you haven't already :ref:`configured <configuring>` |gwm|, now would
-be a good time to do so.
-
-Now that you have a |gwm| instance setup and configured, you will want
-to deploy it to somewhere that can be accessed by a web browser.
-
-
-.. _test-server:
-
-Test Server
------------
-
-If you are just trying |gwm| out, run from your
-:ref:`virtual environment <virtual-environment>`::
-
- $ gwm-manage.py runserver
-
-Then open a web browser, and navigate to ``http://localhost:8000``::
-
- firefox http://localhost:8000
-
-
-Apache + mod_wsgi
------------------
-
-Follow the django guide to `deploy with apache
-<https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/>`_. Here
-is an example ``mod_wsgi`` file::
-
- import os
- import sys
-
- path = '/var/lib/django/ganeti_webmgr'
-
- # activate virtualenv
- activate_this = '%s/venv/bin/activate_this.py' % path
- execfile(activate_this, dict(__file__=activate_this))
-
- # add project to path
- if path not in sys.path:
- sys.path.append(path)
-
- # configure django environment
- os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
-
- import django.core.handlers.wsgi
- application = django.core.handlers.wsgi.WSGIHandler()
-
-
-Virtualenv
-~~~~~~~~~~
-
-The virtual environment must be activated for use with ``mod_wsgi``. This
-is done by executing the ``activate_this`` script generated when a virtualenv
-is created. The following code should be in the ``django.wsgi`` file apache
-is configured to use with::
-
- # activate virtual environment
- activate_this = '%s/venv/bin/activate_this.py' % "PATH_TO_GANETI_WEBMGR"
- execfile(activate_this, dict(__file__=activate_this))
-
-
-Nginx
------
-
-
-Gunicorn
---------
-
-
-uWSGI
------

diff --git a/docs/source/getting_started/installing.rst b/docs/source/getting_started/installing.rst
index 0c560c7..29cb964 100644
--- a/docs/source/getting_started/installing.rst
+++ b/docs/source/getting_started/installing.rst
@@ -93,7 +93,7 @@ Next Steps
----------

Congratulations! |gwm| is now installed and initialized. Next, you'll want
-to look into :ref:`configuring` and :ref:`deploying`, if you are going
+to look into :ref:`configuring` and :ref:`deployment`, if you are going
to be setting up a production instance. Otherwise, if you just want to
play around with |gwm|, or are :ref:`developing <development>`, take a look at
-:ref:`test-server`.
+:ref:`development-server`.

diff --git a/docs/source/index.rst b/docs/source/index.rst
index 8b3e66b..66ea268 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -38,9 +38,17 @@ Getting Started
getting_started/requirements
getting_started/installing
getting_started/configuring
- getting_started/deploying
getting_started/importing

+Deployment
+----------
+.. toctree::
+ :maxdepth: 1
+
+ deployment/intro
+ deployment/apache
+ deployment/nginx
+

Features
--------

diff --git a/requirements/dev.txt b/requirements/dev.txt
index f21bd36..7452d8b 100644
--- a/requirements/dev.txt
+++ b/requirements/dev.txt
@@ -1,3 +1,4 @@
Jinja2==2.6
Pygments==1.6
Sphinx==1.1.3
+-r production.txt
Reply all
Reply to author
Forward
0 new messages