HeadSpin Documentation
Documentation

File Layout

Layout and Config Files for On-Premise Deployment (v1)

<code class="dcode">{env}</code> is the organization name.

<code class="dcode">HEADSPIN_HOME</code> env var is set to:

1. <code class="dcode">$HOME/headspinio-unifiedcontroller/{env}-unifiedcontroller</code> on unfiedcontroller.

2. <code class="dcode">$HOME/headspinio-pboxagent/{env}-pboxagent/</code> on each proxy server.

When adding a new user to run HeadSpin, <code class="dcode">headspinio-pboxagent</code> needs to be copied entirely into the new user <code class="dcode">$HOME</code>.

Currently the cert must always be named <code class="dcode">star_headspin_io</code> even after migrating to a new domain, e.g. <code class="dcode">*.{domain}</code>. We will change this in the future so that the cert will be named <code class="dcode">star_{domain}</code> where <code class="dcode">{domain}</code> is inferred from the host name.

1. Unified Controller

User <code class="dcode">ubuntu</code> by default. Requires Ubuntu Server 16.04 or 18.04.


# Linux
/systemd/
    /mysql
    /redis
    /nginx
    /supervisor

/etc/supervisor/conf.d

# macOS not supported

# all
$HOME/
    /.ssh/
        /authorized_keys
$HEADSPIN_HOME/
    /.pbox_id_rsa
    /keys-{env}/
        /orgs.yml
        /pbox/
            /host_stf.yml
            /host_push.yml
            /host_pool.yml
            /host_config.yml
    /keys-{env}-red/
        /headspin_id_rsa{,.pub}
        /pbox_id_rsa{,.pub}
        /certs/
            /star_headspin_io/
                /star_headspin_io{.key,.pem}

2. Proxy Box

User <code class="dcode">hs</code> by default. Requires Ubuntu Server 16.04 for Android devices and MacOS 10.15+ for iOS devices.

Files of interest


# Linux
/systemd/
    /stfFIXME
    /supervisor
/certFIXME

# macOS
/FIXME
/certFIXME

# all
$HOME/
    /.ssh/
        /authorized_keys
$HEADSPIN_HOME/
    /.env
    /.host
    /keys-{org}/
        /orgs.yml
        /pbox/
            /host_stf.yml
            /host_push.yml
            /host_pool.yml
            /host_config.yml

Environment notes

  • Do not install <code class="dcode">adb</code> from apt. HeadSpin uses a custom <code class="dcode">adb</code> binary and socket.

Notes

SSH keys

  • <code class="dcode">$UNIFIED_CONTROLLER:$HOME/.ssh/authorized_keys</code> -- Add <code class="dcode">headspin_id_rsa.pub</code> here
  • <code class="dcode">$PROXY_BOX:$HOME/.ssh/authorized_keys</code> -- Add <code class="dcode">pbox_id_rsa.pub</code> here
  • <code class="dcode">$UNIFIED_CONTROLLER:$HOME/headspinio-root/{org}/.pbox_id_rsa</code>
  • <code class="dcode">$UNIFIED_CONTROLLER:$HOME/headspinio-root/{org}/keys-{org}-red/pbox_id_rsa{,.pub}</code>
  • <code class="dcode">$UNIFIED_CONTROLLER:$HOME/headspinio-root/{org}/keys-{org}-red/headspin_id_rsa{,.pub}</code>

SSL Certs

  • <code class="dcode">$UNIFIED_CONTROLLER:$HOME/headspinio-root/{org}/keys-{org}-red/star_headspin_io/star_headspin_io{.key,.pem}</code>
  • <code class="dcode">$PROXY_BOX:/STF_CERT_PATH/star_headspin_io{.key,.pem}</code>

Universal Controller units (Linux)

  • <code class="dcode">supervisorctl start headspin</code>
  • <code class="dcode">supervisorctl stop headspin</code>

Proxy Box units (Linux)

  • <code class="dcode">systemctl stop stf.slice</code>
  • <code class="dcode">systemctl start stf</code>

Proxy Box units (macOS)

  • <code class="dcode">cd $HEADSPIN_HOME</code>
  • <code class="dcode">./bin/controlfreak launchd stop</code>
  • <code class="dcode">./bin/controlfreak launchd start</code>

host_stf.yml


# Example file

{env}-us-sf-{index}-proxy-1-lin.headspin.io:
  secret: 6e45a1b0-87ec-4515-a340-fc268dbabf7b
  external_port: 7100
  provider_min_port: 7101
  provider_max_port: 7900

{env}-us-sf-{index}-proxy-2-lin.headspin.io:
  secret: ad948509-6dcb-41a5-8a6e-5417d69b40b2
  external_port: 8100
  provider_min_port: 8101
  provider_max_port: 8900

{env}-us-sf-{index}-proxy-3-lin.headspin.io:
  secret: a1a84bc0-0518-4074-8d30-9ea38f6b6ed6
  external_port: 9100
  provider_min_port: 9101
  provider_max_port: 9900

host_controlfreak.yml


{env}-us-sf-{index}-proxy-4-mac.headspin.io:
  secret: 885c057a-8754-4755-90ef-3de85ef8617e
  external_port: 8002
  apple_developer_team_id: YEN276A823

<code class="dcode">secret</code> is a uuid4 (RFC4122 section 4.4). In Python this can be generated with <code class="dcode">import uuid; uuid.uuid4()</code>

host_push.yml


# Example file

ubuntu-16.04:
  - {env}-us-sf-{index}-proxy-1-lin.headspin.io
  - {env}-us-sf-{index}-proxy-2-lin.headspin.io
  - {env}-us-sf-{index}-proxy-3-lin.headspin.io


macos-10.15:
  - {env}-us-sf-{index}-proxy-4-mac.headspin.io

host_config.yml


---
{env}-us-sf-0:
  location:
    country: United States
    city: San Francisco
    lat: 37.774929
    lon: -122.419416
    altitude: 0.0
    accuracy: 0.0
  routing:
    er: none
  hosts:
    {env}-us-sf-0-proxy-1-lin.headspin.io:
      os: ubuntu-16.04
      hardware:
        specname: cmm
      ip: 10.0.1.80
      mac: 00:e0:4c:68:af:6e
      ports:
        min:  0
        max:  0
    {env}-us-sf-0-proxy-2-lin.headspin.io:
      os: ubuntu-16.04
      hardware:
        specname: cmm
      ip: 10.0.1.163
      mac: 00:e0:4c:68:9c:9c 
      ports:
        min:  0
        max:  0
    {env}-us-sf-0-proxy-3-lin.headspin.io:
      os: ubuntu-16.04
      hardware:
        specname: cmm
      ip: 10.0.1.117
      mac: 00:e0:4c:69:2f:b8
      ports:
        min:  0
        max:  0
    {env}-us-sf-0-proxy-4-mac.headspin.io:
      os: macos-10.15
      hardware:
        specname: mini
      mac: 14:9d:99:83:33:37
      ports:
        min: 0
        max: 0