Comments (13)
I would also agree an example of invoking a separate binary would be of great use here.
from go-plugin.
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.
from go-plugin.
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.
from go-plugin.
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
from go-plugin.
I want a example for Reattach
from go-plugin.
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:
https://github.com/hashicorp/terraform/tree/master/plugin
Builtin Plugins which are dynamically loaded:
https://github.com/hashicorp/terraform/tree/master/builtin
from go-plugin.
@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.
from go-plugin.
@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.
from go-plugin.
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.
from go-plugin.
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
from go-plugin.
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.
from go-plugin.
The PR #20 was just merged which helps this, too :)
from go-plugin.
thanks for the greate work, any one has the java plugin impl?
from go-plugin.
Related Issues (20)
- support net/rpc/jsonrpc
- How can sub plugins proactively initiate requests to the main application? HOT 2
- Plugin Cmd with Chroot HOT 2
- Still actively maintained? HOT 3
- Delete the socket file by mistake HOT 2
- use shmipc-go https://github.com/cloudwego/shmipc-go/ instead
- Logs keys order is non deterministic
- Bidirectional example in python HOT 3
- Logging for a gRPC plugin in Java not working HOT 1
- Support rpc call cancellation/control via context.Context
- An abnormal termination of the plugin process results in a resource leak in the main process.
- Containerized plugins
- Client termination grace period should be configurable
- [Question] Simultaneous plugins with single host
- error encountered while scanning stdout: file already closed
- False
- how to restart plugin after subprocess exited
- Plugin stuck in broken state waiting for RPC address HOT 6
- Plug-in log output error
- Reattach in tests with versioned plugins
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-plugin.