Giter Site home page Giter Site logo

Can't deploy to heroku about plezi HOT 14 CLOSED

boazsegev avatar boazsegev commented on May 17, 2024
Can't deploy to heroku

from plezi.

Comments (14)

boazsegev avatar boazsegev commented on May 17, 2024

Hi Tiago,

Thank you for asking. This is a known Rake consideration and I should probably reference it more often in the documentation and make it clearer.

You need to add the following line to your rakefile:

  require 'plezi/rake'

Or, if you don't want any of Plezi's tasks (considering there might be a conflict with Rails tasks), you can use the following line:

  Iodine.protocol = false

You can find more information here.

from plezi.

tiagoovieira avatar tiagoovieira commented on May 17, 2024

worked like a charm! thanks a lot 👍

from plezi.

tiagoovieira avatar tiagoovieira commented on May 17, 2024

btw, one more question, what tool do you use, like postman, to connect and send data (as json) via websocket? I'm using Simple WebSocket Client plugin, but the data I send in json format is read as html

from plezi.

boazsegev avatar boazsegev commented on May 17, 2024

I'm sorry for the late response...

I tried using postman for debugging, but I'm not super high on it. I usually test code on the browser console...

As for sending websocket data, I prefer to use javascript directly, without any libraries. Usually when I have to give example code I fall back on JQuery for the trivial issues...

If you want to see the code I use, you can look over the code I wrote for the Plezi client... the source file isn't will documented, but you can find more documentation here.

from plezi.

tiagoovieira avatar tiagoovieira commented on May 17, 2024

Ah ok, but I manage to test it with Simple Websocket Client. I wasn't too fond of testing with Javascript because the client of my app is a mobile device

from plezi.

tiagoovieira avatar tiagoovieira commented on May 17, 2024

@boazsegev I do have one more question, do you have any idea how to deploy a rails/plezi app to azure? I deploy the whole app, up and running in azure, but the requests for the ws:// are routed as HTTP and hit the main rails controller, and for that reason gives me an error

from plezi.

boazsegev avatar boazsegev commented on May 17, 2024

Hi Tiago,

I haven't tried Azur yet, but I'm happy to work through this.

Are you sure you're not using a specific server in your gemfile or to start up your Azur application?

As you might have noticed, Plezi uses it's own Ruby based server, Iodine, so we need to make sure your gemfile doesn't require a different server and that Azur isn't starting your application with a specific server using a server oriented command line....

from plezi.

tiagoovieira avatar tiagoovieira commented on May 17, 2024

Nop, I had Puma but because of incompatibility issues removed it, and the rest of the gems don't require another webserver

from plezi.

boazsegev avatar boazsegev commented on May 17, 2024

did you enable websockets for Azur...?

I found this link as well as this post that show a specific setting that needs to be enabled. It's an older reference, but it might still be valid.

from plezi.

tiagoovieira avatar tiagoovieira commented on May 17, 2024

That's for the web app service, I'm using the Virtual Machine service

from plezi.

tiagoovieira avatar tiagoovieira commented on May 17, 2024

@boazsegev I investigated deeper this issue, I'm using unicorn for the app server, almost all resources I found online about Capistrano deploys, rails app in production, used Unicorn + Nginx. In the documentation you say that is still possible as long I use the Placebo API, but the guide is coming soon. Can you tell me what's the status of this? Thx in advance 👍

from plezi.

boazsegev avatar boazsegev commented on May 17, 2024

Hi Tiago,

The guide might take me a while, as I have some other things to do first and school is starting tomorrow (which means I have less time than before).

As a first guideline, you can have a look at the Github README's explanation.

I know the README file is super long and disorganized (this is why Plezi has a documentation site), but before the site, it's what we had.

The Plezi.start_placebo command will recognize other servers and move Plezi to Placebo mode. If other servers aren't available, Plezi will ignore the command.

If you're only sending infomation to Plezi, that's all you need. But if you want to receive information from the websockets to your Rails application, you will want to create a "Bridge", which is actually a Controller that your Rails application "connects" to using Redis, so that your Rails application behaves like a special client of the websocket application.

There's an example in the README file.

As for a server choice, both Unicorn and Thin are great choices. Thin is a bit better for heavy code and Unicorn is a bit better when the code is light and fast (this is by choice of design).

Nginx is a great proxy option. It's single threaded and scales by the process, not by the thread - so you will need Redis when scaling Nginx. Also, Nginx's design fits Unicorn's philosophy and design very well (it's great for short & fast code), so it's a good fit.

Iodine 0.1x is written in Ruby and for this reason it suffers from many challenges, such as issues related to using select (this is true for many servers and written in other languages). Also, it isn't as well tested as it's older brothers.

Currently I'm working on Iodine 0.2.x, which is written in C and uses kqueue/epoll - this means that Iodine will be dedicated to Unix systems until I can port some of the code to Windows.

I'm not sure yet, but I think Plezi 0.13.x (we're at Plezi 0.12.x) might require a Unix system until the code can be ported.

This design is for two main reasons:

  1. Ruby has issues on Windows that cause Ruby to run very slowly on windows. It isn't recommended to run Ruby production apps on Windows (although it's getting better with time, I think).
  2. Windows architecture is so different than Unix (different socket programming + it's queue design of Overlapping IO) that writing for windows is almost a rewrite for the network core.
  3. I don't have windows, so I can't test my code on windows.

Even Microsoft Azure offers a better price when you choose a Linux cloud platform then when you choose a Windows based cloud platform... this isn't because Windows is a bad choice for a server platform (hmmm...) but because Linux is cheaper to support.

from plezi.

tiagoovieira avatar tiagoovieira commented on May 17, 2024

@boazsegev it was my bad, it was probably working all along, the configuration that I have is that the websocket is connecting to port 3000, I was trying to connect via ws://myapp.com/websocket_endpoint and it wasn't working, when I tried ws://myapp.com:3000/websocket_endpoint it worked. Probably this is not a good idea.

I was obviously using the ubuntu in Azure 😄

But great work, I will be testing this in production and was way more easy to work with than faye-websockets.

from plezi.

boazsegev avatar boazsegev commented on May 17, 2024

I'm closing this, as the next release (coming soon) is a total rewrite, for Plezi as well as Iodine.

If the new version (v. 0.14.0, unreleased just yet) invokes any issues (similar or new), please open a new issue to let me know.

Thanks.

from plezi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.