production debugging using ActionDispatch::Integration::Session from the command-line
It may be useful to perform some requests to your controllers, from the Rails console. The following solution was tested against Rails 3.2.13, but I’m sure the tweaks should not be that big, to get it working with other versions:
after this, you can call get/post/put/etc on the session object:
The first hash represents the params to be sent to the request, and the second one, additional headers.
Most likely, your controller will require authentication. To ensure that we’re logged in, we go through the same steps as we would from a browser.
So, we request login, and then we extract the authenticity token, and then we issue a post request to perform the login. Of course, in your case, the name of the parameters might be different, so please adapt accordingly.
Once we post to the sessions controller, we can then issue requests to controllers that need authentication.
Hope you found this useful!
using rake dsl outside of the Rakefile
Just include Rake::DSL in your class/file, and then you’ll be able to do the same things as in a Rakefile.
simulate a slow connection with toxiproxy
The example above would give you a “slow” redis. I received the following error on my system:
when trying to start toxiproxy via:
But, you can just start it manually. Do a updatedb and then a locate toxiproxy in case you don’t know where your binary is, and then you can populate it like in the example above.
triggering remote builds from jenkins
If you receive this error when triggering builds from your scripts:
Authentication required <-- You are authenticated as: anonymous Groups that you are in: Permission you need to have (but didn't): hudson.model.Hudson.Read ... which is implied by: hudson.security.Permission.GenericRead ... which is implied by: hudson.model.Hudson.Administer ->
Then install this plugin, and then call the following url:
forward postgres from within vagrant to host
To be able to connect from outside to postgresql running in vagrant, make sure that postgresql.conf has this:
listen_addresses = ‘*’
And then restart the server.