Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] CLI #10

Merged
merged 80 commits into from Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
f1c7cc9
[fix] starting develpment_server w/o clap
danielterwiel Sep 13, 2023
2a1d7f4
[doc]: added usage
danielterwiel Sep 13, 2023
b7f358a
[chore]: reimpl of clap (not running dev)
danielterwiel Sep 13, 2023
30b5a00
[feat] clap CLI `start` command
danielterwiel Sep 13, 2023
79b0f82
[feat] starting development_server using clap
danielterwiel Sep 13, 2023
c9d3512
[feat]: cargo-run on root defaults to cli/
danielterwiel Sep 13, 2023
30e3001
[err]: improved error handling for `cargo run`
danielterwiel Sep 13, 2023
dec40a0
[doc]: added CLI output help text for `start`
danielterwiel Sep 13, 2023
7751c4b
[doc]: updated README.md with ##Usage section
danielterwiel Sep 13, 2023
d396827
[feat] cargo run start args
danielterwiel Sep 13, 2023
083fbe0
[chore]: prevent dev_server from browser deadlock
danielterwiel Sep 13, 2023
315ca3f
[feat]: impl tonic client
danielterwiel Sep 14, 2023
030c81f
[fix] CLI `start` arg issues
danielterwiel Sep 14, 2023
207ce99
[bug]: status: Unimplemented, message
danielterwiel Sep 14, 2023
0d0994f
[feat]: using args to `stop`
danielterwiel Sep 14, 2023
1270284
[clean]: rm -rf cli/client.rs
danielterwiel Sep 14, 2023
a46af26
[feat] stop_server impl
danielterwiel Sep 14, 2023
8d47c66
[feat] cargo run build
danielterwiel Sep 14, 2023
e175407
[doc]: clarified README.md
danielterwiel Sep 14, 2023
cce412f
fix: `cargo run stop` bugged after build
danielterwiel Sep 14, 2023
d681de2
[chore]: cleanup
danielterwiel Sep 15, 2023
c5dd034
[fix]: duplicate start: intercept AddrInUse
danielterwiel Sep 15, 2023
6b29bf2
[chore]: cleanup for RFC
danielterwiel Sep 15, 2023
d79a184
[refactor]: duplicate addr assignment
danielterwiel Sep 15, 2023
04d0c91
[chore]: parsing tonic Response
danielterwiel Sep 15, 2023
a27ebeb
[feat]: poll fn halfway there
danielterwiel Sep 15, 2023
103f259
[chore]: output when dev server already running
danielterwiel Sep 15, 2023
2ae0533
[refactor]: tidy up
danielterwiel Sep 15, 2023
ae07e9f
[chore]: PR refactoring
danielterwiel Sep 17, 2023
0860299
[fix]: catch duplicate stop Err
danielterwiel Sep 18, 2023
a066a08
[chore]: replaced some ifs by match
danielterwiel Sep 18, 2023
ad6ce5d
[feat]: impl polling
danielterwiel Sep 18, 2023
fe6038a
[wip]: spawn dev server is not outputting prints
danielterwiel Sep 19, 2023
2ea3926
[wip]: added RUST_LOG=1 to cargo run dev
danielterwiel Sep 19, 2023
dae63be
[fix/temp]: unused variable warns
danielterwiel Sep 19, 2023
0f0f695
[feat] env_logger
danielterwiel Sep 19, 2023
7ff8f7c
[doc]: env_logger example to README.md
danielterwiel Sep 19, 2023
2a497b3
[chore]: use env RUST_LOG=trace
danielterwiel Sep 19, 2023
f80d35c
patch
SuddenlyHazel Sep 19, 2023
8d3d320
fix, fmt
SuddenlyHazel Sep 19, 2023
8768aff
clean up debug lines
SuddenlyHazel Sep 19, 2023
dd7f146
[chore]: handle TODOs
danielterwiel Sep 19, 2023
1775237
[fix]: log Echo output
danielterwiel Sep 19, 2023
968aec2
[chore]: set default log level to `debug`
danielterwiel Sep 19, 2023
5e8a4e1
[fix]: derive log level from env var
danielterwiel Sep 20, 2023
30d7860
[refactor]: cleanup: it compiles
danielterwiel Sep 20, 2023
863d45a
[fix]: open_browser wasn't handled
danielterwiel Sep 20, 2023
81b5729
[refactor]: tidyUp.iter()
danielterwiel Sep 20, 2023
ed1d771
[bug] DynError matching
danielterwiel Sep 20, 2023
9893032
[feat] Error matching using thiserror
danielterwiel Sep 20, 2023
6d9d707
[fix]: broken polling
danielterwiel Sep 20, 2023
9ea2d18
[feat] deploy using component_path
danielterwiel Sep 20, 2023
1bf776c
feat[impl]: cargo run deploy
danielterwiel Sep 20, 2023
6cae4b4
[fix]: starting development_server before deploy
danielterwiel Sep 20, 2023
4a36ec7
[feat]: extended CLI API
danielterwiel Sep 21, 2023
625369b
[chore] component_path rename
danielterwiel Sep 21, 2023
e8d068b
[chore]: set default LOG_LEVEL to info
danielterwiel Sep 22, 2023
9a4a4ac
[fix]: Echo messages output
danielterwiel Sep 22, 2023
1160299
meh
danielterwiel Sep 22, 2023
4415a5e
[bug]: start development server in background
danielterwiel Sep 22, 2023
f299023
deadlocked
danielterwiel Sep 22, 2023
61988e5
[fix] this works!!
danielterwiel Sep 22, 2023
62e1074
[chore] cleanup
danielterwiel Sep 22, 2023
75c57fa
[chore]: cleanup
danielterwiel Sep 22, 2023
c1df03a
[chore] added TODOs
danielterwiel Sep 22, 2023
459acce
[chore] clean up: --background wrap up
danielterwiel Sep 22, 2023
dc85073
[fix]: improved --background output
danielterwiel Sep 23, 2023
eae4b74
[fix]: added --quiet arg to start_background()
danielterwiel Sep 23, 2023
8af8db7
[chore]: misc regarding Results
danielterwiel Sep 25, 2023
657c90a
[fix]: don't interupt running dev_server @ deploy
danielterwiel Sep 25, 2023
6a3a4dd
[doc]: better CLI man description
danielterwiel Sep 25, 2023
30f6d49
fix: deploy without having started dev server bug
danielterwiel Sep 25, 2023
03861d3
[chore] improved polling & added some comments
danielterwiel Sep 25, 2023
b82994c
[misc]: cleanup
danielterwiel Sep 25, 2023
ec9360e
[misc]: error handling cleanup
danielterwiel Sep 25, 2023
f3596a0
[chore]: sharing .proto files across workspace
danielterwiel Sep 26, 2023
74d91da
[chore]: format errors using {:#?} i.s.o. {:?}
danielterwiel Sep 26, 2023
70d70c5
[chore]: added {cause:?} to thiserror
danielterwiel Sep 26, 2023
b19a02a
[chore]: renamed `domain` to `ip`
danielterwiel Sep 26, 2023
cdb2be5
[pkg] updated Cargo.lock
danielterwiel Sep 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Expand Up @@ -10,7 +10,8 @@
"vadimcn.vscode-lldb",
"rust-lang.rust-analyzer",
"bytecodealliance.wit-idl",
"tamasfe.even-better-toml"
"tamasfe.even-better-toml",
"zxh404.vscode-proto3"
],
"settings": {
"editor.formatOnSave": true,
Expand Down
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Expand Up @@ -7,7 +7,8 @@
"vadimcn.vscode-lldb",
"rust-lang.rust-analyzer",
"bytecodealliance.wit-idl",
"tamasfe.even-better-toml"
"tamasfe.even-better-toml",
"zxh404.vscode-proto3"
],
"unwantedRecommendations": []
}
72 changes: 53 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
@@ -1,8 +1,8 @@
[workspace]

members = [
# Tooling
"xtask",
"protos",
"cli",
"development_server",
"wasmtime_components",
Expand Down
45 changes: 42 additions & 3 deletions README.md
Expand Up @@ -5,20 +5,59 @@ Open Source Application Stack & PaaS
## Installation

```sh
cargo xtask build
cargo run build
danielterwiel marked this conversation as resolved.
Show resolved Hide resolved
```

NOTE: We opted for [cargo-xtask](https://github.com/matklad/cargo-xtask) because Cargo build.rs is [not supported for workspaces](https://github.com/rust-lang/cargo/issues/8732#issuecomment-950252765)
**IMPORTANT**: `cargo build` will fail because we have to use [cargo-xtask](https://github.com/matklad/cargo-xtask/) to build the ./components/ folder before building the project. Reason: Cargo's build.rs is [not supported for workspaces](https://github.com/rust-lang/cargo/issues/8732#issuecomment-950252765)

danielterwiel marked this conversation as resolved.
Show resolved Hide resolved
## CLI

### Info

```sh
cargo run
```

### Start Development Server

```sh
cargo run start
```

### Stop Development Server

```sh
cargo run stop
```

### Deploy

```sh
cargo run deploy --component="your_component_name"
```

## Development Server

```sh
RUST_LOG=info cargo run --package development_server
```

### Logging
## Logging

We use [env_logger](https://docs.rs/env_logger/0.10.0/env_logger/) for logging. Please see their documentation for more information on setting custom log levels, filtering, and more.

Default CLI log level is `info`.
danielterwiel marked this conversation as resolved.
Show resolved Hide resolved

Basic example usage:

```sh
RUST_LOG=error cargo run start
RUST_LOG=warn cargo run start
RUST_LOG=debug cargo run start
RUST_LOG=info cargo run start # default
RUST_LOG=trace cargo run start
```

## Community & Contributing & Help

Come join our [Discord](https://discord.gg/hKMtmdMJ)
Expand Down
12 changes: 11 additions & 1 deletion cli/Cargo.toml
Expand Up @@ -2,9 +2,19 @@
name = "cli"
version = "0.1.0"
edition = "2021"
default-run = "cli"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap-cargo = "0.11.0"
clap = { version = "4.4.2", features = ["derive"] }
env_logger = { workspace = true }
log = { workspace = true }
open = "5.0.0"
prost = "0.12.0"
thiserror = "1.0.48"
tokio = { version = "1.32.0", features = ["full"] }
tonic = { version = "0.10.0" }

[build-dependencies]
tonic-build = "0.10.0"
13 changes: 13 additions & 0 deletions cli/build.rs
@@ -0,0 +1,13 @@
use std::{env, path::PathBuf};

fn main() -> Result<(), Box<dyn std::error::Error>> {
// See https://github.com/hyperium/tonic/blob/master/examples/build.rs
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
tonic_build::configure()
.file_descriptor_set_path(out_dir.join("development_descriptor.bin"))
.compile(&["../protos/proto/development.proto"], &["../protos/proto"])
.unwrap();

tonic_build::compile_protos("../protos/proto/development.proto")?;
Ok(())
}