Does puma work or Windows or not? - ruby

I've been trying for several days now, but I always come back to the two links that tell me conflicting information. This link says that I just need backports to get puma to work (anything beyond simply installing, I can't seem to find either.) And this link suggests the complete opposite, that puma will not work on windows. And, yet again, here it looks like it does work if you do something. I'm not sure what to believe, or what processes to take to get puma working, if it does work on windows.
For anyone interested in my personal problem, if it can be solved, is that puma throws the same errors based on SIGUSR NOT IMPLIMENTED signal based restart unavailable. I've installed backports, but that alone doesn't fix it. What am I missing, besides this?
EDIT: Somehow I got everything but SIGUSR2 to work. I'd call that an achievement, except I'm not sure how I did it besides changing versions and reinstalling puma and backports several times.

Related

Use Crashlytics on macOS daemon

I have a macOS application that is integrated with Crashlytics. If I run it as an agent, everything seems to work fine. But when I run it as a daemon, the crashs and errors don't show up on the web panel.
I'm thinking the problem might be that crashlytics uses a framework that is not daemon-safe.
Apple documentation regarding the subject says:
If your daemon uses frameworks that aren't daemon-safe, you can run
into a variety of problems.
Is this really the issue? Is there a workaround so I can get it to work?
Former maintainer for the Crashlytics SDK on Apple platforms here. However, I haven't been with the organization for a while, so my information could be out of date. You should definitely reach out to them for assistance. However, I'll still give this a shot.
A number of others have asked for this kind of functionality in the past, and from what I know, have successfully integrated Crashlytics into non-UI processes. There are some things to watch out for, though. I'm also aware of the daemon-safe issue, and that could be a problem. However, I'm unsure of how it might manifest itself.
When you say agent vs daemon, are you talking about per-process vs per-user launchd jobs, or something else? One thing I can be fairly certain of, is Crashlytics does not support multiple processes with the same bundle id running simultaneously. If there can be multiple copies of your process running at the same time, you cannot make this work. Even if it seems like it does work sometimes, it will not work reliably, at best, can could lead to serious issues at worst (potentially crashes).
One thing that is absolutely essential for correct operation is a main runloop. Crashlytics will definitely not work correctly without one.
Crashlytics also requires an Info.plist. This is actually possible to add to standalone binaries, but often trips people up. I'm guessing you figured this one out.
On macOS, Crashlytics integrates a bit with AppKit, to improve exception reporting. If I recall right, it's possible to just skip this integration completely, as outlined in the docs.
Another thing that Crashlytics relies on is a standard user file system home directory. There must be a ~\Library directory present with the standard internal structure. This one might be problematic for launchd daemons, since they run as root.
Keeping those things in mind, I'm pretty sure it's possible to make this work. There could be some things I'm not remembering, as it's been a while. However, one thing I definitely do know is this is a bit of a gray area. It works, but wasn't an explicit design goal. It might now be unsupported. You should definitely check in with them about this before shipping something.

How do I easily and cleanly update ruby 1.9 to the latest version on Windows Server 2008 r2

Full disclosure. I do not use Ruby. I never have even looked into learning it as a language.
We use ruby at our company to power an integration between a couple of our tools. Due to a TLS update we have to update our ruby version from 1.9.2 to the newest version.
On this windows server 2008 r2 machine I have that version of ruby and need to update. The problem is this tool is in constant use. So I cannot reasonably take the server down for a whole day while I try to figure out what to do. Initial research shows that these older versions of ruby are problematic to update.
I have only a half dozen gems to worry about (and found a really good guide on updating those - I think).
Looking for a kind soul who is willing to help a lost soul.
Is this a case of needing to completely uninstall and if so does that mean uninstall my gems as well? Or can I just run an update via cmd?
This is mostly going to come down to your gem dependencies.
As for just the language, the odds of encountering anything that works with Ruby 1.9.3, but not Ruby 2.0+ will be highly unlikely. Plenty of features have been added, but on a whole, backwards compatibility has been maintained.
This is not necessarily the case with gems, as the dependencies and robustness of the code can vary wildly depending on the source. The only real way to answer anything with confidence is to check/compare dependencies of each gem you require with your target Ruby version. Typically increasing the Ruby version is less likely to "break" anything than lowering it obviously, but it is still a significantly plausible scenario you must be wary of and prepare against.
The only real way to do this without downtime is to clone or setup a new environment for testing, install the newer Ruby, install the required gems you have researched dependencies, and test to make sure everything runs/works as expected.
Unfortunately there is no "magic bullet" here that is going to solve this issue for you. Luckily, the vast majority of this does not require knowledge of Ruby syntax and coding, and if everything goes well, will require nothing more than installing Ruby, installing gems, and comparing versions. If you run into issues with specific gems, I am confident that there is a host of people here on SO that can help guide you through reconciling it.

Ruby/Tk in a browser

Is there a quick and easy way to make a ruby/Tk script run in a browser? I wrote a handy-dandy little ruby/tk script to do stuff. A friend saw it and said that his friends would love to use it, but they are extremely non-technical and cannot handle installing ruby (even though I showed him how simple it is). What he wants is for me to give him a link that someone can click on a browser and magically make the tool run.
I've looked around and get the impression that it cannot be done. 'it just does not work that way'. But I have not seen a clear 'NO' . I see things on how to get ruby to run in a browser, but not the Tk part. I also looked at rubyscript2exe but get the impression that it was abandoned.
No, you can't directly run Ruby in the browser like that.
There are websites such as RubyFiddle which let you run short snippets. What they're actually doing is executing the code remotely then displaying the result.
Because this code is actually being executed remotely, there's no way of running something interactive (like a TK UI) with it. There are some services which give you a hosted Ruby environment with working Terminal, but even these aren't going to work with a TK UI.
This section of Ruby Gems https://www.ruby-toolbox.com/categories/packaging_to_executables has a good list of all the tools available to package Ruby apps for distribution though, so you might be able to send them a simple installer to allow them to use it locally?
I've had a lot of success doing this with https://github.com/larsch/ocra/ which is actively maintained.

Has anyone succesfully used a background job gem under Windows, using Rails 3?

I have been trying to use delayed_job for about 1 hour on Windows with no success. Before going off and trying the next candidates, I decided it could be wiser to ask for other experiences of background job processing under Windows. Has anyone used something succesfully with Rails 3?
EDIT: to win the bounty, please list, if any, gems for starting background jobs that work under Windows.
There's the Backgroundjob gem, but it looks pretty old (the latest version was released in 2008). It should support windows, here's the quote from the README:
platform independent (including winblows [sic])
There are a few forks though, maybe you will find one that you can use without much pain.

Since adding observers to my Ruby module, my system locks up

It only happens on certain types of errors, for example if I make a call to a method that doesn't exist on one of my objects. But it's hard to get any information on what is causing this because I can't step through what is causing it, as my debugger locks up as well. When I look at top, I see something like 97% of my CPU time being taken up by a Ruby process. I tried running Sample Process in activity monitor to see if it could show me where it is getting stuck, but nothing relevant seems to come up (just alot of OSX classes).
This is a Padrino project, I am running Ruby 1.9.2 and using the Observable mixin. I am on OSX Lion. Any ideas or suggestions for troubleshooting? This is killing my productivity!!
Which version of padrino do you have? Latest 0.10.1 fix this problem.

Resources