Skip to content

Commit

Permalink
Merge pull request #1259 from StackStorm/0.8.3
Browse files Browse the repository at this point in the history
0.8.3
  • Loading branch information
manasdk committed Mar 23, 2015
2 parents cb1ab25 + 73e3910 commit 780bbf7
Show file tree
Hide file tree
Showing 25 changed files with 277 additions and 182 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
Changelog
=========

v0.8.3 - March 23, 2015
-----------------------

* Don't allow ``run-remote-script`` actions without an ``entry_point`` attribute - throw an
exception when running an action. (improvement)
* Fix ``packs.setup_virtualenv`` command so it works correctly if user specified multiple packs
search paths. (bug-fix)
* Update sensor container to use ``auth.api_url`` setting when talking to the API (e.g. when
accessing a datastore, etc.). This way it also works correctly if sensor container is running
on a different host than the API. (bug-fix)

v0.8.2 - March 10, 2015
-----------------------

Expand Down
1 change: 0 additions & 1 deletion conf/st2.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ serve_webui_files = True
# allow_origin = http://myhost1.example.com:3000,http://myhost2.example.com:3000

[sensorcontainer]
actionexecution_base_url = http://0.0.0.0:9101/actionexecutions
logging = st2reactor/conf/logging.sensorcontainer.conf

[rulesengine]
Expand Down
9 changes: 0 additions & 9 deletions contrib/packs/actions/pack_mgmt/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from oslo.config import cfg

import st2common.config as config
from st2actions.runners.pythonrunner import Action
from st2common.constants.pack import SYSTEM_PACK_NAMES

Expand All @@ -14,17 +13,9 @@
class UninstallPackAction(Action):
def __init__(self, config=None):
super(UninstallPackAction, self).__init__(config=config)
self.initialize()

self._base_virtualenvs_path = os.path.join(cfg.CONF.system.base_path,
'virtualenvs/')

def initialize(self):
try:
config.parse_args()
except:
pass

def run(self, packs, abs_repo_base):
intersection = BLOCKED_PACKS & frozenset(packs)
if len(intersection) > 0:
Expand Down
30 changes: 13 additions & 17 deletions contrib/packs/actions/pack_mgmt/setup_virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

from oslo.config import cfg

import st2common.config as config
from st2common.util.shell import run_command
from st2actions.runners.pythonrunner import Action
from st2common.constants.pack import PACK_NAME_WHITELIST
from st2common.constants.pack import BASE_PACK_REQUIREMENTS
from st2common.content.utils import get_system_packs_base_path
from st2common.content.utils import get_packs_base_paths
from st2common.content.utils import get_pack_directory


class SetupVirtualEnvironmentAction(Action):
Expand All @@ -25,18 +25,9 @@ class SetupVirtualEnvironmentAction(Action):

def __init__(self, config=None):
super(SetupVirtualEnvironmentAction, self).__init__(config=config)
self.initialize()

self._base_packs_path = get_system_packs_base_path()
self._base_virtualenvs_path = os.path.join(cfg.CONF.system.base_path,
'virtualenvs/')

def initialize(self):
try:
config.parse_args()
except:
pass

def run(self, packs):
"""
:param packs: A list of packs to create the environment for.
Expand All @@ -51,6 +42,8 @@ def run(self, packs):

def _setup_pack_virtualenv(self, pack_name):
"""
Setup virtual environment for the provided pack.
:param pack_name: Pack name.
:type pack_name: ``str``
"""
Expand All @@ -61,13 +54,16 @@ def _setup_pack_virtualenv(self, pack_name):

self.logger.debug('Setting up virtualenv for pack "%s"' % (pack_name))

pack_name = pipes.quote(pack_name)
pack_path = os.path.join(self._base_packs_path, pack_name)
virtualenv_path = os.path.join(self._base_virtualenvs_path, pack_name)
virtualenv_path = os.path.join(self._base_virtualenvs_path, pipes.quote(pack_name))

# Ensure pack directory exists in one of the search paths
pack_path = get_pack_directory(pack_name=pack_name)

# Ensure virtualenvs directory exists
if not os.path.isdir(pack_path):
raise Exception('Pack "%s" is not installed' % (pack_name))
if not pack_path:
packs_base_paths = get_packs_base_paths()
search_paths = ', '.join(packs_base_paths)
msg = 'Pack "%s" is not installed. Looked in: %s' % (pack_name, search_paths)
raise Exception(msg)

if not os.path.exists(self._base_virtualenvs_path):
os.makedirs(self._base_virtualenvs_path)
Expand Down
9 changes: 1 addition & 8 deletions contrib/packs/actions/pack_mgmt/unload.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from oslo.config import cfg

import st2common.config as config
from st2common.models.db import db_setup
from st2actions.runners.pythonrunner import Action
from st2common.persistence import reactor
Expand All @@ -16,13 +15,7 @@ def __init__(self, config=None):
self.initialize()

def initialize(self):
# 1. Parse config
try:
config.parse_args()
except:
pass

# 2. Setup db connection
# 1. Setup db connection
username = cfg.CONF.database.username if hasattr(cfg.CONF.database, 'username') else None
password = cfg.CONF.database.password if hasattr(cfg.CONF.database, 'password') else None
db_setup(cfg.CONF.database.db_name, cfg.CONF.database.host, cfg.CONF.database.port,
Expand Down
4 changes: 2 additions & 2 deletions docs/source/actionchain.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ For a user to provide input to an ActionChain the input parameters must be defin

---
# ...
parameters:
params:
input1:
type: "string"
required: true
Expand All @@ -84,7 +84,7 @@ The input parameter ``input1`` can now be referenced in the parameters field of
-
name: "action1"
ref: "core.local"
parameters:
params:
action1_input: "{{input1}}"
# ...

Expand Down
5 changes: 4 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ def previous_version(ver):
'github_mistral': ('/~https://github.com/StackStorm/mistral/blob/master/%s', None),
'github_contrib':
('/~https://github.com/StackStorm/st2contrib/blob/master/%s', None),
'github_devenv': ('/~https://github.com/StackStorm/devenv/blob/master/%s', None)
'github_devenv': ('/~https://github.com/StackStorm/devenv/blob/master/%s', None),
'github_st2web': ('/~https://github.com/StackStorm/st2web/blob/master/%s', None),
'ops_latest':
('https://ops.stackstorm.net/releases/st2/' + release + '/%s/', None)
}

# Inserted at the bottom of all rst files.
Expand Down
1 change: 0 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Contents:

overview
install/index
webui
video
start
packs
Expand Down
5 changes: 2 additions & 3 deletions docs/source/install/deb.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ Pip
The easiest way to install these is to use the requirements.txt file from the |st2| downloads server. This is kept up to date for the version specified in the path.

::

curl -q -k -O https://ops.stackstorm.net/releases/st2/0.8.2/requirements.txt
curl -q -k -O https://raw.githubusercontent.com/StackStorm/st2/0.8.3/requirements.txt
pip install -r requirements.txt

RabbitMQ
Expand All @@ -33,7 +32,7 @@ In order to get the latest version of RabbitMQ, you will want to follow the dire

::

http://www.rabbitmq.com/install-rpm.html
http://www.rabbitmq.com/install-debian.html

Once you have RabbitMQ installed, you will need to run the following commands to enable certain plugins.

Expand Down
1 change: 1 addition & 0 deletions docs/source/install/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Installation should take about 5 min. Grab a coffee and watch :doc:`/video` whil
Docker <docker>
deploy
sources
webui


.. note::
Expand Down
80 changes: 80 additions & 0 deletions docs/source/install/webui.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
Web UI
======

st2web is an Angular-based web application. It allows you to control the whole process of execution, from running an action to seeing the results of the execution. It also helps you to explore workflow executions up to the results of individual tasks. All in real time.

Express installation
--------------------

Production version of st2web is pre-installed on st2express and any other st2_deploy installation. You can access the UI by accessing ``/webui`` endpoint of st2api server. For vagrant deployment of st2express, it would be http://172.168.90.50:9101/webui.

It can also be installed by extracting the latest tar-ball from :ops_latest:`webui` into ``/opt/stackstorm/static/webui``.

This type of installation has no additional requirements.

Production
----------

st2web is a pure html5 application and consist only of js scripts, html templates, css styles and a number of static files including custom fonts and svg images. For application to work correctly, all this files should be served to the browser. In most cases, the particular web server doesn't matter. It might be apache or nginx, pecan or node.js, files could be served from local server or uploaded to S3, Heroku or even Github Pages.

The application itself is running within the browser so API endpoint should be accessible to the user itself, not the static server.

To generate the latest production version of st2web from the source code, run ``gulp production`` inside st2web directory. Then, copy ``build/`` directory to the server public folder or upload it to the cloud. For more information on working with gulp, please see :github_st2web:`README.md`.

Development
-----------

With production version it is almost impossible to make any changes in code, besides configuration. In case any changes are needed, development version has to be installed. For information on how to install development version, please refer to :github_st2web:`README.md`.

Configuration
-------------

For UI to work properly, both client and server side should be configured accordingly.

On a UI side, there is a file ``config.js`` in a root of the project which contains the list of servers this UI can connect to. The file consists of an array of objects, each have a ``name``, ``url`` and ``auth`` properties.

::

hosts: [{
name: 'Express Deployment',
url: 'http://172.168.90.50:9101',
auth: true
},{
name: 'Development Environment',
url: 'http://172.168.50.50:9101'
}]


Multiple servers could be configured for user to pick from. To disconnect from the current server and return to login screen, pick 'Disconnect' from the drop down at the top right corner of the UI.

On an ST2 side, `CORS <https://en.wikipedia.org/wiki/Cross-origin_resource_sharing>`__ should also be properly configured. In st2.conf, ``allow_origin`` property of the [api] section should contain the Origin header browser sends with every request. For example, if you have deployed UI on its own server and accessing it using url `http://webui.example.com:8000`, your config should look like that:

::

[api]
# Host and port to bind the API server.
host = 0.0.0.0
port = 9101
logging = st2api/conf/logging.conf
# List of allowed origins for CORS, use when deploying st2web client
# The URL must match the one the browser uses to access the st2web
allow_origin = http://webui.example.com:8000

Origin consists of scheme, hostname and port (if it isn't 80). Path (including tailing slash) should be omitted.

Please note that some of the origins is already included by default and do not require additional configuration:

* http://localhost:3000 - development version of `gulp` running locally
* http://localhost:9101,http://127.0.0.1:9101 - st2api pecan deployment (st2_deploy default)
* `api_url` from [auth] section of st2.conf

Also, please note that although this is not recommended and will undermine your security, you can allow every web UI deployment to connect to your server by setting ``allow_origin = *``.

Authentication
--------------

To configure st2web to support authentication, edit ``config.js`` and add ``auth:true`` to every server that supports authentication. To enable authentication on a server side, please refer to :doc:`/install/deploy`.

For now, UI assumes st2auth is running on the same server with st2api on the port 9100. This is known issue and will be fixed in the next release.

It is highly recommended to only use authentication alongside with SSL encryption (for st2web, st2api and st2auth) to mitigate possible MITM attacks and avoid sending passwords and auth tokens in plain text.
Loading

0 comments on commit 780bbf7

Please sign in to comment.