<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="css/bootstrap.min.css"
          crossorigin="anonymous">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Converge</title>
</head>
<body>

<script src="js/bootstrap.bundle.min.js"
        crossorigin="anonymous"></script>

<div class="container">

    <h1>Usage</h1>

    <h2>Continous integration jobs</h2>

    <p>
        In a continous integration job, download the agent, chmod it and run it.
    </p>
    <pre>
    # for HTTP hosted server
    curl http://HOSTPORT/docs/agent > agent
     ./agent ws://HOST:PORT/agent/ID
    chmod 755 agent

    # for HTTPS hosted server
     curl https://HOSTPORT/docs/agent > agent
     ./agent wss://HOST:PORT/agent/ID
    chmod 755 agent
</pre>
    <p>
        Above, HOST:PORT is the hostname:port of the converge server and ID is a unique id
        for the job. This should not conflict with other ids.

        This connects the agent to the converge server. Clients can now connect to converge
        to establish a connection to the CI job through converge.
    </p>

    <h2>Local clients: with a local TCP forwarding proxy</h2>

    This option is less convenient than the proxy command because it requires two separate
    commands to execute.

    <p>
        Local clients can connect using regular ssh and sftp commands through a tunnel that
        translates a local TCP port to a websocket connection in converge.

        First step is to download the tcptows program (see below):
    </p>

    <pre>
    # for HTTP hosted server
    curl http://HOST:PORT/docs/tcptows > tcptows
    chmod 755 tcptows
    ./tcptows 10000 ws://HOST:PORT/client/ID

    # for HTTPS hosted server
    curl https://HOST:PORT/docs/tcptows > tcptows
    chmod 755 tcptows
    ./tcptows 10000 wss://HOST:PORT/client/ID
</pre>

    <p>
        This runs a local client that allows SSH to port 10000 and connects to converge using
        a websocket connection.</p>

    <p>
        Next step is to run a local SSH of SFTP client:
    </p>

    <pre>
    ssh -p 10000 abc@localhost
    sftp -oPort 10000 abc@localhost
    </pre>

    <p>
        <code>abc</code> is a fixed user defined by converge. It has a very exciting password.
    </p>

    <h1>Downloads</h1>

    <ul>
        <li><a href="/docs/agent">agent</a>: The agent to run inside aa CI job
        </li>
        <li><a href="/docs/tcptows">tcptows</a>: TCP to WS tunnel for allowing regular
            SSH and SFTP clients to connect to converge.
        </li>
        <li><a href="/docs/convergeproxy">convergeproxy</a>: SSH proxy command that can be directly used by ssh
        </li>
    </ul>

</div>

</body>
</html>