lunatic-solutions / lunatic

Lunatic is an Erlang-inspired runtime for WebAssembly
https://lunatic.solutions
Apache License 2.0
4.57k stars 136 forks source link

MVP Lunatic CLI #212

Closed kosticmarin closed 12 months ago

kosticmarin commented 1 year ago

This PR adds a minimal Lunatic cli which consists of three commands (for now).

  1. lunatic login - manages user credentials which are used to authenticate to the Platform (located in ~/.lunatic/lunatic.toml. This command is also used to refresh credentials once the "session" expires.
  2. lunatic app create $NAME - bootstraps the starter project on the Platform with the given name and maps the local project to the remote one.
  3. lunatic deploy - builds the wasm and uploads it to the project which was created with the previous command, once the wasm is uploaded the application is started on the Platform.

I've c/p the whole README I've added with this PR so it easier to understand.

Lunatic platform CLI

This platform-related subset of lunatic CLI app is a command-line interface tool that allows you authenticate, manage, build and deploy programs to the lunatic platform.

Getting Started

  1. Before starting install Lunatic.

    cargo install lunatic-runtime
  2. Create a new account in Lunatic Cloud. Then, login your Lunatic CLI and connect it with Your account.
    lunatic login

    Follow instructions displayed in Your terminal and authorize the CLI.

  3. Create a new Lunatic Rust project (skip if you have an existing one).

    # Add the WebAssemby target
    rustup target add wasm32-wasi
    
    # Create a new Rust project
    cargo new hello-lunatic
    cd hello-lunatic
    # Initialize project for Lunatic 
    lunatic init
  4. Setup Your project on the Lunatic Cloud.
    lunatic app create hello-lunatic

    This will create a lunatic.toml configuration file with the following content.

    project_id = 17
    project_name = "hello-lunatic"
    domains = ["73685543-25ce-462d-b397-21bf921873d6.lunatic.run"]
    app_id = 18
    env_id = 17
  5. Deploy Your application.
    lunatic deploy

TODO's