madchatter / mad_chatter

Mad Chatter is a fun, easy to customize chat server written in Ruby utilizing HTML 5 Server Sent Events
http://madchatter.github.io/
MIT License
12 stars 6 forks source link

how to run mad_chatter in production mode with passenger #13

Open domi771 opened 10 years ago

domi771 commented 10 years ago

I have fully integrated and running mad_chatter in my local development enviroment. Was easy and quick! Thank you.

However my problem is that I am deplyoing to the production server with mina and on production server is running passenger.

Now I have on the production server mad_chatter as well but it does not really work (all javascripts and stylesheets are linked to 404).

What do I need to do in order to have mad_chatter running properly on production server?

domi771 commented 10 years ago

additional note: local is running apache and production is nginx

domi771 commented 10 years ago

more info:

I, [2014-09-05T20:30:09.294774 #6752] INFO -- : Writing /home/deploy/peatio/tmp/build-140994177022920/public/assets/mad_chatter/application-e48adf19ebb056a209a54e4e20af193f.js rake aborted! Asset logical path has no extension: mad_chatter/Gemfile

domi771 commented 10 years ago

I could solve this issue by adding the following code to application.rb of the main app:

 initializer 'setup_asset_pipeline', :group => :all  do |app|
    # We don't want the default of everything that isn't js or css, because it pulls too many things in
    app.config.assets.precompile.shift

    # Explicitly register the extensions we are interested in compiling
    app.config.assets.precompile.push(Proc.new do |path|
    File.extname(path).in? [
      '.html', '.erb', '.haml', '.coffee', '.js', '.eco', '.sass', # Templates
      '.png',  '.gif', '.jpg', '.jpeg',          # Images
      '.eot',  '.otf', '.svc', '.woff', '.ttf',  # Fonts
    ]
  end)
end

Now the remaining problem is that in the nginx production server is not subscribing to the chat rooms. This means that the messages are not reloaded/refreshed automatically and only on page refresh.

From the network connections I can see that:

subscribe /chat/protocols/sse/rooms/1 GET (canceled) 1:1

does not work while this works in development mode/server.

domi771 commented 10 years ago

@andrewhavens @nurettin - if you could help me with this issue I would highly appreciate it.