How to start and stop ngrok with Thin server?
I'm using the basic Thin server on my dev machine and I'd like to start and stop ngrok automatically with `rails s` - how do I do that?
I found several articles but they all involve more complex setups running unicorn, or another server, or using the ngrok-tunnel gem. I'm looking for a simpler solution. I was hoping I could write a simple rake task like:
I found several articles but they all involve more complex setups running unicorn, or another server, or using the ngrok-tunnel gem. I'm looking for a simpler solution. I was hoping I could write a simple rake task like:
desc 'Starts rails server and ngrok' task :start do Process.exec("thin start") Process.exec("ngrok http 3000 -subdomain=mysubdomain") end
Then just `rake start`, but of course only the first process runs and ngrok never starts.
Great, thanks. I was hoping for a solution that didn't require another gem but I'll give this a try.
Agreed on using foreman. It's the easiest way, unless you want to setup some bash script as your entry point that launches both. In this case foreman is great as the other posters have mentioned.