added README.rst files from Atlas
This commit is contained in:
@@ -5,10 +5,10 @@ Configuring a local test environment
|
||||
tl;dr;
|
||||
======
|
||||
|
||||
This text explains how to configure *nginx* and *vaurien* to build
|
||||
a local mirror of the data to test the Wikipedia Picture of the Day
|
||||
examples while saving network bandwidth and introducing controlled
|
||||
delays and errors, thanks to the *vaurien* proxy.
|
||||
This text explains how to configure **nginx** and **vaurien** to build
|
||||
a local mirror of the data to run the Wikipedia Picture of the Day
|
||||
examples while avoiding network traffic and introducing controlled
|
||||
delays and errors for testing, thanks to the **vaurien** proxy.
|
||||
|
||||
|
||||
Rationale and overview
|
||||
@@ -20,8 +20,8 @@ images from the Wikipedia. However, we don't want to hit the Wikipedia
|
||||
with multiple requests per second while testing, and we want to be
|
||||
able to simulate high latency and random network errors.
|
||||
|
||||
For this setup I chose *nginx* as the HTTP server because it is very
|
||||
fast and easy to configure, and the *vaurien* proxy because it was
|
||||
For this setup I chose **nginx** as the HTTP server because it is very
|
||||
fast and easy to configure, and the **vaurien** proxy because it was
|
||||
designed by Mozilla to introduce delays and network errors for testing.
|
||||
|
||||
The initial fixture data, ``docroot.zip``, contains a directory
|
||||
@@ -32,22 +32,25 @@ correspond to every day of the years 2012, 2013 and 2014. The year 2012
|
||||
was a leap year, that's why there are 1096 files and not 1095.
|
||||
|
||||
Once these files are unpacked to the ``docroot/Template-POTD`` directory
|
||||
and *nginx* is configured, the ``build_fixture.py`` script can fetch the
|
||||
and **nginx** is configured, the ``build_fixture.py`` script can fetch the
|
||||
actual images from the Wikipedia for local storage in the directory
|
||||
``docroot/wikimedia/``.
|
||||
|
||||
When that is done you can configure *nginx* and *vaurien* to experiment
|
||||
When that is done you can configure **nginx** and **vaurien** to experiment
|
||||
with the ``daypicts*.py``examples without hitting the network.
|
||||
|
||||
|
||||
Instructions
|
||||
============
|
||||
|
||||
1. Unpack data
|
||||
--------------
|
||||
1. Unpack test data
|
||||
-------------------
|
||||
|
||||
Unpack the initial data and verify that 1096 files were created::
|
||||
Unpack the initial data in the ``fixture/`` directory and verify that 1096
|
||||
files were created in ``fixture/docroot/Template-POTD/``::
|
||||
|
||||
$ ls # inside the fixture/ directory
|
||||
README.rst docroot.zip
|
||||
$ unzip docroot.zip
|
||||
... many lines omitted...
|
||||
inflating: docroot/Template-POTD/2014-12-29
|
||||
@@ -57,10 +60,10 @@ Unpack the initial data and verify that 1096 files were created::
|
||||
1096
|
||||
|
||||
|
||||
2. Install *nginx*
|
||||
------------------
|
||||
2. Install **nginx**
|
||||
--------------------
|
||||
|
||||
Download and install *nginx*. I used version 1.6.2 -- the latest
|
||||
Download and install **nginx**. I used version 1.6.2 -- the latest
|
||||
stable version as I write this.
|
||||
|
||||
- Download page: http://nginx.org/en/download.html
|
||||
@@ -68,8 +71,8 @@ stable version as I write this.
|
||||
- Beginner's guide: http://nginx.org/en/docs/beginners_guide.html
|
||||
|
||||
|
||||
3. Configure *nginx*
|
||||
--------------------
|
||||
3. Configure **nginx**
|
||||
----------------------
|
||||
|
||||
Edit the the ``nginx.conf`` file to set the port and document root.
|
||||
The file is usually found in ``/usr/local/nginx/conf``, ``/etc/nginx``,
|
||||
@@ -83,10 +86,20 @@ blocks labeled ``server``. Add another ``server`` block like this one::
|
||||
listen 8001;
|
||||
|
||||
location / {
|
||||
root /full-path-to-your-directory/fixture/docroot;
|
||||
root /full-path-to.../fixture/docroot;
|
||||
}
|
||||
}
|
||||
|
||||
After editing ``nginx.conf`` the server must be started (if it's not
|
||||
running) or told to reload the configuration file::
|
||||
|
||||
$ nginx # to start, if necessary
|
||||
$ nginx -s reload # to reload the configuration
|
||||
|
||||
http://localhost:8001/Template-POTD/2014-01-01
|
||||
To test the configuration, open the URL below in a browser. Doing so
|
||||
will download a small file named ``2014-01-01`` with an HTML fragment::
|
||||
|
||||
http://localhost:8001/Template-POTD/2014-01-01
|
||||
|
||||
If the test fails, please double check the procedure just described and
|
||||
refer to the **nginx** documentation.
|
||||
|
||||
Reference in New Issue
Block a user