Comments (13)
http://mmcgrana.github.io/2012/09/getting-started-with-go-on-heroku.html
I not tested it, but basic idea is that you can upload binary to your repo, or create new folder. And then add Gor to Procfile, smth like: "gor: gor listen -p 8080"
from goreplay.
I'm guessing it would have to be integrated into a heroku buildpack since it needs to run along side whatever our web machines are running. And that's assuming Heroku's dynos allow gor to listen on a port that's already bound by the application being hosted.
from goreplay.
I believe this is not current possible, since the slug doesn't contain the 'gor' binary.
There would be a way to achieve this programatically letting a regular worker running on the background, as follows:
package main
import (
"fmt"
"os"
"github.com/buger/gor/listener"
)
func main() {
// Set up listener
s := listener.ListenerSettings{}
s.Port = os.Getenv("PORT") // $PORT, where container is running
s.Address = "0.0.0.0" // Default address?
s.ReplayAddress = "0.0.0.0" // Replay server address `Address:Port`
s.ReplayLimit = 10 // Limit if required
// Run listener based on `s` settings
fmt.Println("Listening on", s.Address, s.Port)
listener.Run(s)
}
But this would need few changes on the Gor API. For instance, the listener.Run()
method relies on the Settings
global variable created out of the CLI parameters. A Run()
method, or call it whatever you like, having a listener.ListenerSettings
as a parameter would do then thing, so you could set on your program your own requirements and then fire the listener up.
Still, I'm not sure what would be the listener address inside the slug.
from goreplay.
Or i can add HTTP input to Gor, so requests can be send to Gor without raw sockets.
from goreplay.
Anyway, I was wrong, it is possible handle directly from outside the listener.Settings global var:
package main
import (
"fmt"
"os"
"github.com/buger/gor/listener"
)
func main() {
// Set up listener
s := listener.Settings
s.Port = os.Getenv("PORT") // $PORT, where container is running
s.Address = "0.0.0.0" // Default address?
s.ReplayAddress = "0.0.0.0" // Replay server address `Address:Port`
s.ReplayLimit = 10 // Limit if required
// Run listener based on `s` settings
fmt.Println("Listening on", s.Address, s.Port)
listener.Run()
}
Didn't tested it though.
from goreplay.
I see a lot of potential in gor by making it more modulary. Something like this:
listener = gor.Listener{Port: os.Getenv("PORT"), ListenAddress: "0.0.0.0", ReplayAddress: "0.0.0.0"} // or gor.NewListener....
fmt.Println(listener.Settings)
listener.Listen()
from goreplay.
@slawosz i'm open to new ideas, feel free to create new issue, with nice description what you want to see and why it may be needed, so we can continue this conversation.
from goreplay.
I added http input https://github.com/buger/gor#guarante-of-replay-and-http-input
It can help in cases like Heroku.
from goreplay.
I'm looking at implementing exactly this use case. Has anyone here put this concept into practice on Heroku?
from goreplay.
@doublerebel you mean HTTP input or embedding Gor as library?
from goreplay.
@buger Both, actually. Embedding Gor as library and listening for HTTP input on the port of the Heroku-hosted application.
from goreplay.
I see, it should be possible same way i write tests:
https://github.com/buger/gor/blob/master/input_raw_test.go
input := gor.NewRAWInput("localhost:80")
output := gor.NewTCPOutput("replay:27017")
gor.Plugins.Inputs = []io.Reader{input}
gor.Plugins.Outputs = []io.Writer{output}
gor.Start()
Currently problem that all code is located in main
package. So to make it work like above we need to move all Gor code to new package, and leave only 1 file in main
package which will generate binary.
Not sure if i can/willing to do it in near future, but if someone wants i will help.
from goreplay.
I made it as far as getting a Gor buildpack onto Heroku. The problem I'm running into is that sudo
is required for --input-raw
, and as far as I can tell, Heroku doesn't expose root access to the application context.
from goreplay.
Related Issues (20)
- java middleware with kafka out(json-format) miss req_boy
- The transfer fails for POST requests that exceed a certain size. HOT 2
- make build error, ldbus
- [Question]: How do I use the --input-raw-max-wait parameter HOT 1
- Can GoReplay capture HTTPS traffic in port 443?
- how to know the host when replay to multiple env
- is this support mirror traffic audio streaming request?
- [Question]: What does goreplay mean by what it records into the file
- Are PRO and Enterprise Version still available? HOT 1
- –http-original-host parameter does not take effect HOT 2
- could goreplay record SIP (Session initialization Protocol)?
- File format description is outdated HOT 1
- Goreplay was unable to read Solr requests after a certain length. HOT 4
- Request Rewriting not working as expected with regex HOT 2
- I want to stop forwarding of a specific request path HOT 2
- Is there a version that supports REHL5.7 HOT 1
- The response body is truncated HOT 2
- Goreplay not capturing actual user traffic that’s reaching varnish (port: 8983) HOT 16
- ~25% of Requests are not captured by goreplay when compared with production HOT 6
- TCP replay not working. HOT 1
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 goreplay.