-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add gRPC API and shell command (#93)
- Loading branch information
Showing
38 changed files
with
3,575 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,8 +25,8 @@ go.work | |
gha-creds-*.json | ||
|
||
# Binary build with make | ||
rdme | ||
runme | ||
/rdme | ||
/runme | ||
|
||
# Logs | ||
*.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.0.1 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
exclude: ^internal/standupper/.snapshots/ | ||
- repo: https://github.com/TekWizely/pre-commit-golang | ||
rev: v1.0.0-beta.5 | ||
hooks: | ||
- id: go-fumpt | ||
- id: go-build-mod | ||
- id: go-mod-tidy | ||
- id: go-test-mod | ||
args: ["-timeout=5s"] | ||
- id: go-revive-repo-mod | ||
- id: go-staticcheck-mod | ||
- id: go-sec-repo-mod | ||
args: ["-exclude=G204,G304", "-exclude-generated"] | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/TekWizely/pre-commit-golang | ||
rev: v1.0.0-rc.1 | ||
hooks: | ||
- id: go-fumpt | ||
exclude: ^internal/gen/.*$ | ||
- id: go-build-mod | ||
- id: go-mod-tidy | ||
- id: go-test-mod | ||
args: ["-timeout=5s"] | ||
- id: go-revive-repo-mod | ||
- id: go-staticcheck-mod | ||
- id: go-sec-repo-mod | ||
args: ["-exclude=G204,G304,G404", "-exclude-generated"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
{ | ||
"go.testTimeout": "10s", | ||
"protoc": { | ||
"options": [ | ||
// It's not a typical location, you likely need to symlink it | ||
// from a location where you installed protoc. | ||
"--proto_path=/usr/local/include/protoc" | ||
] | ||
}, | ||
// Uncomment if you want to work on files in ./web. | ||
// "go.buildTags": "js,wasm" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: v1 | ||
plugins: | ||
- plugin: go | ||
out: internal/gen/proto/go | ||
opt: paths=source_relative | ||
- plugin: go-grpc | ||
out: internal/gen/proto/go | ||
opt: paths=source_relative | ||
- name: es | ||
path: ./node_modules/.bin/protoc-gen-es | ||
opt: target=ts | ||
out: internal/gen/proto/ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
version: v1 | ||
directories: | ||
- internal/api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
brew "bufbuild/buf/buf" | ||
brew "grpcurl" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Daemon/kernel functionality | ||
|
||
Install system dependencies | ||
|
||
```sh | ||
$ brew bundle --no-lock | ||
``` | ||
|
||
Let's build the project first and include working directory into PATH | ||
|
||
```sh | ||
$ cd ../.. | ||
$ make | ||
$ export CWD=$(cd ../.. && pwd | tr -d '\n') | ||
$ export PATH="$CWD:$PATH" | ||
``` | ||
|
||
## Exercise GRPC interface | ||
|
||
Bring up the server. It's GRPC based. | ||
|
||
```sh { background=true } | ||
$ runme daemon --address ./runme.sock | ||
``` | ||
|
||
Issue a simple call to the deserialize API, first set markdown input data | ||
|
||
```sh | ||
export mddata="# Ohai this is my cool headline" | ||
``` | ||
|
||
Then issue RPC call and display the result | ||
|
||
```sh { closeTerminalOnSuccess=false } | ||
$ data="$(echo $mddata | openssl base64 | tr -d '\n')" | ||
$ cd ../.. && grpcurl \ | ||
-protoset <(buf build -o -) \ | ||
-d "{\"source\": \"$data\"}" \ | ||
-plaintext \ | ||
-unix examples/daemon/runme.sock \ | ||
runme.v1.RunmeService/Deserialize | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.