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

submillisecond project scaffolding #191

Closed mpope9 closed 1 year ago

mpope9 commented 1 year ago

This adds project scaffolding similar to Rails / Phoenix to generate a starter project. The structure is

project_name/
  .cargo/config.toml
  src/
    lib.rs
    main_supervisor.rs
    http_server.rs
    main.rs
  test/
    test.rs
  README.md
  Cargo.lock
  Cargo.toml

It mainly provides a starter for a supervised submillisecond server, and doesn't go as far as enforcing the MVC model that Phoenix/Rails does.

Note, trying to run the project results in:

cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.40s
     Running `lunatic run target/wasm32-wasi/debug/luney.wasm`
Error: No such file or directory (os error 2)

And I'm not entirely sure why. Putting this up early to gauge interest before I dig in more.

bkolobara commented 1 year ago

Make sure to use Rust 1.66.1, there was a regression in 1.67 that breaks opening files and environment variables in sub-processes: https://github.com/rust-lang/rust/issues/107635

mpope9 commented 1 year ago

Closing in favor of a possible cargo subcommand mentioned in #179