Skip to content

Instantly share code, notes, and snippets.

@partkyle
Created December 23, 2015 23:21
Show Gist options
  • Save partkyle/45871e2660ceaf916add to your computer and use it in GitHub Desktop.
Save partkyle/45871e2660ceaf916add to your computer and use it in GitHub Desktop.
Test Stackstorm Environment

Stackstorm Vagrant

Simple vagrantfile that uses the stackstorm one time installer.

The IP address is hardcoded to 192.168.33.10, so change that if you want it to be something else.

Run vagrant up in this directory. When it completes go to https://192.168.33.10/setup. There will be a security notifiction about the certificate, but it is safe to ignore as it is just a self-signed certificate. Follow the setup instructions and the site should be accesible.

You can skip chatops if it is not something you need.

Installing packtest

Packtest repo: https://github.com/partkyle-test/packtest

Packtest is something that we built to test various workflows.

The username and password are the ones you used during setup.

Run these command inside the VM. You will see a bunch of python errors for SSL.

$ export ST2_AUTH_TOKEN=`st2 auth -t -p <password> <username>`
$ st2 run packs.install packs=packtest repo_url=partkyle-test/packtest
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
./usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
./usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
./usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
./usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
./usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
./usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
./usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)

/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
id: 567b27235c8d972a0e893862
action.ref: packs.install
status: succeeded
start_timestamp: 2015-12-23T22:58:43.059538Z
end_timestamp: 2015-12-23T22:58:59.654148Z
+--------------------------+-----------+--------------------------+-------------------------+--------------------------+
| id                       | status    | task                     | action                  | start_timestamp          |
+--------------------------+-----------+--------------------------+-------------------------+--------------------------+
| 567b27231fa2fe1417cbd424 | succeeded | download                 | packs.download          | Wed, 23 Dec 2015         |
|                          |           |                          |                         | 22:58:43 UTC             |
| 567b27261fa2fe1417cbd426 | succeeded | virtualenv_prerun        | packs.virtualenv_prerun | Wed, 23 Dec 2015         |
|                          |           |                          |                         | 22:58:46 UTC             |
| 567b27281fa2fe1417cbd428 | succeeded | setup_virtualenv         | packs.setup_virtualenv  | Wed, 23 Dec 2015         |
|                          |           |                          |                         | 22:58:48 UTC             |
| 567b272c1fa2fe1417cbd42a | succeeded | reload                   | packs.load              | Wed, 23 Dec 2015         |
|                          |           |                          |                         | 22:58:52 UTC             |
| 567b27301fa2fe1417cbd42c | succeeded | restart-sensor-container | packs.restart_component | Wed, 23 Dec 2015         |
|                          |           |                          |                         | 22:58:56 UTC             |
+--------------------------+-----------+--------------------------+-------------------------+--------------------------+

This should have installed the "packtest" pack, and you should see the actions and rules available.

Optional: ngrok settings

Got to https://ngrok.com/ and download the binary.

I've used this ngrok command to enable github to access the service (you will need to have an ngrok command and be "logged in" on your local machine to use this feature; don't worry, it's free)

Run this command from your OSX machine. It sets up a tunnel from Public Internet -> ngrok -> your laptop -> VM network

Note: This is the ip that you have set in the Vagrantfile.

$ ngrok tcp 172.16.33.10:9101
Vagrant.configure(2) do |config|
config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
vb.cpus = "4"
end
config.vm.provision 'shell', inline: <<-SHELL
curl -sSL https://install.stackstorm.com/ | sudo sh
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment