Skip to main content

Jump

Intro

Utility that builds a 2-level menu based on applications and their available environments. The setup that we have is that this utility resides on a 'jump' server and every time a user connects to that server (via SSH), the menu script is executed.

In our current setup, there is 2 kinds of servers: one type which has serverpilot installed and another one which is a vanilla ubuntu installation (both explained below)

This script also handles some applications/servers not being in the jumpgate.

The menu is built based on a JSON response from a server. The response looks like this:

{
    "items": [
        {
            "id": "b84b07c8-738e-4088-969f-0ee4c822fd3a",
            "in_jumpgate": false,
            "name": "test-app",
            "servers": [
                {
                    "display_name": "Staging",
                    "id": "939bf2ce-d0e0-42b8-8600-f7f7ef5db72b",
                    "ip": "1.2.3.4",
                    "is_serverpilot": true,
                    "name": "staging",
                    "port": 222,
                    "user": "serverpilot"
                },
                {
                    "display_name": "Production",
                    "id": "6a7f9169-5fe3-49d2-8eea-bfafcc53f4de",
                    "ip": "1.2.3.4",
                    "is_serverpilot": false,
                    "name": "prod",
                    "port": 222,
                    "user": "root"
                }
            ]
        }, {
            "id": "81a1afa3-f610-4b64-935f-7e93c025209b",
            "in_jumpgate": true,
            "last_backup": 1538352010,
            "name": "another-test-app",
            "servers": [
                {
                    "created_at": 1533644177,
                    "display_name": "Staging",
                    "id": "939bf2ce-d0e0-42b8-8600-f7f7ef5db72b",
                    "ip": "1.2.3.4",
                    "is_serverpilot": true,
                    "name": "staging",
                    "port": 222,
                    "updated_at": 1533808205,
                    "user": "serverpilot"
                }, {
                     "created_at": 1533644177,
                     "display_name": "Acceptance",
                     "id": "939bf2ce-d0e0-42b8-8600-f7f7ef5db72b",
                     "ip": "1.2.3.4",
                     "is_serverpilot": true,
                     "name": "acceptance",
                     "port": 222,
                     "updated_at": 1533808205,
                     "user": "serverpilot"
                 }
            ]
        }
    ]
}

This creates a menu like so:

Note that only the 2nd item is shown because the first one has the property in_jumpgate set to False. When you select an app, you get a list of its available servers (environments):

After selecting an item the SSH connection will be forwarded to that server.

Installation

To install the jumpgate script, run the following command:

$ wget https://github.com/opper/jump/blob/master/install.sh | bash

This will install the jumpgate in the following directory: /opt/jump. After the installation is done, create and populate an .env file in the root directory of the script with the following values:

  • AUTH_KEY: If you use any kind of authentication when retrieving the items. If not, leave it empty.
  • AUTH_HEADER: If you use authentication (via a header) set this to the value of your header.
  • ENDPOINT: API endpoint from where to fetch the list of applications.

After this is done, you can start using the jumpgate.

Usage

As mentioned above, there's 2 ways to use this. One is locally on your machine and another one is in one central server. The latter is perfect for a team since every user just needs to ssh to the central server and everyone will see the same applications and servers (for now it does not have permission-checking built in).

Locally

If you'd like to run the script locally (assuming you've run the install script above), you just need to use jump.

On a central server

After installing the script, there's a couple things that you'd need to do.

  • In /etc/skel create an .ssh folder and generate a privatey (and public) key with ssh-keygen -t rsa. What this will do is have each created user have the same key when connecting to a remote server.
  • Copy the generated key to any authorized_keys file on any server(s) you want reachable from the script.
  • Add the following inside the .bash_profile file: jump && exit. This will execute on every user login and when the user decides to exit, it will also exit the session on the jump server.

Then you can create any user and have them use the jumpgate.

As an extra security step, add a user's own key (aka from their own laptop or pc or what have you) to the authorized_keys file for their user on the jumpgate.

Todo:

  • figure way to handle .env file after installation
  • add to pypi for easy install

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyjump-1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyjump-1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file pyjump-1.0.tar.gz.

File metadata

  • Download URL: pyjump-1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for pyjump-1.0.tar.gz
Algorithm Hash digest
SHA256 cd43369543201141d95754232134c1c74095ae4e5766b0ce875709c879b7cc9a
MD5 d27e6c5b14d418a05eedb34f2c4b8e2f
BLAKE2b-256 abce5406a52cff48c1a957db45368c8ff7ddddb706b0f322861fe26b11be5d0b

See more details on using hashes here.

File details

Details for the file pyjump-1.0-py3-none-any.whl.

File metadata

  • Download URL: pyjump-1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for pyjump-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c92bdec40dec7dba86ad1bb2664569144abd1478df69998960acd5f6c9e079fc
MD5 81873549fea005d8986910a3567f15c8
BLAKE2b-256 70ab10614c0deb95d834000e721022e32d0164a4247d6b08b671ba618301f7ce

See more details on using hashes here.

Release history Release notifications | RSS feed

1.3

1 file

1.2

2 files

1.1

2 files

This release

1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page