Skip to content

Commit

Permalink
- added way to manually spin up all versions of ES for sandbox
Browse files Browse the repository at this point in the history
- edited recent PR #476
  • Loading branch information
royrusso committed Sep 12, 2019
1 parent cd2af75 commit 0a43f04
Show file tree
Hide file tree
Showing 17 changed files with 296 additions and 25 deletions.
24 changes: 19 additions & 5 deletions application.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
default_enable_ssl = False
default_ca_certs = None
default_url = 'http://localhost:9200'
is_gunicorn = "gunicorn" in os.environ.get("SERVER_SOFTWARE", "")

application = create_app()

Expand All @@ -22,7 +23,7 @@
application.config['CA_CERTS'] = os.environ.get('HQ_CA_CERTS', default_ca_certs)
application.config['DEBUG'] = os.environ.get('HQ_DEBUG', default_debug)

if os.environ.get('HQ_DEBUG')=='True':
if os.environ.get('HQ_DEBUG') == 'True':
config = find_config('logger_debug.json')
logging.config.dictConfig(config)

Expand All @@ -49,7 +50,20 @@

options, _ = parser.parse_args()

if options.debug:
config = find_config('logger_debug.json')
logging.config.dictConfig(config)
socketio.run(application, host=options.host, port=options.port, debug=options.debug)
# set default url, override with env for docker
application.config['DEFAULT_URL'] = os.environ.get('HQ_DEFAULT_URL', options.url)
application.config['ENABLE_SSL'] = os.environ.get('HQ_ENABLE_SSL', options.enable_ssl)
application.config['CA_CERTS'] = os.environ.get('HQ_CA_CERTS', options.ca_certs)

if is_gunicorn:
if options.debug:
config = find_config('logger_debug.json')
logging.config.dictConfig(config)

# we set reloader False so gunicorn doesn't call two instances of all the Flask init functions.
socketio.run(application, host=options.host, port=options.port, debug=options.debug, use_reloader=False)
else:
if options.debug:
config = find_config('logger_debug.json')
logging.config.dictConfig(config)
socketio.run(application, host=options.host, port=options.port, debug=options.debug)
Binary file modified docs/.doctrees/developer-guide.doctree
Binary file not shown.
Binary file modified docs/.doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/.doctrees/installation.doctree
Binary file not shown.
30 changes: 28 additions & 2 deletions docs/_sources/developer-guide.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,37 @@ To run tests for a specific major version of ES:

python manage.py run-tests --esv=<MAJOR_VERSION>

The code repo contains docker compose files for testing against different Elasticsearch versions. As a developer wanting to test against specific versions, do:
Manual Testing
--------------

The code repo contains docker compose files for testing against different Elasticsearch versions.

You can run these individually and then use the applicaiton to test against it:

.. code-block:: bash

cd /tests/local/v2
docker-compose up

Or you can run them all at once and test against them:

.. code-block:: bash

cd /tests/local
./run_es_versions.sh

To bring the containers down:

.. code-block:: bash

./kill_es_versions.sh

In the event of errors to the effect of "container name in use", list the containers and remove them. This will remove all stopped containers:

.. code-block:: bash

docker-compose -f v5_docker-compose.yml up
docker container ls
docker container prune

Notes
~~~~~
Expand Down
1 change: 1 addition & 0 deletions docs/_sources/installation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ Environment Variables
``HQ_DEFAULT_URL`` ``http://localhost:9200`` Default URL displayed on the initial connection screen.
``HQ_ENABLE_SSL`` False If flag is passed, assumes ssl cert will be used.
``HQ_CA_CERTS`` /path/to/your/ca.crt Path to your CA Certificate. Required if enable-ssl is passed.
``HQ_DEBUG`` False If True, enables debug level on logging.
================== ========================= ====================================================================


Expand Down
51 changes: 36 additions & 15 deletions docs/developer-guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ <h2>Table Of Contents</h2>
<li class="toctree-l2"><a class="reference internal" href="#developer-environment">Developer Environment</a></li>
<li class="toctree-l2"><a class="reference internal" href="#building-pre-releases">Building Pre-Releases</a></li>
<li class="toctree-l2"><a class="reference internal" href="#running-tests">Running Tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="#manual-testing">Manual Testing</a></li>
<li class="toctree-l2"><a class="reference internal" href="#building-documentation">Building Documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="#http-responses">HTTP Responses</a></li>
<li class="toctree-l2"><a class="reference internal" href="#issues-bugs">Issues/Bugs</a></li>
Expand Down Expand Up @@ -139,17 +140,18 @@ <h1>For Developers<a class="headerlink" href="#for-developers" title="Permalink
<li><a class="reference internal" href="#building-a-distribution" id="id6">Building a Distribution</a></li>
</ul>
</li>
<li><a class="reference internal" href="#running-tests" id="id7">Running Tests</a><ul>
<li><a class="reference internal" href="#notes" id="id8">Notes</a></li>
<li><a class="reference internal" href="#running-tests" id="id7">Running Tests</a></li>
<li><a class="reference internal" href="#manual-testing" id="id8">Manual Testing</a><ul>
<li><a class="reference internal" href="#notes" id="id9">Notes</a></li>
</ul>
</li>
<li><a class="reference internal" href="#building-documentation" id="id9">Building Documentation</a></li>
<li><a class="reference internal" href="#http-responses" id="id10">HTTP Responses</a><ul>
<li><a class="reference internal" href="#http-status" id="id11">HTTP Status</a></li>
<li><a class="reference internal" href="#response-headers" id="id12">Response Headers</a></li>
<li><a class="reference internal" href="#building-documentation" id="id10">Building Documentation</a></li>
<li><a class="reference internal" href="#http-responses" id="id11">HTTP Responses</a><ul>
<li><a class="reference internal" href="#http-status" id="id12">HTTP Status</a></li>
<li><a class="reference internal" href="#response-headers" id="id13">Response Headers</a></li>
</ul>
</li>
<li><a class="reference internal" href="#issues-bugs" id="id13">Issues/Bugs</a></li>
<li><a class="reference internal" href="#issues-bugs" id="id14">Issues/Bugs</a></li>
</ul>
</div>
<div class="section" id="contributing">
Expand Down Expand Up @@ -202,29 +204,48 @@ <h2><a class="toc-backref" href="#id7">Running Tests</a><a class="headerlink" hr
<div class="highlight-bash"><div class="highlight"><pre><span></span>python manage.py run-tests --esv<span class="o">=</span>&lt;MAJOR_VERSION&gt;
</pre></div>
</div>
<p>The code repo contains docker compose files for testing against different Elasticsearch versions. As a developer wanting to test against specific versions, do:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>docker-compose -f v5_docker-compose.yml up
</div>
<div class="section" id="manual-testing">
<h2><a class="toc-backref" href="#id8">Manual Testing</a><a class="headerlink" href="#manual-testing" title="Permalink to this headline"></a></h2>
<p>The code repo contains docker compose files for testing against different Elasticsearch versions.</p>
<p>You can run these individually and then use the applicaiton to test against it:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="nb">cd</span> /tests/local/v2
docker-compose up
</pre></div>
</div>
<p>Or you can run them all at once and test against them:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="nb">cd</span> /tests/local
./run_es_versions.sh
</pre></div>
</div>
<p>To bring the containers down:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>./kill_es_versions.sh
</pre></div>
</div>
<p>In the event of errors to the effect of &#8220;container name in use&#8221;, list the containers and remove them. This will remove all stopped containers:</p>
<div class="highlight-bash"><div class="highlight"><pre><span></span>docker container ls
docker container prune
</pre></div>
</div>
<div class="section" id="notes">
<h3><a class="toc-backref" href="#id8">Notes</a><a class="headerlink" href="#notes" title="Permalink to this headline"></a></h3>
<h3><a class="toc-backref" href="#id9">Notes</a><a class="headerlink" href="#notes" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li>Coverage report will be appear under <code class="docutils literal"><span class="pre">/tests/htmlcov</span></code>.</li>
<li>HTML report of pytest output will appear under <code class="docutils literal"><span class="pre">/tests/htmlout</span></code></li>
</ul>
</div>
</div>
<div class="section" id="building-documentation">
<h2><a class="toc-backref" href="#id9">Building Documentation</a><a class="headerlink" href="#building-documentation" title="Permalink to this headline"></a></h2>
<h2><a class="toc-backref" href="#id10">Building Documentation</a><a class="headerlink" href="#building-documentation" title="Permalink to this headline"></a></h2>
<p>Sphinx requires specific libraries that are not in the default <code class="docutils literal"><span class="pre">requirements.txt</span></code>.</p>
<p>First install the sphinx requirements: <code class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">-r</span> <span class="pre">sphinx-requirements.txt</span></code></p>
<p>To generate the documentation:</p>
<p><code class="docutils literal"><span class="pre">./sphinx-build</span> <span class="pre">-b</span> <span class="pre">html</span> <span class="pre">/path/to/docs/source</span> <span class="pre">/path/to/docs</span></code></p>
</div>
<div class="section" id="http-responses">
<h2><a class="toc-backref" href="#id10">HTTP Responses</a><a class="headerlink" href="#http-responses" title="Permalink to this headline"></a></h2>
<h2><a class="toc-backref" href="#id11">HTTP Responses</a><a class="headerlink" href="#http-responses" title="Permalink to this headline"></a></h2>
<div class="section" id="http-status">
<h3><a class="toc-backref" href="#id11">HTTP Status</a><a class="headerlink" href="#http-status" title="Permalink to this headline"></a></h3>
<h3><a class="toc-backref" href="#id12">HTTP Status</a><a class="headerlink" href="#http-status" title="Permalink to this headline"></a></h3>
<p>All response codes are included in the HTTP Status response header. There are method-specific responses to take note of:</p>
<ul class="simple">
<li>POST - Returns <code class="docutils literal"><span class="pre">201</span></code></li>
Expand All @@ -233,7 +254,7 @@ <h3><a class="toc-backref" href="#id11">HTTP Status</a><a class="headerlink" hre
</ul>
</div>
<div class="section" id="response-headers">
<h3><a class="toc-backref" href="#id12">Response Headers</a><a class="headerlink" href="#response-headers" title="Permalink to this headline"></a></h3>
<h3><a class="toc-backref" href="#id13">Response Headers</a><a class="headerlink" href="#response-headers" title="Permalink to this headline"></a></h3>
<p>Standard header response below:</p>
<div class="highlight-http"><div class="highlight"><pre><span></span><span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span> <span class="m">200</span> <span class="ne">OK</span>
<span class="na">Access-Control-Allow-Credentials</span><span class="o">:</span> <span class="l">true</span>
Expand All @@ -256,7 +277,7 @@ <h3><a class="toc-backref" href="#id12">Response Headers</a><a class="headerlink
</div>
</div>
<div class="section" id="issues-bugs">
<h2><a class="toc-backref" href="#id13">Issues/Bugs</a><a class="headerlink" href="#issues-bugs" title="Permalink to this headline"></a></h2>
<h2><a class="toc-backref" href="#id14">Issues/Bugs</a><a class="headerlink" href="#issues-bugs" title="Permalink to this headline"></a></h2>
<p>Patches, bug reports, and feature requests are all welcome through the <a class="reference external" href="https://github.com/ElasticHQ/elasticsearch-HQ/">GitHub site</a>. Contributions in the form of patches or pull requests are easier to integrate and will receive priority attention.</p>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions docs/installation.html
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ <h3><a class="toc-backref" href="#id11">Command line Parameters</a><a class="hea
<td>/path/to/your/ca.crt</td>
<td>Path to your CA Certificate. Required if enable-ssl is passed.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">HQ_DEBUG</span></code></td>
<td>False</td>
<td>If True, enables debug level on logging.</td>
</tr>
</tbody>
</table>
</div></blockquote>
Expand Down
Loading

0 comments on commit 0a43f04

Please sign in to comment.