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

Cli login and deploy #190

Closed SquattingSocrates closed 11 months ago

SquattingSocrates commented 1 year ago

This code cannot access the ~ directory:

#[lunatic::main]
fn main(mb: Mailbox<()>) {
    let config = lunatic::ProcessConfig::new().expect("should create new config");
    config.preopen_dir("~");
    spawn_link!(&config, || {
        // this process fails to access home dir
        std::fs::read_dir("~").expect("failed to read home dir");
        println!("Not happening");
    });
}
withtypes commented 1 year ago

Overall it looks good to me. Can we add a README section which explains how to use it?

SquattingSocrates commented 1 year ago

Sure, I'll add a README, no problem.

kosticmarin commented 1 year ago

@SquattingSocrates Can you add the README, I'm having trouble testing the new cli.

This is what I managed to test. Note that I didn't create a lunatic.toml not sure how this it is supposed to look when starting a new project. I've tried by creating an empty lunatic.toml and running the following

  1. cargo new cli-test start new project
  2. lunatic init init the runner to use lunatic and compile to wasm
  3. touch lunatic.toml
  4. lunatic auth -p https://localhost run auth against local provider

By following the CLI login link I was presented with a prefilled form which is not editable I accept and auth redirects me to /cli/success but now my lunatic.toml looks like this.

project_id = ""
project_url = ""
project_name = ""
provider = ""
remote = []
  1. lunatic app list Error: Failed to find authenticated provider

Probably I'm missing an important step :smile:

SquattingSocrates commented 1 year ago

Hi @kosticmarin! You did everything correctly, but you need to provide the project details. There's a command for setting the current project, listing apps and adding apps etc. I'll get the README ready by the evening today.

But for now, here's an example of how the project_* properties look like:

project_id = "2"
project_url = "project/2/env/2"
project_name = "some new project"