I had a classical Sinatra application which was accessible on two ports. After migrating it to modular style the second port is not working anymore.
My initial implementation was:
require 'sinatra'
set :port, 8080
set :bind, '0.0.0.0'
----some routes-----
...
The resulting implementation was:
require 'sinatra/base'
require_rel 'lib'
class MyApp < Sinatra::Base
register Sinatra::SomeRegister
helpers Sinatra::SomeHelper
set :port, 8080
set :bind, '0.0.0.0'
----some routes-----
...
run!
end
The application is run using:
socat tcp-l:8181,fork,reuseaddr tcp:localhost:8080 &
ruby /path/my_app.rb
The application doesn't respond on port 8181 anymore.
The fix was to install socat first:
apt-get update && apt-get --allow-unauthenticated -y install socat