Skip to main content

Get Started

Step-by-step instructions on how to set up your Environment to start running your first JavaScript program using Scramjet Cloud Platform (SCP), Command Line Interface, and GitHub Samples. Be sure to check the compatibility section below before getting started. Login or registration required before an attempt to go through the Get Started steps. Upon completing those steps, Scramjet's /Hello platform-sample, is expected to return an output printed on your terminal.

To run the "Hello" Sequence

  1. POSIX terminal interface compatible console
    POSIX is required for the ability of a user to install and execute Scramjet's CLI.

    • For Windows install WSL2 if not installed. To verify installation use the following command-line.
    wsl -l -v
  2. Install Node.js version 18.x LTS and NPM package manager

  3. Registration for a Free Trial is required in order to retrieve the API Token for later use

  4. Install Scramjet's Command Line Interface (CLI)
    In order to install Command-Line Interface to communicate with Scramjet's Cloud Platform, a user must execute the following command on their terminal.

    npm i -g @scramjet/cli
  5. Generate Scramjet Cloud Platform Token

    Token can only be generated after registration. A token is valid for 15 days only. Generate Token button found under the user's Profile > Settings > Generate Token. A user must copy and save the token for later use.

    warning

    Token will not be saved. After generation, please store it on your device.

    icon

  6. Use Scramjet Cloud Platform CLI Token
    On a new terminal, configure and access Scramjet's Cloud Platform by using the generated token command-line. A token is valid for 15 days only. Beyond this timeframe, user must re-generate a new token and re-execute the command-line. An example below illustrate how a complete token might look like.
    si config print for printing out the registered token.

    For example:

    si config set json '{"middlewareApiUrl":
    "https://api.scramjet.cloud/api/v1", "env":
    "production", "token": "<GENERATEDTOKEN>"}'
  7. Download Samples
    Scramjet's platform-samples GitHub repository provides you with sample programs for you as a user to run and explore. Use git clone at your desired directory to obtain Scramjet's platform-samples GitHub repository on your machine.

    git clone https://github.com/scramjetorg/platform-samples
    • index.js | index.py - The main file which includes the user's logic.
      info

      Typescript source code must be transpiled into JavaScript before packaging :::

    • package.json - Manifest file that describes this particular Sequence
    • dependencies - Using your terminal to preinstalled all dependencies that are needed to execute the Sequence in the same directory as the rest of the files.
    • files (Optionally) Any additional files your code needs must be in the same directory, in case those files are needed a user must add the file name and extension to package.json under the Assets property section (data files, text files, libs and binaries etc.)
    • requirements.txt (for Python only) prerequisite file for packaging a Python program.
      info

      All Python dependencies should be installed in the same directory as the rest of required files :::

    • tsconfig.json (for TypeScript only) it is a crucial file for managing your project, it creates itself after running tsc --init command, which initializes the TypeScript project. This file is where you can set the compiler options. Basically this is an indicator for TypeScript, which says that the project in which this file lies and all the other sub folders should be managed by TypeScript and it also tells TypeScript how to compile all the *.ts files in the project.
  8. Locate Samples directory
    The defaulted path to Scramjet's GitHub cloned repository is home/Sam/platform-samples. Locate the directory for /Hello sample to proceed with the below steps. The path may differ from one programming languages to another.

    For example:

    $ home/Sam/platform-samples/javascript/hello
  9. Transpiling from TypeScript to JavaScript
    Skip this section if using the JavaScript or Python samples. For the samples written in TypeScript as a user, transpile those files into JavaScript before proceeding with the below steps. Transpiling will convert all .ts files found in a given directory into JavaScript files ready to be packed in a Sequence. Install dependencies before running the below code, e.g. npm install

    npm run build
  10. Packaging a Sequence
    For a user to be able to run a Sequence as an Instance on Scramjet Cloud Platform, several files might be required for packing in a tar.gz format (linux tarball). Keep in mind that the below command-line will only check whether the package.json file is located in the same directory or not, but not the rest of required files.

    si sequence pack <path/to/folder>

  1. Send the Sequence to Scramjet Cloud Platform (SCP)
    A user can send the packaged tar.gz file to Scramjet Cloud Platform with the following command-line. A Sequence-id will be provided in return. Use --progress at the end of the command-line in order to monitor the progress.

    si sequence send <path/to/filename.tar.gz> --progress

  1. Check listed Sequences on Scramjet Cloud Platform (SCP)
    One Sequence which have been already packed with the source code should be at least available in the list to be able to start a Sequence. A user can have a maximum of 5 Instances running at a given time on their Native Hub subscription.

    si sequence list
  2. Start a Sequence
    After starting a Sequence an Instance-id which is the running Sequence (program) will be returned.

    si sequence start <Sequence-id>
    tip

    Use a hyphen (-) as a shortcut (alias) for the last Sequence-id or the last Instance-id

    si sequance start -
  3. Send data to the Instance
    Sending data to an Instance can either be sent from a file path/to/file or by directly typing it on your terminal

    si instance input <Instance-id> path/to/file

    If you do not specify the path of the input file you can insert the input by typing it directly on the terminal on a newline after executing si inst input <Instance-id> and hitting Enter to send each input, Ctrl+C to exit sending data process. A user can continuously update the output by not executing the exit command Ctrl+C and instead opening a new parallel terminal and typing si inst output <Instance-id>. With each additional input on the first terminal the output will be automatically updated on the second terminal where si inst output <Instance-id> is being processed. It is more evident if you are typing your input through your keyboard on the first terminal instead of relating the input to a path/to/file. Similar method can be applied if an Instance requires processing several files as input.

    A user will not be able to view the output for the new input if the Instance status is "completed" . A user can only retrieve the output of the transformed input if the Instance status is "running" use the following command-line to check the status.

    si instance info <Instance-id>
  4. View the output data of an Instance
    Instance output can be viewed for 3 minutes after the Instance has finished running (status: "completed"). To check the status of an Instance, use si inst info <instance-id> to determine whether or not it has been completed.

    si instance output <Instance-id>
  5. Kill an Instance**
    After returning the output you can stop an Instance from running by the following command

    si instance kill <Instance-id>
  6. Save output (Optional)
    The output will be saved to a file in the current directory.

    si inst output <Instance-id> | tee filename.txt

Congratulations! You have successfully installed and run your first program. More sample programs are available at Scramjet's platform-samples repository on GitHub.


Compatibility

Scramjet Interface (SI) command-line should be compatible with the following operating systems. In case of an issues please contact our Team and Scramjet Team will gladly be of some assistance.

Any Linux based operating system - Ubuntu, Debian, Fedora, Centos, RedHat, Arch, SuSE and derivatives.
Any BSD compatible system - MacOS, FreeBSD, OpenBSD
Windows Subsystem for Linux (WSL)
MinGW, Git Bash and similar solutions on Windows.

STH should work on:
Any Linux based operating system - Ubuntu, Debian, Fedora, Centos, RedHat, Arch, SuSE and derivatives.
Any BSD compatible system - MacOS, FreeBSD, OpenBSD
Windows Subsystem for Linux (WSL)


Was it helpful?

Didn't find information needed?

Join our Scramjet Community on Discord, where you can get help from our engineers directly.