From e260065ae543885a80ca98dcc3394e763c80d007 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 30 Oct 2011 11:55:41 -0500 Subject: Added a lot more details to deploying.rst --- docs/source/deploying.rst | 107 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 100 insertions(+), 7 deletions(-) (limited to 'docs/source') diff --git a/docs/source/deploying.rst b/docs/source/deploying.rst index db92257a..b35d72d2 100644 --- a/docs/source/deploying.rst +++ b/docs/source/deploying.rst @@ -4,13 +4,106 @@ Deploying MediaGoblin ======================= -Step 1: Write code that can be deployed. +GNU MediaGoblin is fairly new and so at the time of writing, there +aren't easy package-manager-friendly methods to install MediaGoblin. +However, doing a basic install isn't too complex in and of itself. -Step 2: ? +There's an almost infinite way to deploy things... for now, we'll keep +it simple with some assumptions and use a setup that combines +mediagoblin + virtualenv + fastcgi + nginx on a .deb or .rpm based +GNU/Linux distro. + +Note: these tools are for administrators wanting to deploy a fresh +install. If instead you want to join in as a contributor, see our +`Hacking HOWTO `_ instead. + +Install dependencies +==================== + +First thing you want to do is install necessary dependencies. Those +are, roughly: + + - Python 2.6 or 2.7 + - python-lxml - http://lxml.de/ + - git - http://git-scm.com/ + - MongoDB - http://www.mongodb.org/ + - Python Imaging Library (PIL) - http://www.pythonware.com/products/pil/ + - virtualenv - http://www.virtualenv.org/ + +On a .deb based system (Debian, GnewSense, Trisquel, Ubuntu, etc) run +the following: + + sudo apt-get install mongodb git-core python python-dev \ + python-lxml python-imaging python-virtualenv + +On a .rpm based system (Fedora, RedHat, etc): + + yum install mongodb-server python-paste-deploy python-paste-script \ + git-core python python-devel python-lxml python-imaging python-virtualenv + +Configure MongoDB +================= + +So you have MongoDB installed... you should probably make sure that +you have a few things configured before you start up MediaGoblin. + +For one thing, you almost certainly want to make sure `journaling +`_ is enabled. +Journaling is automatically enabled on 64 bit systems post-MongoDB +2.0, but you should check. (Not turning on journaling means that if +your server crashes you have a good chance of losing data!) + +MongoDB can take a lot of space by default. If you're planning on +running a smaller instance, consider following our `scaling down +`_ guide (keeping in mind +that the steps recommended here are tradeoffs!). + +Install MediaGoblin and Virtualenv +================================== + +For the moment, let's assume you want to run the absolute most +bleeding edge version of mediagoblin in mediagoblin master (possibly +not the best choice in a production environment, so these docs should +be fixed ;)). + +Clone the repository: + + git clone git://gitorious.org/mediagoblin/mediagoblin.git + +And setup the in-package virtualenv: + + virtualenv . && ./bin/python setup.py develop + +(If you have problems here, consider trying to install virtualenv with +one of the flags --distribute or --no-site-packages... Additionally if +your system has python3.X as the default you might need to do +virtualenv --python=python2.7 or --python=python2.6) + +(You might note that we've done an in-package install of +virtualenv... this isn't the most traditional way to install +virtualenv, and it might not even be the best. But it's the easiest +to explain without having to explain python packaging, and it works.) + +At this point your development environment should be setup. You don't +need to do anything else. However if at any point you update your +codebase, you should also run: + + ./bin/python setup.py develop --upgrade && ./bin/gmg migrate. + + +Test-start the server +===================== + +At this point mediagoblin should be properly installed. You can +test-start it like so: + + ./lazyserver.sh --server-name=broadcast + +You should be able to connect to the machine on port 6543 in your +browser to ensure that things are working. + + +Hook up to your webserver via fastcgi +===================================== -Step 3: Write the deployment guide and profit! -But seriously, this is a stub since we're not quite there (yet) but if -you want to see where we are now, you can try to run the latest -development version by following the instructions on -`the wiki `_. -- cgit v1.2.3 From 94011579e78ff4fdec12d8777ae3b06212aa517b Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 30 Oct 2011 16:07:48 -0500 Subject: Hook mediagoblin up to nginx --- docs/source/deploying.rst | 80 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) (limited to 'docs/source') diff --git a/docs/source/deploying.rst b/docs/source/deploying.rst index b35d72d2..e2f13c07 100644 --- a/docs/source/deploying.rst +++ b/docs/source/deploying.rst @@ -72,6 +72,7 @@ Clone the repository: And setup the in-package virtualenv: + cd mediagoblin virtualenv . && ./bin/python setup.py develop (If you have problems here, consider trying to install virtualenv with @@ -106,4 +107,83 @@ browser to ensure that things are working. Hook up to your webserver via fastcgi ===================================== +This section describes how to configure MediaGoblin to work via +fastcgi. Our configuration example will use nginx, as the author of +this manual feels that nginx config files are easier to understand if +you have no experience with any type of configuration file. However, +the translations to apache are not too hard. + +Also for the sake of this document, we'll assume you're running +mediagoblin on the domain mediagoblin.example.org and your +mediagoblin checkout in /var/www/mediagoblin.example.org/mediagoblin/ + +Now in reality, you won't be running mediagoblin on such a domain or +in such a directory, but it should be easy enough to move your stuff +over. + +Anyway, in such an environment, make a config file in the normal place +you'd make such an nginx config file... probably +/etc/nginx/sites-available/mediagoblin.example.conf (and symlink said +file over to /etc/nginx/sites-enabled/ to turn it on) + +Now put in that file: + + server { + ################################################# + # Stock useful config options, but ignore them :) + ################################################# + server_name mediagoblin.example.org www.mediagoblin.example.org; + include /etc/nginx/mime.types; + + access_log /var/log/nginx/mediagoblin.example.access.log; + error_log /var/log/nginx/mediagoblin.example.error.log; + + autoindex off; + default_type application/octet-stream; + sendfile on; + # tcp_nopush on; + + # Gzip + gzip on; + gzip_min_length 1024; + gzip_buffers 4 32k; + gzip_types text/plain text/html application/x-javascript text/javascript text/xml text/css; + + ##################################### + # Mounting MediaGoblin stuff + # This is the section you should read + ##################################### + + # MediaGoblin's stock static files: CSS, JS, etc. + location /mgoblin_static/ { + alias /var/www/mediagoblin.example.org/mediagoblin/static/; + } + + # Instance specific media: + location /mgoblin_media/ { + alias /var/www/mediagoblin.example.org/mediagoblin/user_dev/media/public/; + } + + # Mounting MediaGoblin itself via fastcgi. + location / { + fastcgi_pass 127.0.0.1:26543; + include /etc/nginx/fastcgi_params; + } + } + +At this point your config file should be properly set up to handle +serving mediagoblin. Now all you need to do is run it! + +Let's do a quick test. Restart nginx so it picks up your changes, +something probably like: + + sudo /etc/init.d/nginx restart + +Now start up MediaGoblin. "cd" to the MediaGoblin checkout and run: + + ./lazyserver.sh --server-name=http http_host=127.0.0.1 http_port=26543 + +Visit the site you've set up in your browser, eg +http://example.mediagoblin.org (except with the real domain name or IP +you're expecting to use. ;)) -- cgit v1.2.3 From 36dc2eaa661870cba1dd9ed50bc2bd09c8daa7cc Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 30 Oct 2011 16:22:35 -0500 Subject: If I"m telling people to use fastcgi, we should probably use fastcgi ;) --- docs/source/deploying.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/source') diff --git a/docs/source/deploying.rst b/docs/source/deploying.rst index e2f13c07..ca3d5046 100644 --- a/docs/source/deploying.rst +++ b/docs/source/deploying.rst @@ -181,7 +181,7 @@ something probably like: Now start up MediaGoblin. "cd" to the MediaGoblin checkout and run: - ./lazyserver.sh --server-name=http http_host=127.0.0.1 http_port=26543 + ./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543 Visit the site you've set up in your browser, eg http://example.mediagoblin.org (except with the real domain name or IP -- cgit v1.2.3 From 26e789eb0cf8a8d55fd43e0fea8d3c15f6fa8f64 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 30 Oct 2011 16:43:12 -0500 Subject: Let's comply with the Filesystem Hierarchy Standard ... and make elrond and tychoish happy :) --- docs/source/deploying.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/source') diff --git a/docs/source/deploying.rst b/docs/source/deploying.rst index ca3d5046..22311a56 100644 --- a/docs/source/deploying.rst +++ b/docs/source/deploying.rst @@ -115,7 +115,7 @@ the translations to apache are not too hard. Also for the sake of this document, we'll assume you're running mediagoblin on the domain mediagoblin.example.org and your -mediagoblin checkout in /var/www/mediagoblin.example.org/mediagoblin/ +mediagoblin checkout in /srv/mediagoblin.example.org/mediagoblin/ Now in reality, you won't be running mediagoblin on such a domain or in such a directory, but it should be easy enough to move your stuff @@ -156,12 +156,12 @@ Now put in that file: # MediaGoblin's stock static files: CSS, JS, etc. location /mgoblin_static/ { - alias /var/www/mediagoblin.example.org/mediagoblin/static/; + alias /srv/mediagoblin.example.org/mediagoblin/static/; } # Instance specific media: location /mgoblin_media/ { - alias /var/www/mediagoblin.example.org/mediagoblin/user_dev/media/public/; + alias /srv/mediagoblin.example.org/mediagoblin/user_dev/media/public/; } # Mounting MediaGoblin itself via fastcgi. -- cgit v1.2.3 From 17c712307dcff26226365ef856a71f9c1daeeeba Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 30 Oct 2011 16:47:39 -0500 Subject: Recommend that users use a non-privelaged user (thanks Elrond for the text) --- docs/source/deploying.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'docs/source') diff --git a/docs/source/deploying.rst b/docs/source/deploying.rst index 22311a56..2e599b5e 100644 --- a/docs/source/deploying.rst +++ b/docs/source/deploying.rst @@ -58,6 +58,24 @@ running a smaller instance, consider following our `scaling down `_ guide (keeping in mind that the steps recommended here are tradeoffs!). + +Decide on a non-privileged user +=============================== + +As MediaGoblin does not require any special permissions, you +should either decide on a user to run it as, or even better create a +dedicated user for it. Consult your distribution's documentation on +how to create dedicated service user. Make sure it does have a locked +password, so nobody can login using this user. + +You should create a working dir for MediaGoblin. We assume you will +check things out into /srv/mediagoblin.example.org/mediagoblin/ for +this documentation, but you can choose whatever fits your local needs. + +Most of the remaining documentation assumes you're working as that +user. As root, you might want to do "su - mediagoblinuser". + + Install MediaGoblin and Virtualenv ================================== @@ -66,6 +84,10 @@ bleeding edge version of mediagoblin in mediagoblin master (possibly not the best choice in a production environment, so these docs should be fixed ;)). +Change to (and possibly make) the appropriate parent directory: + + cd /srv/mediagoblin.example.org/ + Clone the repository: git clone git://gitorious.org/mediagoblin/mediagoblin.git -- cgit v1.2.3 From 80bcaa5cb1d2d0cbd419c81cd7ca3b7970817368 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 30 Oct 2011 16:59:15 -0500 Subject: No reason to include commented-out things. --- docs/source/deploying.rst | 1 - 1 file changed, 1 deletion(-) (limited to 'docs/source') diff --git a/docs/source/deploying.rst b/docs/source/deploying.rst index 2e599b5e..0aece001 100644 --- a/docs/source/deploying.rst +++ b/docs/source/deploying.rst @@ -163,7 +163,6 @@ Now put in that file: autoindex off; default_type application/octet-stream; sendfile on; - # tcp_nopush on; # Gzip gzip on; -- cgit v1.2.3 From 2f9bd4d4582a938bc138b92789fcb9ff3fb44a50 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 30 Oct 2011 18:59:07 -0500 Subject: Added notes on a more permanent mediagoblin process. --- docs/source/deploying.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'docs/source') diff --git a/docs/source/deploying.rst b/docs/source/deploying.rst index 0aece001..69478277 100644 --- a/docs/source/deploying.rst +++ b/docs/source/deploying.rst @@ -208,3 +208,25 @@ Visit the site you've set up in your browser, eg http://example.mediagoblin.org (except with the real domain name or IP you're expecting to use. ;)) + +A more permanent mediagoblin process via paste +============================================== + +At this point, you probably have a MediaGoblin instance that for most +intents and purposes works, but lazyserver is... well, lazy. You +probably want to set up a process that you can launch in init scripts. + +Try something along the lines of: + + CELERY_ALWAYS_EAGER=true \ + /srv/mediagoblin.example.org/mediagoblin/bin/paster serve \ + /srv/mediagoblin.example.org/mediagoblin/paste.ini \ + --pid-file=/tmp/mediagoblin.pid \ + --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543 \ + +Feel free to adjust any of this. + +Note that this runs MediaGoblin in "always eager" mode with Celery. +This is fine for development and smaller deployments. However if +you're getting into the really large deployment category, consider +reading the section of this manual on Celery. -- cgit v1.2.3 From 4e893b6ea1b9ab4d9a104d9a3a0751598bb3c8f5 Mon Sep 17 00:00:00 2001 From: tycho garen Date: Mon, 31 Oct 2011 00:21:30 -0400 Subject: docs: editing/tweaking deployment documentation --- docs/source/deploying.rst | 380 ++++++++++++++++++++++++---------------------- 1 file changed, 201 insertions(+), 179 deletions(-) (limited to 'docs/source') diff --git a/docs/source/deploying.rst b/docs/source/deploying.rst index 69478277..5f07a1d2 100644 --- a/docs/source/deploying.rst +++ b/docs/source/deploying.rst @@ -1,8 +1,6 @@ -.. _deployment-chapter: - -======================= - Deploying MediaGoblin -======================= +===================== +Deploying MediaGoblin +===================== GNU MediaGoblin is fairly new and so at the time of writing, there aren't easy package-manager-friendly methods to install MediaGoblin. @@ -17,216 +15,240 @@ Note: these tools are for administrators wanting to deploy a fresh install. If instead you want to join in as a contributor, see our `Hacking HOWTO `_ instead. -Install dependencies -==================== +Prepare System +-------------- -First thing you want to do is install necessary dependencies. Those -are, roughly: +Dependencies +~~~~~~~~~~~~ - - Python 2.6 or 2.7 - - python-lxml - http://lxml.de/ - - git - http://git-scm.com/ - - MongoDB - http://www.mongodb.org/ - - Python Imaging Library (PIL) - http://www.pythonware.com/products/pil/ - - virtualenv - http://www.virtualenv.org/ +MediaGoblin has the following core dependencies: -On a .deb based system (Debian, GnewSense, Trisquel, Ubuntu, etc) run -the following: +- Python 2.6 or 2.7 +- `python-lxml `_ +- `git `_ +- `MongoDB `_ +- `Python Imaging Library `_ (PIL) +- `virtualenv `_ - sudo apt-get install mongodb git-core python python-dev \ - python-lxml python-imaging python-virtualenv +On a DEB-based system (e.g Debian, gNewSense, Trisquel, Ubuntu, and +derivatives) issue the following command: :: -On a .rpm based system (Fedora, RedHat, etc): + sudo apt-get install mongodb git-core python python-dev python-lxml python-imaging python-virtualenv - yum install mongodb-server python-paste-deploy python-paste-script \ - git-core python python-devel python-lxml python-imaging python-virtualenv +On a RPM-based system (e.g. Fedora, RedHat, and derivatives) issue the +following command: :: + + yum install mongodb-server python-paste-deploy python-paste-script git-core python python-devel python-lxml python-imaging python-virtualenv Configure MongoDB -================= +~~~~~~~~~~~~~~~~~ + +After installing MongoDB some preliminary database configuration may +be necessary. + +Ensure that MongoDB `journaling `_ +is enabled. Journaling is enabled by default in version 2.0 and later +64-bit MongoDB instances. Check your deployment, and consider enabling +journaling if you're running 32-bit systems or earlier version. -So you have MongoDB installed... you should probably make sure that -you have a few things configured before you start up MediaGoblin. +.. warning:: -For one thing, you almost certainly want to make sure `journaling -`_ is enabled. -Journaling is automatically enabled on 64 bit systems post-MongoDB -2.0, but you should check. (Not turning on journaling means that if -your server crashes you have a good chance of losing data!) + Running MongoDB without journaling risks general data corruption + and raises the possibility of losing data within a 60-second + window when the server restarts. -MongoDB can take a lot of space by default. If you're planning on -running a smaller instance, consider following our `scaling down -`_ guide (keeping in mind -that the steps recommended here are tradeoffs!). + MediaGoblin recommends enabling MongoDB's journaling feature by + adding a ``--journal`` flag to the command line or a "``journal: + true``" option to the configuration file. +MongoDB can take a lot of space by default. If you're planning on +running a smaller instance, consider the `scaling down guide +`_ for some appropriate +tradeoffs to conserve space. -Decide on a non-privileged user -=============================== +Drop Privileges for MediaGoblin +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -As MediaGoblin does not require any special permissions, you -should either decide on a user to run it as, or even better create a -dedicated user for it. Consult your distribution's documentation on -how to create dedicated service user. Make sure it does have a locked -password, so nobody can login using this user. +As MediaGoblin does not require special permissions or elevated +access, you should run MediaGoblin under an existing non-root user or +preferably create a dedicated user for the purpose of running +MediaGoblin. Consult your distribution's documentation on how to +create "system account" or dedicated service user. Ensure that it is +not possible to log in to your system with as this user. -You should create a working dir for MediaGoblin. We assume you will -check things out into /srv/mediagoblin.example.org/mediagoblin/ for -this documentation, but you can choose whatever fits your local needs. +You should create a working directory for MediaGoblin. This document +assumes your local git repository will be located at ``/srv/mediagoblin.example.org/mediagoblin/`` +for this documentation. Substitute your prefer ed local deployment path +as needed. -Most of the remaining documentation assumes you're working as that -user. As root, you might want to do "su - mediagoblinuser". +This document assumes that all operations are performed as this +user. To drop privileges to this user, run the following command: :: + su - [mediagoblin]`` + +Where, "``[mediagoblin]`` is the username of the system user that will +run MediaGoblin. + Install MediaGoblin and Virtualenv -================================== +---------------------------------- -For the moment, let's assume you want to run the absolute most -bleeding edge version of mediagoblin in mediagoblin master (possibly -not the best choice in a production environment, so these docs should -be fixed ;)). +As of |version|, MediaGoblin has a rapid development pace. As a result +the following instructions recommend installing from the ``master`` +branch of the git repository. Eventually production deployments will +want to transition to running from more consistent releases. -Change to (and possibly make) the appropriate parent directory: +Issue the following commands, to create and change the working +directory. Modify these commands to reflect your own environment: :: - cd /srv/mediagoblin.example.org/ + mkdir -p /srv/mediagoblin.example.org/ + cd /srv/mediagoblin.example.org/ -Clone the repository: +Clone the MediaGoblin repository: :: - git clone git://gitorious.org/mediagoblin/mediagoblin.git + git clone git://gitorious.org/mediagoblin/mediagoblin.git -And setup the in-package virtualenv: +And setup the in-package virtualenv: :: - cd mediagoblin - virtualenv . && ./bin/python setup.py develop + cd mediagoblin + virtualenv . && ./bin/python setup.py develop -(If you have problems here, consider trying to install virtualenv with -one of the flags --distribute or --no-site-packages... Additionally if -your system has python3.X as the default you might need to do -virtualenv --python=python2.7 or --python=python2.6) +.. note:: -(You might note that we've done an in-package install of -virtualenv... this isn't the most traditional way to install -virtualenv, and it might not even be the best. But it's the easiest -to explain without having to explain python packaging, and it works.) + If you have problems here, consider trying to install virtualenv + with the ``--distribute`` or ``--no-site-packages`` options. If + your system's default Python is in the 3.x series you man need to + run ``virtualenv`` with the ``--python=python2.7`` or + ``--python=python2.6`` options. -At this point your development environment should be setup. You don't -need to do anything else. However if at any point you update your -codebase, you should also run: +The above provides an in-package install of ``virtualenv``. While this +is counter to the conventional ``virtualenv`` configuration, it is +more reliable and considerably easier to configure and illustrate. If +you're familiar with Python packaging you may consider deploying with +your preferred the method. - ./bin/python setup.py develop --upgrade && ./bin/gmg migrate. +This concludes the initial configuration of the development +environment. In the future, if at any point you want update your +codebase, you should also run: :: + ./bin/python setup.py develop --upgrade && ./bin/gmg migrate. -Test-start the server -===================== +Deploy MediaGoblin Services +--------------------------- -At this point mediagoblin should be properly installed. You can -test-start it like so: +Test the Server +~~~~~~~~~~~~~~~ - ./lazyserver.sh --server-name=broadcast +At this point MediaGoblin should be properly installed. You can +test the deployment with the following command: :: -You should be able to connect to the machine on port 6543 in your -browser to ensure that things are working. + ./lazyserver.sh --server-name=broadcast +You should be able to connect to the machine on port 6543 in your +browser to confirm that the service is operable. -Hook up to your webserver via fastcgi -===================================== +Connect the Webserver to MediaGoblin with FastCGI +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This section describes how to configure MediaGoblin to work via -fastcgi. Our configuration example will use nginx, as the author of -this manual feels that nginx config files are easier to understand if -you have no experience with any type of configuration file. However, -the translations to apache are not too hard. - -Also for the sake of this document, we'll assume you're running -mediagoblin on the domain mediagoblin.example.org and your -mediagoblin checkout in /srv/mediagoblin.example.org/mediagoblin/ - -Now in reality, you won't be running mediagoblin on such a domain or -in such a directory, but it should be easy enough to move your stuff -over. - -Anyway, in such an environment, make a config file in the normal place -you'd make such an nginx config file... probably -/etc/nginx/sites-available/mediagoblin.example.conf (and symlink said -file over to /etc/nginx/sites-enabled/ to turn it on) - -Now put in that file: - - server { - ################################################# - # Stock useful config options, but ignore them :) - ################################################# - server_name mediagoblin.example.org www.mediagoblin.example.org; - include /etc/nginx/mime.types; - - access_log /var/log/nginx/mediagoblin.example.access.log; - error_log /var/log/nginx/mediagoblin.example.error.log; - - autoindex off; - default_type application/octet-stream; - sendfile on; - - # Gzip - gzip on; - gzip_min_length 1024; - gzip_buffers 4 32k; - gzip_types text/plain text/html application/x-javascript text/javascript text/xml text/css; - - ##################################### - # Mounting MediaGoblin stuff - # This is the section you should read - ##################################### - - # MediaGoblin's stock static files: CSS, JS, etc. - location /mgoblin_static/ { - alias /srv/mediagoblin.example.org/mediagoblin/static/; - } - - # Instance specific media: - location /mgoblin_media/ { - alias /srv/mediagoblin.example.org/mediagoblin/user_dev/media/public/; - } - - # Mounting MediaGoblin itself via fastcgi. - location / { - fastcgi_pass 127.0.0.1:26543; - include /etc/nginx/fastcgi_params; - } - } - -At this point your config file should be properly set up to handle -serving mediagoblin. Now all you need to do is run it! - -Let's do a quick test. Restart nginx so it picks up your changes, -something probably like: - - sudo /etc/init.d/nginx restart - -Now start up MediaGoblin. "cd" to the MediaGoblin checkout and run: - - ./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543 - -Visit the site you've set up in your browser, eg -http://example.mediagoblin.org (except with the real domain name or IP -you're expecting to use. ;)) - - -A more permanent mediagoblin process via paste -============================================== - -At this point, you probably have a MediaGoblin instance that for most -intents and purposes works, but lazyserver is... well, lazy. You -probably want to set up a process that you can launch in init scripts. - -Try something along the lines of: - - CELERY_ALWAYS_EAGER=true \ - /srv/mediagoblin.example.org/mediagoblin/bin/paster serve \ - /srv/mediagoblin.example.org/mediagoblin/paste.ini \ - --pid-file=/tmp/mediagoblin.pid \ - --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543 \ - -Feel free to adjust any of this. - -Note that this runs MediaGoblin in "always eager" mode with Celery. -This is fine for development and smaller deployments. However if -you're getting into the really large deployment category, consider -reading the section of this manual on Celery. +fastcgi. Our configuration example will use nginx, however, you may +use any webserver of your choice as long as it supports the FastCGI +protocol. If you do not already have a web server, consider nginx, as +the configuration files may be more clear than the +alternatives. + +Create a configuration file at +``/srv/mediagoblin.example.org/nginx.conf`` and create a symbolic link +into a directory that will be included in your ``nginx`` configuration +(e.g. "``/etc/nginx/sites-enabled`` or ``/etc/nginx/conf.d``) with +one of the following commands (as the root user:) :: + + ln -s /srv/mediagoblin.example.org/nginx.conf /etc/nginx/conf.d/ + ln -s /srv/mediagoblin.example.org/nginx.conf /etc/nginx/sites-enabled/ + +Modify these commands and locations depending on your preferences and +the existing configuration of your nginx instance. The contents of +this ``nginx.conf`` file should be modeled on the following: :: + + server { + ################################################# + # Stock useful config options, but ignore them :) + ################################################# + include /etc/nginx/mime.types; + + autoindex off; + default_type application/octet-stream; + sendfile on; + + # Gzip + gzip on; + gzip_min_length 1024; + gzip_buffers 4 32k; + gzip_types text/plain text/html application/x-javascript text/javascript text/xml text/css; + + ##################################### + # Mounting MediaGoblin stuff + # This is the section you should read + ##################################### + + server_name mediagoblin.example.org www.mediagoblin.example.org; + access_log /var/log/nginx/mediagoblin.example.access.log; + error_log /var/log/nginx/mediagoblin.example.error.log; + + # MediaGoblin's stock static files: CSS, JS, etc. + location /mgoblin_static/ { + alias /srv/mediagoblin.example.org/mediagoblin/static/; + } + + # Instance specific media: + location /mgoblin_media/ { + alias /srv/mediagoblin.example.org/mediagoblin/user_dev/media/public/; + } + + # Mounting MediaGoblin itself via fastcgi. + location / { + fastcgi_pass 127.0.0.1:26543; + include /etc/nginx/fastcgi_params; + } + } + +Now, nginx instance is configured to serve the MediaGoblin +application. Perform a quick test to ensure that this configuration +works. Restart nginx so it picks up your changes, with a command that +resembles one of the following (as the root user:) :: + + sudo /etc/init.d/nginx restart + sudo /etc/rc.d/nginx restart + +Now start MediaGoblin. Use the following command sequence as an +example: :: + + cd /srv/mediagoblin.example.org/mediagoblin/ + ./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543 + +Visit the site you've set up in your browser by visiting +. You should see MediaGoblin! + +Production MediaGoblin Deployments with Paste +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The instance configured with ``lazyserver`` is not ideal for a +production MediaGoblin deployment. Ideally, you should be able to use +a a control script (i.e. init script.) to launch and restart the +MediaGoblin process. + +Use the following command as the basis for such a script: :: + + CELERY_ALWAYS_EAGER=true \ + /srv/mediagoblin.example.org/mediagoblin/bin/paster serve \ + /srv/mediagoblin.example.org/mediagoblin/paste.ini \ + --pid-file=/tmp/mediagoblin.pid \ + --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543 \ + +.. note:: + + The above configuration places MediaGoblin in "always eager" mode + with Celery. This is fine for development and smaller + deployments. However, if you're getting into the really large + deployment category, consider reading the section of this manual on + Celery. -- cgit v1.2.3 From ccff46ab4001f18173fbb55f5664cd905fae4608 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 30 Oct 2011 23:29:06 -0500 Subject: Configuring MediaGoblin, a loose sketch of documentation. --- docs/source/configuration.rst | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 docs/source/configuration.rst (limited to 'docs/source') diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst new file mode 100644 index 00000000..93cc4a17 --- /dev/null +++ b/docs/source/configuration.rst @@ -0,0 +1,38 @@ +.. _configuration-chapter: + +======================== +Configuring MediaGoblin +======================== + +So! You've got MediaGoblin up and running, but you need to adjust +some configuration parameters. Well you've come to the right place! + +MediaGoblin's config files +========================== + +When configuring MediaGoblin, there are two files you might want to +make local modified versions of, and one extra file that might be +helpful to look at. Let's examine these. + +mediagoblin.ini + The config file for MediaGoblin, the application. If you want to + tweak settings for MediaGoblin, you'll usually tweak them here. + +paste.ini + +mediagoblin.ini + + +Making local copies +=================== + + +Common changes +============== + + +Celery +====== + +We should point to another celery-specific section of the document +actually :) -- cgit v1.2.3 From 9205872e5a049a03c90494486b54c0424d8d1682 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Mon, 31 Oct 2011 21:58:21 -0500 Subject: First section of configuring mediagoblin --- docs/source/configuration.rst | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'docs/source') diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 93cc4a17..354a7098 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -19,8 +19,25 @@ mediagoblin.ini tweak settings for MediaGoblin, you'll usually tweak them here. paste.ini - -mediagoblin.ini + Primarily a server configuration file, on the python side + (specifically, on the wsgi side, via `paste deploy + `_ / `paste script + `_). It also sets up some + middleware that you can mostly ignore, except to configure + sessions... more on that later. If you are adding a different + python server other than fastcgi / plain http, you might configure + it here. Mostly you won't touch this file as much, probably. + + +There's one more file that you certainly won't change unless you're +making coding contributions to mediagoblin, but which can be useful to +read and reference: + +mediagoblin/config_spec.ini + This file is actually a specification for mediagoblin.ini itself, as + a config file! It defines types and defaults. Sometimes it's a + good place to look for documentation... or to find out that hidden + option that we didn't tell you about. :) Making local copies -- cgit v1.2.3 From 07913ec999a05f4b347f8abf35a54549a18d9262 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Mon, 31 Oct 2011 22:07:12 -0500 Subject: Added the "making local copies" section to configuration.rst --- docs/source/configuration.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'docs/source') diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 354a7098..040b926d 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -43,6 +43,23 @@ mediagoblin/config_spec.ini Making local copies =================== +Assuming you're doing the virtualenv setup described elsewhere in this +manual and you need to make local tweaks to the config files, there's +an easy way to do that. + +To make changes to mediagoblin.ini: + + cp mediagoblin.ini mediagoblin_local.ini + +To make changes to paste.ini: + cp paste.ini paste_local.ini + +From here you should be able to make direct adjustments to the files, +and most of the commands described elsewhere in this manual will "notice" +your local config files and use those instead of the non-local version. + +(Note that all commands provide a way to pass in a specific config +file also, usually by a -cf flag.) Common changes ============== -- cgit v1.2.3 From 506f1f07aeee67d06fe7ffdda00bcdd442b8e864 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Mon, 31 Oct 2011 22:08:30 -0500 Subject: Making docs changes per Jim's suggestions. --- docs/source/configuration.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/source') diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 040b926d..0d8bf5ec 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -15,18 +15,18 @@ make local modified versions of, and one extra file that might be helpful to look at. Let's examine these. mediagoblin.ini - The config file for MediaGoblin, the application. If you want to + This is the config file for MediaGoblin, the application. If you want to tweak settings for MediaGoblin, you'll usually tweak them here. paste.ini - Primarily a server configuration file, on the python side + This is primarily a server configuration file, on the python side (specifically, on the wsgi side, via `paste deploy `_ / `paste script `_). It also sets up some middleware that you can mostly ignore, except to configure sessions... more on that later. If you are adding a different python server other than fastcgi / plain http, you might configure - it here. Mostly you won't touch this file as much, probably. + it here. You probably won't need to change this file very much. There's one more file that you certainly won't change unless you're -- cgit v1.2.3 From 49fca84b9f508b677ed8a339667ffbffec498bd4 Mon Sep 17 00:00:00 2001 From: Jim Campbell Date: Mon, 31 Oct 2011 22:20:00 -0500 Subject: docs - tweaked configuration.rst for style. --- docs/source/configuration.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs/source') diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 0d8bf5ec..7eb61ec4 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -36,16 +36,16 @@ read and reference: mediagoblin/config_spec.ini This file is actually a specification for mediagoblin.ini itself, as a config file! It defines types and defaults. Sometimes it's a - good place to look for documentation... or to find out that hidden + good place to look for documentation... or to find that hidden option that we didn't tell you about. :) Making local copies =================== -Assuming you're doing the virtualenv setup described elsewhere in this -manual and you need to make local tweaks to the config files, there's -an easy way to do that. +Let's assume you're doing the virtualenv setup described elsewhere in this +manual, and you need to make local tweaks to the config files. How do you do +that? Let's see. To make changes to mediagoblin.ini: -- cgit v1.2.3 From 14fbfd18afc09ad5e1768d2604df340aeec09cc7 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Mon, 31 Oct 2011 22:26:47 -0500 Subject: Enabling email notifications documentation! --- docs/source/configuration.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'docs/source') diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 0d8bf5ec..b6c55900 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -64,6 +64,28 @@ file also, usually by a -cf flag.) Common changes ============== +Enabling email notifications +---------------------------- + +You'll almost certainly want to enable sending emails. By default, +MediaGoblin doesn't really do this... for the sake of developer +convenience, it runs in "email debug mode". Change this: + + email_debug_mode = false + +You can (and should) change the "from" email address by setting +``email_sender_address``. + +Note that you need a mailer daemon running for this to work. + +If you have more custom SMTP settings, you also have the following +options at your disposal, which are all optional, and do exactly what +they sound like. + + - email_smtp_host + - email_smtp_port + - email_smtp_user + - email_smtp_pass Celery ====== -- cgit v1.2.3 From 28ce1d11533a8bfb14efa3de4004994f367b018f Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Mon, 31 Oct 2011 22:40:39 -0500 Subject: A cop-out section for all other config changes --- docs/source/configuration.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'docs/source') diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index b6c55900..38e712c9 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -87,6 +87,17 @@ they sound like. - email_smtp_user - email_smtp_pass +All other configuration changes +------------------------------- + +To be perfectly honest, there are quite a few options and I'm not +going to be able to get to documanting them all in time for 0.1.0. + +So here's a cop-out section saying that if you get into trouble, hop +onto IRC and we'll help you out: + + #mediagoblin on irc.freenode.net + Celery ====== -- cgit v1.2.3 From b31269d5976977662178ec20d83a2a78e60ce9df Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Mon, 31 Oct 2011 22:42:30 -0500 Subject: Added configuration to the index --- docs/source/index.rst | 1 + 1 file changed, 1 insertion(+) (limited to 'docs/source') diff --git a/docs/source/index.rst b/docs/source/index.rst index 088b5359..e9f3993e 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -14,6 +14,7 @@ Table of Contents: foreword about deploying + configuration help theming codebase -- cgit v1.2.3 From 8efddbf2986524ad777b671af9935b44d009103e Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Wed, 2 Nov 2011 09:09:35 -0500 Subject: 0.1.0, also in the docs file! ;) --- docs/source/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/source') diff --git a/docs/source/conf.py b/docs/source/conf.py index 7ea3a340..eee9900f 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -48,9 +48,9 @@ copyright = u'2011, Free Software Foundation, Inc and contributors' # built documents. # # The short X.Y version. -version = '0.0.5' +version = '0.1.0' # The full version, including alpha/beta/rc tags. -release = '0.0.5' +release = '0.1.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -- cgit v1.2.3 From 99192f2452f75c0d8b0f04eefa0dd74f10e61e31 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Thu, 3 Nov 2011 09:41:48 -0500 Subject: Recommendation to install flup! --- docs/source/deploying.rst | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs/source') diff --git a/docs/source/deploying.rst b/docs/source/deploying.rst index 5f07a1d2..14665546 100644 --- a/docs/source/deploying.rst +++ b/docs/source/deploying.rst @@ -127,6 +127,11 @@ more reliable and considerably easier to configure and illustrate. If you're familiar with Python packaging you may consider deploying with your preferred the method. +Assuming you are going to deploy with fastcgi, you should also install +flup: :: + + ./bin/easy_install flup + This concludes the initial configuration of the development environment. In the future, if at any point you want update your codebase, you should also run: :: -- cgit v1.2.3 From a5d50276b9fa26859766d4e4b52240f3d8f55896 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Thu, 3 Nov 2011 10:23:53 -0500 Subject: We left out a critical fastcgi variable from the nginx config --- docs/source/deploying.rst | 1 + 1 file changed, 1 insertion(+) (limited to 'docs/source') diff --git a/docs/source/deploying.rst b/docs/source/deploying.rst index 14665546..61baddb8 100644 --- a/docs/source/deploying.rst +++ b/docs/source/deploying.rst @@ -213,6 +213,7 @@ this ``nginx.conf`` file should be modeled on the following: :: # Mounting MediaGoblin itself via fastcgi. location / { fastcgi_pass 127.0.0.1:26543; + fastcgi_param PATH_INFO $fastcgi_script_name; include /etc/nginx/fastcgi_params; } } -- cgit v1.2.3 From 996e9b4c4f6ad1ee8a03f5348a65895c88d040fe Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Thu, 3 Nov 2011 10:27:39 -0500 Subject: Indentation was off by one ;) --- docs/source/deploying.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/source') diff --git a/docs/source/deploying.rst b/docs/source/deploying.rst index 61baddb8..cbdf9a4c 100644 --- a/docs/source/deploying.rst +++ b/docs/source/deploying.rst @@ -213,7 +213,7 @@ this ``nginx.conf`` file should be modeled on the following: :: # Mounting MediaGoblin itself via fastcgi. location / { fastcgi_pass 127.0.0.1:26543; - fastcgi_param PATH_INFO $fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_script_name; include /etc/nginx/fastcgi_params; } } -- cgit v1.2.3 From 02e99c78cdb91d3dab52675d11f29bf834e4f6ca Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Thu, 3 Nov 2011 10:59:47 -0500 Subject: A correct but compact set of instructions for fastcgi on nginx --- docs/source/deploying.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'docs/source') diff --git a/docs/source/deploying.rst b/docs/source/deploying.rst index cbdf9a4c..fbe829af 100644 --- a/docs/source/deploying.rst +++ b/docs/source/deploying.rst @@ -213,8 +213,12 @@ this ``nginx.conf`` file should be modeled on the following: :: # Mounting MediaGoblin itself via fastcgi. location / { fastcgi_pass 127.0.0.1:26543; - fastcgi_param PATH_INFO $fastcgi_script_name; include /etc/nginx/fastcgi_params; + + # our understanding vs nginx's handling of script_name vs + # path_info don't match :) + fastcgi_param PATH_INFO $fastcgi_script_name; + fastcgi_param SCRIPT_NAME ""; } } -- cgit v1.2.3 From baf03e9bf93483c474b5fcba379452071a8ae029 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Thu, 3 Nov 2011 17:10:39 -0500 Subject: Correcting the mediagoblin static/media aliases in the deployment guide --- docs/source/deploying.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/source') diff --git a/docs/source/deploying.rst b/docs/source/deploying.rst index fbe829af..c2ba0c47 100644 --- a/docs/source/deploying.rst +++ b/docs/source/deploying.rst @@ -202,12 +202,12 @@ this ``nginx.conf`` file should be modeled on the following: :: # MediaGoblin's stock static files: CSS, JS, etc. location /mgoblin_static/ { - alias /srv/mediagoblin.example.org/mediagoblin/static/; + alias /srv/mediagoblin.example.org/mediagoblin/mediagoblin/static/; } # Instance specific media: location /mgoblin_media/ { - alias /srv/mediagoblin.example.org/mediagoblin/user_dev/media/public/; + alias /srv/mediagoblin.example.org/mediagoblin/mediagoblin/user_dev/media/public/; } # Mounting MediaGoblin itself via fastcgi. -- cgit v1.2.3 From fc5695c538f2b6d230c0e431087e9c10e6deac6c Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Sat, 19 Nov 2011 10:43:31 -0800 Subject: incorrect path in nginx config --- docs/source/deploying.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/source') diff --git a/docs/source/deploying.rst b/docs/source/deploying.rst index c2ba0c47..b944a3d3 100644 --- a/docs/source/deploying.rst +++ b/docs/source/deploying.rst @@ -207,7 +207,7 @@ this ``nginx.conf`` file should be modeled on the following: :: # Instance specific media: location /mgoblin_media/ { - alias /srv/mediagoblin.example.org/mediagoblin/mediagoblin/user_dev/media/public/; + alias /srv/mediagoblin.example.org/mediagoblin/user_dev/media/public/; } # Mounting MediaGoblin itself via fastcgi. -- cgit v1.2.3