Skip to content
This repository has been archived by the owner on Jun 23, 2018. It is now read-only.

Commit

Permalink
CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
script-deployer committed Aug 4, 2016
1 parent 0ab8c5b commit 424f2a2
Show file tree
Hide file tree
Showing 15 changed files with 210 additions and 108 deletions.
Binary file modified build/.doctrees/creating_service/index.doctree
Binary file not shown.
Binary file modified build/.doctrees/creating_service/nstack_toolkit.doctree
Binary file not shown.
Binary file modified build/.doctrees/environment.pickle
Binary file not shown.
Binary file modified build/.doctrees/index.doctree
Binary file not shown.
Binary file modified build/.doctrees/using_service/http_gateway.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion build/_sources/creating_service/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ In this section we describe the individual components used when creating a nstac

.. toctree::

stackhut_toolkit
nstack_toolkit
service_structure
app_structure

86 changes: 57 additions & 29 deletions build/_sources/creating_service/nstack_toolkit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,20 @@ Help for any command can be displayed by running,

Displays information regarding the CLI version

``remote``
^^^^^^^^^
**TODO-mandeep**
.. code:: bash

$ nstack remote nstack-host

Set the hosted nstack server which you would like to use.

``init``
^^^^^^^^
.. code:: bash

$ nstack init stack
$ nstack init stack

============ ===========
Option Description
Expand All @@ -96,6 +105,7 @@ The ``init`` command also creates a git repo and commits the files be default.

``build``
^^^^^^^^^
**TODO-mandeep**

.. code:: bash

Expand All @@ -107,54 +117,72 @@ Option Description
``--force`` Forces the build to occur even if no file changes
============ ===========

Builds the image so that it may be tested locally or deployed to the your hosted nstack instance. This command is usually unneeded as both the ``run`` and ``deploy`` commands run a build if needed.
Builds the image on your hosted nstack instance. This command is usually unneeded as the ``boot`` command runs a build if needed.

``deploy``
^^^^^^^^^
**TODO-mandeep**

.. code:: bash

$ nstack boot

Building a service involves,
* setting up the base OS and the language stack,
* installing all OS and language packages as specified in the `Hutfile`,
* copying across all files referenced in the `Hutfile`,
* installing the StackHut control runner,
* running any auxiliary commands as specified in the `Hutfile`.
Deploys your service onto your nstack server. Once a service is deployed, it can be attached to event-sources.

Building can be time-consuming so is performed on an as-needed basis by detecting changes to the files referenced from the `Hutfile`. If this fails, or perhaps you're installing software from across the network as part of the build, you may wish to force the build to occur by passing the ``--force`` flag.
``trigger``
^^^^^^^^^
**TODO-mandeep**

.. code:: bash

$ nstack trigger service event-source [entry=]

``run``
============ ===========
Option Description
============ ===========
``entry=`` The function to send the event into
============ ===========

Attaches your service to an event-source. When an event is recieved, your service runs.

``ps``
^^^^^^^^^^^^^^^^

.. code:: bash

$ stackhut runcontainer [--force]
$ nstack ps

================ ===========
Option Description
================ ===========
``--force`` Forces build before run
================ ===========

Shows a list of all services which are *active* on your nstack server (i.e. they are been bound to an event-source). You can think of these as 'processes'. This is distincy from ``ls``, which shows you the services which have been deployed and are available to run.

Builds the image and and hosts the service locally on ``http://localhost:4001``. You can test the service either using the client-libaries or by ``curl``-ing the ``test_request.json`` file to the local server, as described in :ref:`using_index`.
``kill``
^^^^^^^^^^^^^^^^

Upon running this command the Toolkit will build the image (if required) and run the service within the container. This is exactly the same code as will be run on the hosted StackHut platform so you can be sure that if it works locally it will work in the cloud. Output from running this request is placed in the ``run_result`` directory, with the JSON response object in ``run_result\response.json``.
.. code:: bash

$ nstack kill process

``deploy``

Stop a running process.

``ls``
^^^^^^^^^^

.. code:: bash

$ stackhut deploy [--force]
$ nstack ls


Shows a list of all available services on your nstack server. These may or may not be running processes (i.e. attached to event-sources).

``rm``
^^^^^^^^^^^^^^^^

.. code:: bash

================ ===========
Option Description
================ ===========
``--force`` Forces build before deploy
================ ===========
$ nstack rm service

.. ``--no-build`` Deploy only, do not build or push image first

The deploy command packages and uploads your project to the StackHut platform where it's build remotely and then deployed live under the service address ``username/servicename`` and can be called from ``https://api.stackhut.com/run``.
Deployment requires that you have an account at StackHut and are logged in using the command line tool.
Deletes a service which from your nstack host.

.. If you've already deployed the image and just want to update the service metadata, e.g. the description, README, API docs, etc., you can run ``deploy`` with the ``--no-build`` flag and it will skip the full deploy - a much quicker operation.

1 change: 1 addition & 0 deletions build/_sources/using_service/http_gateway.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ I can attach this service to an HTTP Gateway as follows:
.. note:: by default this exposes all of the functions which you specified in your IDL. To expose a single function, you can pass the argument 'entry=myFunc'

If I wanted to double-check it is running

.. code :: bash

$ nstack ps | grep http
Expand Down
22 changes: 20 additions & 2 deletions build/creating_service/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="StackHut 0.1.x documentation" href="../index.html" />
<link rel="next" title="Service Project Structure" href="service_structure.html" />
<link rel="next" title="nstack CLI" href="nstack_toolkit.html" />
<link rel="prev" title="Tutorial" href="../getting_started/tutorial.html" />


Expand All @@ -43,6 +43,24 @@
<p>In this section we describe the individual components used when creating a nstack service</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="nstack_toolkit.html">nstack CLI</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nstack_toolkit.html#getting-started">Getting Started</a><ul>
<li class="toctree-l3"><a class="reference internal" href="nstack_toolkit.html#usage">Usage</a></li>
<li class="toctree-l3"><a class="reference internal" href="nstack_toolkit.html#commands">Commands</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="nstack_toolkit.html#info"><code class="docutils literal"><span class="pre">info</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="nstack_toolkit.html#remote"><code class="docutils literal"><span class="pre">remote</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="nstack_toolkit.html#init"><code class="docutils literal"><span class="pre">init</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="nstack_toolkit.html#build"><code class="docutils literal"><span class="pre">build</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="nstack_toolkit.html#deploy"><code class="docutils literal"><span class="pre">deploy</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="nstack_toolkit.html#trigger"><code class="docutils literal"><span class="pre">trigger</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="nstack_toolkit.html#ps"><code class="docutils literal"><span class="pre">ps</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="nstack_toolkit.html#kill"><code class="docutils literal"><span class="pre">kill</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="nstack_toolkit.html#ls"><code class="docutils literal"><span class="pre">ls</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="nstack_toolkit.html#rm"><code class="docutils literal"><span class="pre">rm</span></code></a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="service_structure.html">Service Project Structure</a><ul>
<li class="toctree-l2"><a class="reference internal" href="service_structure.html#introduction">Introduction</a></li>
<li class="toctree-l2"><a class="reference internal" href="service_structure.html#nstack-yaml">nstack.yaml</a><ul>
Expand Down Expand Up @@ -70,7 +88,7 @@ <h3>Related Topics</h3>
<ul>
<li><a href="../index.html">Documentation overview</a><ul>
<li>Previous: <a href="../getting_started/tutorial.html" title="previous chapter">Tutorial</a></li>
<li>Next: <a href="service_structure.html" title="next chapter">Service Project Structure</a></li>
<li>Next: <a href="nstack_toolkit.html" title="next chapter">nstack CLI</a></li>
</ul></li>
</ul>
</div>
Expand Down

0 comments on commit 424f2a2

Please sign in to comment.