Installing rails on PPC linux (lubuntu 12.04) - ruby-on-rails

Ok. So I have an old PowerMac G5 and I decided to use it as a staging server.
I went along trying to do all the normal installing rails things, when I experienced this error.
Could not find a JavaScript runtime. See https://github.com/sstephenson/ExecJS (GitHub) for a list of available runtimes (ExecJS::RuntimeUnavailable).
ExecJS and could not find a JavaScript runtime
As far as I can tell, this is because there is no javascript runtime for ExecJS to call. People suggested installing Node-JS to fix the problem. This makes sense.
Turns out, Node, which requires the V8 javascript engine, which required ARM or i386, doesn't run on PPC.
So am I screwed, or is there another Javascript runtime I can use for rails. And how would I set that up? Thanks.

Here is the PPC port of V8 actively developed by IBM folks:
https://github.com/andrewlow/v8ppc

Related

Upgrading Capybara to latest version makes Gitlab CI fail

I'm upgrading my Capybara to the latest version (up from 2.18.0) This causes the normalized_whitespace deprecation running to show up a lot when running my tests. I read that pulling the master branch of the gem fixes the issue, effectively it does but now my CI on Gitlab fails with:
Errno::ENOENT: No such file or directory - /builds/products/micheticket/vendor/ruby/2.5.0/bundler/gems/capybara-webkit-77fdac424cd6/bin/webkit_server
Does anyone have any Idea on how to fix this?
Note that Capybara and capybara-webkit are two different things, Capybara is the testing framework, and capybara-webkit is a driver you can configure to be used with Capybara. Since capybara-webkit includes a C portion it needs to be compiled on the platform it's being installed on which means having all of its dependencies (specific versions of QtWebkit, etc) available on the platform. Having those available by default has become rare because QtWebKit stopped development quite some time ago. capybara-webkit development has also stopped and the project is likely to be archived very soon. You're going to have a much easier time if you swap to testing using the selenium driver (headless Chrome or Firefox) or one of the new direct to Chrome via CDP drivers like Apparition which are in beta currently but aim to provide the extra features that capybara-webkit had over selenium.
I use a gem to manage and install the drivers. Webkit is deprecated. I would use the chrome driver.
gem 'chromedriver-helper'

Bundler: "Failed to build gem native extensions", "Cannot allocate memory"

I'm trying to get Rails working on Ubuntu for Windows(beta). I installed RVM, updated my ruby to 2.3.0, and installed Rails without any problem. When I try to generate a new Rails project, it goes well until Bundler runs. I am getting an identical error for many of my Gems. Here is a specific instance:
Installing byebug 9.0.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/djllap/.rvm/gems/ruby-2.3.0/gems/byebug-9.0.5/ext/byebug
/home/djllap/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160801-16013-15q7ntv.rb extconf.rb
Cannot allocate memory - /home/djllap/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160801-16013-15q7ntv.rb extconf.rb 2>&1
Gem files will remain installed in /home/djllap/.rvm/gems/ruby-2.3.0/gems/byebug-9.0.5 for inspection.
Results logged to /home/djllap/.rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/byebug-9.0.5/gem_make.out
I haven't had this problem running Rails on Windows or my Vagrant/Virtual Box VMs. I would love to get this working on Ubuntu for Windows though, so I don't need to worry about all of that VM stuff.
It appears your server is running out of memory. Either increase the amount of RAM, or add some swap space to help alleviate the problem.
Digital Ocean has a great tutorial on how to add swap space to a Ubuntu machine.
Unfortunately I think you might be out of luck with Ubuntu for Windows. The way it actually works is by translating the Linux commands into Windows, and Microsoft have only implemented some of those commands. Byebug (and many other gems) utilise native C extensions and it looks like some of these are failing.
Take a look at this article for more info. You might get the support you want one day, but since Microsoft don't want to focus on server technology, instead encouraging VMs, I would probably save myself the pain. Gem installs are flakey enough in native bash..
Add swap or increase you swap partition. Seems compiler using swap when compiling.
I have checked free mem state found there is free mem, but my ECS have no /swap, so I configured host swap on, then everything goes well. Hopes it can help.

Installing Ruby version 2.2.3 on windows - get config.yml

I am completely new to programming and am trying to install Ruby on Windows (64 bit). I get to the config.yml message and cannot set up a command to get past this to full set up.
I have been doing research online and find many people say ruby and Windows are not compatible.
Can anyone help advise/send a link that is a good workaround?
Thanks,
You can install Ruby on Windows. Probably the easiest way to get started with Ruby on Windows is to use Ruby Installer. They support up to Ruby 2.2.3 at the moment.
If you are looking for an alternative workflow, you might consider running a Vagrant machine on Windows. This workflow is described here.
The workflow involves using your native environment to launch a virtual machine that more closely matches the one typically used to deploy your code. You get the benefits of the windowing system tools (Sublime Text, RubyMine, Notepad++, etc) with the benefits of running specs and code in an environment closer to a production environment.
You can run Ruby on Windows, if you have the correct dependencies/libraries installed.
The best way to do this (if new) is to download a pre-compiled version of Ruby, from RubyInstaller:
EXE installer
ZIP file
Choose one of the above; they provide you the ability to put the Ruby.exe executable on your system, which (if installing with ZIP), needs to be added to your system PATH var.
--
I can explain more if required. If you want specific responses, you need to provide specific points (IE the full error message for config.yml etc)

What are some alternatives to using Tomcat for Jruby Rack apps?

We're looking at some alternatives to our Tomcat based stack for a JRuby on Rails app.
So far I've read about the Trinidad gem, which is actually Tomcat based, and the Glassfish gem. I can't however for either of these find production examples. Both of them it seems allow you to just run the command on command line, which is fine for local dev, but how do people use these solutions in production?
There doesn't seem to be much action on the Glassfish gem these days, though it's highly touted for being small and fast.
Does anyone have another setup that they find to be performant, robust and easy to deploy for a JRuby on Rails app?
Trinidad gem / Embedded Tomcat
If you dig deeper into the Trinidad gem page on Github there are links to the various Trinidad extension gems. There is a daemonizing gem specifically supplied for use in production here:
http://github.com/calavera/trinidad_daemon
If you execute the install script and answer a handful of simple questions, it generates a tailored init script for your Ubuntu or OS X machine. That's pretty much all you need.
There are also example init scripts in the wiki here:
http://github.com/calavera/trinidad_daemon_extension/wiki/init.d-scripts
Note that for use in the Rails.threadsafe! mode, both min and max JRuby runtimes are set to 1 in your trinidad.yml configuration file.
I have it working on Ubuntu with an Nginx frontend, and it's working very nicely.
So yes, this means that you use the command line to stop and start the application server, but the init script will also be called automatically on system startup. The wiki also includes some Capistrano deploy script examples, so you can even have the server stop and start from your own machine.
Note: There are two daemon extensions. The one I have linked to is the new one, which uses a better daemonizing library.
GlassFish gem
You're right, the GlassFish gem isn't getting so much love right now, but I daresay things will improve. There are a couple of issues running it with JRuby 1.5+ because the gem didn't keep up with changes in JRuby, however I wrote about how to work around the issues here: http://www.scottlowe.eu/deploying-rails-3-with-jruby-daemonized-glass
Since writing that GlassFish post, Trinidad has gained the power to be dependably daemonized, so it's probably the smoother path to take today.
Well, jetty has always worked well for me in the Java world. And a quick google search turns up a jetty-rails gem: http://jetty-rails.rubyforge.org/

Limitations in running Ruby/Rails on windows

In the installation documentation to RoR it mentions that there are many limitations to running Ruby on Rails on Windows, and in some cases, whole libraries do not work.
How bad are these limitations, should I always default to Linux to code / run RoR, and is Iron Ruby expected to fix these limitations or are they core to the OS itself?
EDIT Thanks for the answer around installation and running on Linux, but I am really trying to understand the limitations in functionality as referenced in the installation documentation, and non-working libraries - I am trying to find a link to the comment, but it was referenced in an installation read me when I installed the msi package I think
EDIT
Thanks for the references to IronRuby lately, it is certainly a project to watch, and as it, obviously, is a .NET language, it will be invaluable if it lives up to the promises. Eventually, however, in my case, I just bit the bullet and installed an Ubuntu server.
<bias> I should've done it years ago </bias>
Here's an overview of the current issues with Rails on Windows:
Ruby and Rails are slower on Windows than they are on Unix-like OS's.
A few gems and libraries don't work on Windows.
Some Unix-isms aren't available on Windows (examples).
The community is mostly on either Mac or Linux (This is a particularly hard one to deal with; nobody wants to be alone on one island when the rest of the tribe are partying, having fun and getting along great over on the other island. Community is important. It seems that most Windows developers that start with Rails quickly switch to a Mac or Linux. However, the small community of Windows Ruby users that do persist are extremely friendly, dedicated and knowledgeable - go say hi.)
Note much of the advice that follows is now outdated due to the magnificent efforts of the RubyInstaller team in bringing stability, compatibility and performance to Ruby on Windows. I no longer have to use VirtualBox, which says a lot about how far Ruby on Windows has come.
If you want more technical detail, the following are required reading. :
Ruby for Windows - Part 1
Is Windows a supported platform for Ruby? I guess not
Testing the new One-Click Ruby Installer for Windows
Still playing with Ruby on Windows
Chatting with Luis Lavena (Ruby on Windows)
Choice quote from that last one is:
AkitaOnRails: The most obvious thing is that any Gem with C Extensions without proper binaries for Windows will fail. Trying to execute shell commands will fail and RubyInline as well. What else?
Luis Lavena: Hehe, that's just the tip of the iceberg
Having said all that, I don't find developing with Rails on Windows too painful. Using Ruby is, for the most part, a pleasure. I'd avoid InstantRails because, to be frank, it's just as easy to install Ruby properly using the one-click installer, then doing a gem install rails. If you need Apache and MySQL, WAMP is a good bet, although even these aren't required if you just stick with Mongrel and SQLite.
What I've taken to doing recently is running VirtualBox with an instance of Ubuntu Server that closely mirrors the deployment server. I map a network drive to the Ubuntu Server, then I edit and run my code directly on the VM. It uses hardly any memory (it's currently using ~43MB; contrast that with Firefox, which is using ~230MB) and Rails actually performs better than running it natively on Windows. Plus you can experiment with your virtual server in relative safety. It's a really nice setup, I highly recommend it.
Finally, here are a couple of Ruby/Rails blogs aimed at Windows users:
DEV_MEM.dump_to(:blog) (Luis Lavena)
Softies on Rails
Ruby On Windows
I found getting a development environment up and running with Instant Rails on Windows was really simple. Especially when using Netbeans or Radrails as the IDE.
Less than a 10 minute job.
What did those who struggled find to be the problem?
I've been developing Rails on a Windows PC for a couple of years and had no real problems installing back when I first started. However I recently re-built my machine and struggled to get the One-Click Ruby installer working and the latest version of Gems. So this is what I tried.
Option 1: Run a Linux Virtual Machine
I was really impressed with Charles Roper's idea of running Rails within a Linux virtual machine, and this is the route I intially went for. It all went pretty smoothly and I've been documenting it at budanters.blogspot.com. However I've been struggling with accessing the MySQL server (in Linux Virtual Machine) from the Windows host.
Option 2: Use jRuby
I recently installed the Windows version of NetBeans 6.5 Ruby bundle, and without being aware of it, this installs JRuby and the Rails gems. The IDE has a UI to install Gems, and I've now got my old application back up and running in my development enviromnent.
Update November 2009
I now use Netbeans 6.7 on Windows and in the whole I am very happy with it. The only downsides are that it installs JRuby 1.2, and I needed to install JRuby 1.3 manually to get something working (I can't remember what) and I have been completely unable to get deployment working with either Capistrano or Vlad the Deployer to work. Vlad uses Open4 which doesn't work with JRuby.
Update May 2010
Netbeans 6.8 comes with JRuby 1.4 so no longer have to fiddle around with manually installing JRuby 1.3. Also it seems that in JRuby 1.5 Open4 will now work, which means Vlad might start working.
Nobody mentioned Bitnami RubyStack yet? I've been using it for years, together with RadRails. Includes Apache, MySQL/Postgre, phpmyadmin, git etc. Optional Ruby 1.9.2/Rails 3.0b. You may also run the Ubuntu flavor of RubyStack in a VM but I haven't tried that yet.
There is a packaged installer available at http://railsinstaller.org/ which is worth checking out.
Personally I found getting Ruby + Rails up and running on windows a piece of cake. From download to browsing to my first 'HelloWorld' app took me all of 15 minutes. I didn't even bother with any of the InstantRails stuff.
Subsequently I can't say I encountered any of the reported speed problems or issues with Gems under Windows.
These guys also do a nice Ruby developers add on for Visual Studio:
http://www.sapphiresteel.com/
When I last fiddled around with Rails on windows, I used Instant Rails and found it to be a fairly painful process, except for the lack of updates to Instant Rails (which, from the look of the website is still a little bit of a problem, as instant Rails 2.0 uses ROR 2.0, while the newest version is 2.1). You might also look into the answers to this question as it mentions a number of other ways to get RoR running on windows easily.
You have windows options for getting everything up and installed, such as Instantrails:
However, my personal experience with trying to get colleagues up and running on windows is that it's a pretty painful experience. You should be able to get most (if not everything) running, but be prepared to spend a bit of time mucking round (and getting frustrated).
YMMV
I would probably recommend either Linux or Mac for rails development (but I'm slightly biased against windows, so you may need to take that with a grain of salt).
An option if you're stuck on Windows is to have virtual servers running Linux / BSD / what-have-you.
It solves lots of other problems also (allowing you to try multiple server configurations easily, etc.).
If you can't get away from windows use VMware and run some form of linux (ubuntu is popular). Your No.1 limitation will be compiled gems which do not play nicely on windows.
The majority of tutorials assume you're on some form of *nix, it's when you start to break outside of basic scaffolding when you'll feel the pain. Image manipulation, full-text search and even some db adapters will either only run on *nix or are a pain to setup.
The majority of web hosts run linux too, it's good to be developing on the same platform as your host, to avoid deployment headaches.
In general, Rails performance is a problem on Windows.
As far as your deployment setup, you can either run Rails in FCGI or use mongrel (and set up either Apache or IIS as a proxy). mod_rails (http://www.modrails.com) is the best deployment option for Rails today, but doesn't run on Windows.
You might find more luck using JRuby on Windows to run Rails in whatever JVM environment you want (tomcat, J2EE server, etc).
IronRuby isn't there yet to run Rails in a production environment, but eventually it will be aimed at running Rails inside any ASP.NET environment (IIS).
You could just use Cygwin and it's version of Ruby. That gets rid of the arguments about compiled gems not working on Windows - I've managed to compile a lot of gems that way.
The biggest limitation of running under Windows is that a lot of things are super slow.
See this thread. For a discussion.
Simple things like "script/console" and running rake tasks will take 5 times longer on Windows than they do on Linux or Mac.
Other limitations are:
No IE6 on Vista.
BackgroundRB and a many other c based gems do not work on Windows.
No passenger
I'm not a rails developer myself but I thought this may be of interest. Microsoft has released IronRuby 1.0, it's a version of Ruby that runs on the .NET platform that apparently runs 4x faster than the official Rails implementation on Windows.
http://www.drdobbs.com/open-source/224600662
Official site
http://ironruby.codeplex.com/
For a speedup you could try my loader speeder upper (helps rails run faster in doze): https://github.com/rdp/faster_require
Also checkout spork, which works in doze
Alternative of RailsIntaller is RailsFTW. The Ruby & Rails are more updated.

Resources