-
Notifications
You must be signed in to change notification settings - Fork 458
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
more examples #11
Comments
Hey, maybe it helps to have a look in the plugin architecture of all the terraform plugins. I also needed a long time but this helped me a lot. Plugin Mechanism: Builtin Plugins which are dynamically loaded: |
I would also agree an example of invoking a separate binary would be of great use here. |
@darren-west the easiest way for me was to start here https://github.com/hashicorp/otto-example-app-plugin and here https://github.com/hashicorp/otto/tree/v0.2.0 (You are interested with most of the RPC and PLUGIN directories, also app/app.go and app/factory.go and command/plugin_manager.go - You can c&p them and use right away, just to start). Also terraform as reference for other features that are not available in otto was a great help. If You do it right, You can extract basic implementation and run your plugins with few clicks (yeah, without much digging at the beginning ;)). Keep in mind, go-plugin seems really "raw" idea. Most of real features (like plugin manager) need to be implemented on top of it. |
Just started to explore this package and should add that whilst the idea is simple in principle (plugin is executable, start process and RPC command between the host and plugin process) the implementation is way more complicated than that! Maybe including a simple plugin manager as part of the project that covers most use cases for new users? Something that loads all the executable plugins from a specified directory, that adhere to a specific single interface? People could get up and running pretty quickly with something like that. In fact, that is exactly what I need so once I've got something written I may be able to put together a pull request with that. |
@JalfResi https://github.com/hashicorp/otto/blob/v0.2.0/command/plugin_manager.go - does the trick as plugin manager. Atm. i'm using this code with watcher on plugins directory - works pretty well. Also, good idea to create some real world examples. |
Any updates on this? I'm trying (and failing) to produce even the most basic example of two binaries communicating using this library. Even splitting the example into two source files would help immensely, but I can't seem to get it to compile without including the implementation of Greeter(), which defeats the purpose of abstracting that implementation out into a plugin. Reading through terraform's code is tedious, at best, and in my opinion should never be a requirement to understanding a library. I'd be happy to submit a PR for documentation/examples when I understand this better, but I need some direction to move forward. |
Have to agree with the above poster; had exactly the same problem with the example being in one file and other hashicorp projects focusing on internal plugins. The dependence on "Greeter" is messy to work around. In the meantime I've had to conclude this package is just not ready for public use |
I've just worked on splitting up the single example into two binaries, which reflects how it will actually be used. While it doesn't close this issue entirely it does provide a simpler example & introduction. |
Here is my example of separating the simple single example into multiple binaries. https://github.com/hleong25/hashicorp-goplugin-separate-binary-example The main thing to get from this is that there is a library that is shared between the mainapp and plugins. The information needed is the interfaces and the plugin handshake configuration. |
The PR #20 was just merged which helps this, too :) |
If someone finds this... I wrote this https://skarlso.github.io/2018/10/29/go-plugin-tutorial/ and also have it as a PR here: #84 |
I want a example for Reattach |
thanks for the greate work, any one has the java plugin impl? |
# This is the 1st commit message: Add client option to multiplex gRPC broker connections over a single net.Conn # The commit message #2 will be skipped: # Checkpoint # The commit message #3 will be skipped: # Split muxer into client and server side # The commit message #4 will be skipped: # Fairly close, about to refactor muxers into internal package # The commit message #5 will be skipped: # Broken # The commit message #6 will be skipped: # Checkpoint, maybe not that far off but maybe a bit fucked # The commit message #7 will be skipped: # All but 4 tests passing # The commit message #8 will be skipped: # Extra debug in test # The commit message #9 will be skipped: # First iteration of blocked listener # The commit message #10 will be skipped: # Went pretty far with knocking concept. Ultimately though it's going to rely on something brittle, e.g. a connection that must live forever. Going to rip it out and drastically simplify with the restriction that you can only have one server on each side of the connection # The commit message #11 will be skipped: # lol j/k, implemented knocking over the existing streamer interface instead - not working yet # The commit message #12 will be skipped: # Fix some bugs, all tests passing except TestClient_reattachNotFound # The commit message #13 will be skipped: # Small bugfix
Hi,
Would it be possible to see more implementation examples? I'm wrapping my head around on how to create dynamically loaded plugins ;/
The text was updated successfully, but these errors were encountered: