ByteNite CLI

CLI app to manage distributed apps

How to upload an app

To develop a distributed app for ByteNite, follow these steps:

1. Initialize the App Directory:

  • Purpose: This command sets up your project with a standard directory structure, ensuring consistency and
    compatibility with ByteNite's system.
  • Execution: Run bytenite app new [app name] in your command line interface. Replace [app name] with your
    desired application name.
  • Directory Structure:
    • app/: Contains the main application script.
      • main.py: Entry point of your application.
    • manifest.json: Describes your app’s metadata.
    • schema.json: Defines the JSON schema for input data.
    • tests/: Directory for storing test files.
    • examples/: Directory for example use cases.

This command streamlines the initial setup, allowing you to focus on developing the application itself.

2. Develop the Main Script

  • Objective: The main.py script is where you'll implement the core functionality of your app. This includes
    handling input data, processing it according to your app's logic, and generating output.
  • Key Tasks: Handle input (data.bin), read metadata (metadata.json), process data, output
    to $TASK_DIR/results, and manage errors.
    • Handling Input: Your script should start by reading the data.bin file located in the task directory. This
      file
      contains the input data for your task.
    • Understanding Metadata: The data type and other relevant metadata are contained in metadata.json. Your
      script
      should parse this file to understand how to process data.bin.
    • Processing Data: Implement the logic to process the input data as per the requirements of your application.
    • Generating Output: Any output generated by your script should be saved in the $TASK_DIR/results directory.
      The
      ByteNite system will consider files in this directory as the output of your task.
    • Error Handling and Logging: Include robust error handling and logging mechanisms to ensure smooth operation
      and
      ease of debugging.

3. Configuring the Manifest (manifest.json)

  • Purpose: The manifest file is essential for defining your application's identity and operational parameters in the
    ByteNite system.
  • Content:
    • id: A unique identifier for your app.
    • platform: Specify the target platform, like "python-docker".
    • version: Version of your app.
    • description: A brief overview of what your app does.
    • entrypoint: Indicate the main script, typically main.py.
    • input_type and output_type: Describe the types of data your app handles.
    • platform_config: Configuration specific to the platform, like Docker container details.
  • Best Practices: Ensure accuracy and clarity. This file guides ByteNite in how to deploy and run your application,
    so it's crucial that the information is correct and comprehensive.

4. Create Test and Example Files

  • Purpose: Demonstrate and validate app functionality.
  • Execution: Add relevant test cases in the tests/ directory and usage examples in examples/ to demonstrate and
    validate your app's functionality.

5. Package and Submit Your App

  • Purpose: Prepare your application for deployment on the ByteNite system by packaging it into a format that is
    compatible and can be easily uploaded.
  • Execution:
    • Packaging: Run bytenite app package [app_dir] [output_file], replacing [app_dir] with your app's directory path and [output_file] with the output file name (it should have .tar.gz extension). This
      command compiles your app into a tar.gz file.
    • Authenticating: If you're not already authenticated run bytenite auth, it will open a ByteNite
      authentication page on your browser. The login is automatic if you're already logged in on ByteNite platform.
    • Uploading: Execute bytenite app upload [output_file] to upload the packaged app. Ensure the [app_dir] is the
      same directory used for packaging. This step submits your app to the ByteNite system for deployment.

Commands

  • Authentication: bytenite auth
  • New App Initialization: bytenite app new [app name]
  • Packaging the App: bytenite app package [app_dir]
  • Uploading the App: bytenite app upload [tar_file]
  • List existing apps: bytenite app list
  • Download an app for local development: bytenite app download [app_id]