VM image with ready-to-use Rails development environment? - ruby-on-rails

So... I've been trying to start developing Rails, and I'm having a horrible time setting up my environment.
Installed Ubuntu 12.10 in a VM. Installed RVM. Installed Ruby 1.9.3. Installed Rails. Then Rails console didn't work because I didn't have readline, and I had to start futzing with rvm commands from here and from a Stack Overflow thread, only to get numerous incomprehensible errors.
And that's just me trying to get off the ground and start running. Please oh please, isn't there a ready VirtualBox VM file with a machine preconfigured for development work?

If you would just like one built for you go to: https://railsbox.io
Tutorial will set you you with vagrant/rails much like the other answers are talking about. I haven't used it but it looks solid:
https://gorails.com/guides/using-vagrant-for-rails-development
You could also simply use a remote vm that is setup and available anywhere:
https://c9.io/
There are other similar options out there.
I have used both of them and they function excellently for this purpose, they also troubleshoot well on google because you have multiple people using the same environment. If you are new to Rails/Ruby and are unfamiliar with using a nix environment I highly suggest this route. You will also be able to access them more or less anywhere through a browser.
I know it is rather an old thread but since it came up so easily in a search and the answer wasn't entirely satisfactory when I had found it previously I thought I would broaden the list of options.

Found this: https://github.com/rails/rails-dev-box
Hoping it's going to help; consistent with Branden's comment above.

Related

Error message when starting Ruby on Rails server

hope I can get some help with a problem I have been having. I am getting into Ruby on Rails and used a tutorial (http://guides.rubyonrails.org/getting_started.html) to try to get started with it. It says I need Sqlite3. I followed the steps up to the point where it says to use the ruby bin\rails server command in command prompt. However, when I try to do this, I get the following error message.
When I try to install Sqlite3, I use the x86 version for Windows, as I am using Windows 8.1.
I don't know what I am doing wrong...I am not even sure if the SQlite3 files are in the right place. I use command prompt to check if I have Ruby, Rails, and Sqlite3 all installed, which I do. I also know I have the SQlite3 Ruby gem installed. I have also added SQlite3 to my PATH system variable, but that doesn't seem to work either. I always get the same above error message no matter what I do.
Anyone have any ideas as to what the problem might be? Any help would be greatly appreciated! Thanks!
I recommend setting up a Linux VM on your Windows PC and start coding on it instead of on Windows. You'll keep encountering many issues in the future if you stick with Windows. Windows & ruby on rails don't go well together. So, it's better to go with some Linux flavor or preferably Mac.
If you are going to be learning RoR with the goal of ever doing anything serious in the future, here's the best advice I can give to someone starting out: Buy a Mac. NEVER try to use Microsoft for anything but Microsoft office... you'll just end up so frustrated that you will give up. RoR is NOT the toy to try "round peg, square hole" with.
Next, being that your on a Mac, NEVER use sqlite3. You can easily use the correct database which is PostgreSQL. Why is this important?
You're starting out. Keep things very simple. Get a free Heroku account, and install the CLI (for mac). You can then do: "heroku local" to run your code locally (for building), and because it's Mac/PostgreSQL, when you go to push that code live, everything is the same (Heroku is going to be PostgreSQL) so you won't get lost for days trouble shooting the differences between where you're building the code, and where you're running the code.

Alternative to using Passenger for rails on FreeBSD9.1?

I want to use Ruby on Rails via rbenv with Apache2.4 on FreeBSD9.1, running ruby-2.0.0p247 and rails 3.2.13.
My problem is that rails needs a hook into apache, which would normally be accomplished using passenger. However, due to a bug in the OS, passenger won't work. Linkage below detailing the specific OS bug. I'd like to get things moving well before FreeBSD9.2 arrives (9.2 resolves the issue).
Is there an alternative to passenger? How can I accomplish my goal in the least exotic way possible?
urlpassenger on github commit: check for broken freebsd version
urlCatching C++ std::bad_cast doesn't work in FreeBSD 9.1
urlWhy does catching std::bad_cast not work on FreeBSD 9?
Conveniently, and even after much initial research, after posting this question, another useful answer was discovered. While quite comprehensive, I'm not sure it entirely answers my original question. Any help on this matter is appreciated.
Note: I work at Phusion.
You can use any of the other app servers described at Ruby on Rails Server options. Unicorn, Puma, Thin... they will all get the job done, though not necessarily as easy as Phusion Passenger.
But if you prefer Phusion Passenger then there's still hope. A pull request came in a couple of days ago which works around the FreeBSD bug: https://github.com/phusion/passenger/pull/87
I haven't got time yet to review the pull request (I'm too busy doing my yearly taxes) but perhaps you can try it out yourself. Installation instructions for the git repo are documented in the readme.

Ruby on Rails RubyMine setup for win 7

I am trying to find a tutorial or a document or what ever which will show all the real steps with details how to setup my win 7 pc in order to debug - deploy a rails app through rubymine. I have found only spare pieces of the puzzle which i don't know how to connect.
I am newbie to ruby stuff, that's why i need details steps.
I will appreciate any help.
Download the rails installer.
http://railsinstaller.org
And then rubymine, and you should be good to.
That said, windows is less than ideal to do ruby develoment on. I did it for a while, and I spent to much time fighting the fact that ruby is best on a Unix based system. You can install ubuntu on a virtual machine and used than for your rails needs.
I think the best day to do this is to use vagrant. Check this http://www.confreaks.com/videos/2368-rmw2013-ready-to-code-automate-your-development-environment

RoR development-environment setup

I'm interested to play around with RoR a bit. Apart from literature i should read, i'm particularly interested about how to setup development environment.
Here's a good example how to setup environment for Java from Noda Time project wiki pages.
I want something similar but for RoR.
As far as i know - unix operation systems fits way much better (have toyed on windows 1 1/2 year ago - pure nightmare). So it would be nice to get some recommendations about linux distros and how to make it run next to win7/xp.
Basically - i want to shorten endless searching and improvisation until i can play with some code.
P.s. bonus for simple sample project. :)
The single quickest way to get up and running might be to simply grab Netbeans and develop against its built-in JRuby instance. It will walk you through setting up a Rails project and even give you some nice-to-haves like autocompletion.
Baring that, the easiest method is likely to download a Linux VM Appliance pre-Customized for Rails Development and a copy of VMWare Player.
The best 2 ways to go are OS X and Linux, I use Ubuntu just because it's the nicest package that I've found (there will no doubt be a variety of opinons on this.)
For Rails, I like to not use the packages or pre-installed versions, and instead build my own so I can test against various versions of ruby if need be. Hivelogic has a nice post about how to do it for OS X 10.6.
From there, you can just run:
rails myproject
cd myproject
./script/generate scaffold post title:string body:text
rake db:migrate
rm public/index.html
./script/server --debugging
And then connect to http://localhost:3000/posts to get to your application.
Once you get more comfortable, check out running Passenger instead, so you can have multiple applications running at the same time. On OSX there's even a nice Prefpane to easily set up new sites. This also ins't too hard in Ubuntu with the examples provided in the passenger docs.
For editing the application I think the IDEs (Aptana, Netbeans, etc.) are still too heavyweight, especially for small starter projects. I like Textmate (like everyone else) for OSX and gedit with gedit-mate.
Once you're writing applications, you'll find that railsapi has the best interface for browsing all of the various methods not only in Rails, but ruby, authlogic, and a bunch of other common gems.
Lastly, you'll want to look into source control, with git being preferred in the Rails community at the moment.
Good luck!
Get VMWare player
Get ubuntu vm
If it's server version - install desktop x or whatever it's called
Mess around with sudos, visudos
Mess around with vi editor to save newly created account to sudoers list
Mess around with vertical mouse scrolling which apparently does not
work on vmware+ubuntu
Finally install netbeans
Through plugins, install ruby on rails
Some global updating
Enjoy toying
tadaaaa...
Something like that i wanted - with each point explained a bit (no doubt that my steps aren't best ones and sounds funny for those who knows).
I guess that i forgot to mention that i lack knowledge of unix systems in general too.
Anyway - got what i was looking for. :)

Rails Deployment on Win32 Best Practices: Lighty + Sgci

I've received some really great guidance from users of this site, and I'm thinking some advanced Rails people could assist me in resolving the following problem.
I'm attempting to deploy a simple Rails application on a win32 server.
I've been carefully working through these instructions (see http://functionalelegant.blogspot.com/2008/05/deploying-rails-on-windows.html) for win32 Rails application deployment.
I started from a more-or-less clean windows install, then downloaded and installed
Ruby
LightTPD
Rails
Zed's SCGI Rails Runner
Windows Server 2003 Resource Kit Tools
Ruby/DBI ADO package
After that, I've done the following:
I've commented out the line in the SCGI gem (which actually was causing trouble.)
I created the directory structure as suggested, with folders for logs.
I modified the scgi.yaml file and the Lighty config files to reflect my environmental settings.
After this, I wrote the batch scripts to start up Lighty and the SGCI process. They appear to run correctly. However, inside app-errors.log the following lines appear:
2009-05-15 16:48:06: (mod_scgi.c.2645) fcgi: got a FDEVENT_ERR. Don't know why.
2009-05-15 16:48:06: (mod_scgi.c.2469) emergency exit: scgi: connection-fd: 7 fcgi-fd: 8
Finally, when I navigate to http://localhost:xxxx/ I just see a blank page. Update: I just realized the blank page only appeared to be. Viewing the source revealed the following issue:
2C:/Ruby/lib/ruby/1.8/drb/drb.rb:573:in `load'":C:/Ruby/lib/ruby/1.8/drb/drb.rb:612:in `recv_request'":C:/Ruby/lib/ruby/1.8/drb/drb.rb:911:in `recv_request'"?C:/Ruby/lib/ruby/1.8/drb/drb.rb:1530:in `init_with_client'"<C:/Ruby/lib/ruby/1.8/drb/drb.rb:1542:in `setup_message'"6C:/Ruby/lib/ruby/1.8/drb/drb.rb:1494:in `perform'"8C:/Ruby/lib/ruby/1.8/drb/drb.rb:1589:in `main_loop'"3C:/Ruby/lib/ruby/1.8/drb/drb.rb:1585:in `loop'"8C:/Ruby/lib/ruby/1.8/drb/drb.rb:1585:in `main_loop'"4C:/Ruby/lib/ruby/1.8/drb/drb.rb:1581:in `start'"8C:/Ruby/lib/ruby/1.8/drb/drb.rb:1581:in `main_loop'"2C:/Ruby/lib/ruby/1.8/drb/drb.rb:1430:in `run'"4C:/Ruby/lib/ruby/1.8/drb/drb.rb:1427:in `start'"2C:/Ruby/lib/ruby/1.8/drb/drb.rb:1427:in `run'"9C:/Ruby/lib/ruby/1.8/drb/drb.rb:1347:in `initialize'"2C:/Ruby/lib/ruby/1.8/drb/drb.rb:1627:in `new'"<C:/Ruby/lib/ruby/1.8/drb/drb.rb:1627:in `start_service'"MC:/Ruby/lib/ruby/gems/1.8/gems/scgi_rails-0.4.3/lib/scgi.rb:402:in `run'"HC:/Ruby/lib/ruby/gems/1.8/gems/scgi_rails-0.4.3/bin/scgi_service:61"*C:/Ruby/bin/scgi_service:19:in `load'" C:/Ruby/bin/scgi_service:19: mesg" too large packet
Note that 'ruby script/server' runs just fine, but the page then can't be seen externally.
Any ideas? Please let me know if anything jumps out at you.
I wrote the chapter for this in 'Deploying Rails Applications'. http://www.pragprog.com/titles/fr_deploy/deploying-rails-applications
Basically, you want mongrel, mongrel_service, and apache 2.2 with mod_proxy_balancer for windows.
You install 2 or more instances of your app with Mongrel running on separate ports. You set the services to autostart.
Then you set up apache to balance to them.
This is all outlined in the book, and I have some older articles on my website too - if you search for "deloying rails on windows" you'll find some pretty out of date stuff. The apache+mongrel way is the best way for Windows right now, and if you need additional help, feel free to let me know. I'd be glad to help.

Resources