-
Notifications
You must be signed in to change notification settings - Fork 492
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
Add egbuilder #1058
Merged
Merged
Add egbuilder #1058
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
19bf2b0
egbuild init commmand
suchen-sci 0a14336
finish 'init', 'add' command for egbuilder
suchen-sci 5bc80ad
fix typo
suchen-sci 475a3e8
refactor egbuilder
suchen-sci 74f8b95
finish egbuilder build command
suchen-sci 924257d
finish egbuilder run command
suchen-sci f14cd62
add examples to egbuilder
suchen-sci 6b5c2e2
rename resoruces to controllers
suchen-sci 42b1971
add doc for egbuilder
suchen-sci 3d82d1e
add test
suchen-sci b37b492
update doc
suchen-sci db37d62
update doc
suchen-sci b0f7e8a
update makefile
suchen-sci 9cf97e2
fix bug in unit test
suchen-sci 26d46a7
udpate based on review
suchen-sci 8ff39fc
rebase
suchen-sci File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add doc for egbuilder
- Loading branch information
commit 42b19713a2aecb6a0af6647b79801a2f0a4f8a2d
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
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
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,139 @@ | ||
# egbuilder | ||
`egbuilder` is a command-line tool that enables you to create, build, and run Easegress with custom plugins. | ||
|
||
## Init a custom plugin project | ||
The `egbuilder init` command helps initialize a custom plugin project, creating the necessary directories and files for users to get started. | ||
|
||
``` | ||
egbuilder init --repo github.com/your/repo \ | ||
--filters=MyFilter1,MyFilter2 \ | ||
--controllers=MyController1,MyController2 | ||
``` | ||
|
||
The example above will create following directories and files. | ||
``` | ||
. | ||
├── .egbuilderrc | ||
├── controllers | ||
│ ├── mycontroller1 | ||
│ │ └── mycontroller1.go | ||
│ └── mycontroller2 | ||
│ └── mycontroller2.go | ||
├── filters | ||
│ ├── myfilter1 | ||
│ │ └── myfilter1.go | ||
│ └── myfilter2 | ||
│ └── myfilter2.go | ||
├── go.mod | ||
├── go.sum | ||
└── registry | ||
└── registry.go | ||
``` | ||
The `.egbuilderrc` file is a configuration file that can be used by the `egbuilder add` and `egbuilder run` commands. The `registry/registry.go` file contains code generated to register custom filters and controllers with Easegress. The `controllers` and `filters` directories contain the necessary variables, structures, and methods to get started. | ||
|
||
## Add more plugins | ||
The `egbuilder add` command allows you to add more custom filters and controllers to an existing custom plugin project. | ||
|
||
``` | ||
egbuilder add --filters=MyFilter3,MyFilter4 \ | ||
--controllers=MyController3,MyController4 | ||
``` | ||
|
||
The above example will add following directories and files. | ||
``` | ||
. | ||
├── controllers | ||
... | ||
│ ├── mycontroller3 | ||
│ │ └── mycontroller3.go | ||
│ └── mycontroller4 | ||
│ └── mycontroller4.go | ||
├── filters | ||
... | ||
│ ├── myfilter3 | ||
│ │ └── myfilter3.go | ||
│ └── myfilter4 | ||
│ └── myfilter4.go | ||
... | ||
``` | ||
The `.egbuilderrc` and `registry/registry.go` files will be updated based on changes. | ||
|
||
## Build Easegress with custom plugins | ||
The `egbuilder build` command is used to compile Easegress with custom plugins. | ||
|
||
``` | ||
egbuilder build -f build.yaml | ||
``` | ||
where `build.yaml` contains: | ||
```yaml | ||
# egVersion: the version of Easegress used for building. Supports versions v2.5.2 and later. | ||
# An empty egVersion value means using the latest version of Easegress. | ||
egVersion: v2.5.2 | ||
|
||
# plugins: custom plugins. | ||
# It is recommended to use plugins created with "egbuilder init". | ||
# Generally, any plugin containing "registry/registry.go" can utilize the "egbuilder build" command. | ||
# You can initialize a project to see for yourself. | ||
plugins: | ||
- module: github.com/your/repo | ||
version: "" | ||
replacement: "." | ||
- module: github.com/other/repo | ||
|
||
# output: path of output file. | ||
output: "./easegress-server" | ||
|
||
# raceDetector: "-race" flag for go build | ||
raceDetector: false | ||
|
||
# skipBuild: if true, not build, just generate temp directory and files. | ||
# still clean up if skipCleanUp is false. | ||
skipBuild: false | ||
|
||
# skipCleanup: if true, not clean up the temp directory. | ||
skipCleanup: false | ||
|
||
# buildFlags: flags for "go build" command | ||
buildFlags: [] | ||
|
||
# modFlags: flags for "go mod" command | ||
modFlags: [] | ||
|
||
# compile: GOOS, GOARCH, GOARM env variable for "go build" | ||
compile: | ||
os: "" | ||
arch: "" | ||
arm: "" | ||
cgo: false | ||
``` | ||
|
||
## Run Easegress in current directory | ||
The `egbuilder run` command is used to run Easegress with custom plugins in current working directory. | ||
|
||
``` | ||
egbuilder run // run with default | ||
egbuilder run -f run.yaml // run with config | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these are shell commands, |
||
``` | ||
where `run.yaml` contains: | ||
|
||
```yaml | ||
egVersion: v2.5.2 | ||
|
||
# egServerArgs: args for easegress-server | ||
# egServerArgs: ["--config-file", "easegress-server.yaml"] means | ||
# ./easegress-server --config-file easegress-server.yaml | ||
egServerArgs: [] | ||
|
||
raceDetector: false | ||
skipBuild: false | ||
skipCleanup: false | ||
buildFlags: [] | ||
modFlags: [] | ||
compile: | ||
os: "" | ||
arch: "" | ||
arm: "" | ||
cgo: false | ||
``` | ||
|
||
So, `egbuilder run` can be seen as executing `egbuilder build` first, followed by running `./easegress-server`. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the meaning of this line is not clear enough, please rewrite it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all updated, please check!