Spike Setup

Click here for Windows instructions

Command-line setup

  1. Download the Spike binary.

    The zip file contains three binaries:

    • spike.amd64 - 64-bit linux
    • spike.osx - OSX
    • spike.exe - 64-bit Windows

    Spike is a standalone application. It has no dependencies, and there is nothing else to install. Spike does not require sudo.

  2. Point your services to Spike as a proxy at localhost, port 9700. Note that Spike accepts HTTPS on the same port as HTTP (if client supports CONNECT method).

    Java

    Depending on which http client library you use, you can set Java system flags at your application's startup. E.g., following the instructions on Stack Overflow:

    $ JAVA_FLAGS=-Dhttp.proxyHost=localhost -Dhttp.proxyPort=9700
    $ java ${JAVA_FLAGS} ...

    Python

    If your application uses the python requests library, you can proxy your http calls as described here.

    import requests
    
    proxies = {
      "http": "http://localhost:9700",
      "https": "http://localhost:9700",
    }
    
    requests.get("http://example.org", proxies=proxies)

    or by:

    $ export HTTP_PROXY="http://localhost:9700"
    % export HTTPS_PROXY="http://localhost:9700"

    Non-proxy connections

    If your application or service does not support proxies for its outgoing requests, you can instead connect directly to Spike over a regular HTTP port. See here for instructions.

  3. Create a directory to hold Spike config files and data.
  4. Run Spike directory from command line:
    % spike.osx -d <your_spike_project_directory>
    
    # Or spike.exe for windows, spike.amd64 for 64-bit linux.
    Visit the admin UI at http://localhost:9600. There is nothing to see yet, since no services have flowed through the system yet.
  5. Add services to Spike. This can be done in one of two ways:

    • Services can be created manually in the Spike UI. A service is, at its most basic, defined as an http or https address to watch for in proxied requests.
    • Services can be created automatically from the proxy request stream, using what we call Auto-Discover mode. When Spike starts for the first time, or if there are no services defined, it will be in auto-discover mode. Auto-discover mode can also be enabled using the -auto-discover command-line flag, or from the Settings page () in the Spike UI.
    See more info on adding services here.

  6. Invoke services from your application (e.g., reload a page, etc).

    If the proxy was set up correctly, then all the outgoing services calls will have been intercepted. Let's verify that.

  7. Refresh the Spike admin UI (http://localhost:9600). You should now see the list of services that was intercepted.