I want to make a development server for Ruby. (I have done this for IIS and a LAMP set up, but am by no means proficient at it.) What will I need besides the actual server (which I already have)? And also any security issues? I know I could dev locally on my machine, but don't want to do that.
First off when doing ruby development the first thing to know is that it works best in a unix like environment, so mac os x, linux, solaris, bsd, etc...
Ruby libraries are distributed and packaged as gems. So you'll want to install ruby and install rubygems. Then from there on you use the gem command for installing ruby libraries.
I'm going to assume you're talking about doing web development with either ruby on rails 2.x or Merb 1.x. The two frameworks are merging in the next release and it'll be called Rails 3.0. So the answer here works for either one. I'm going to say Rails, but i mean Rails/Merb.
Rails development is done locally on your machine. So you'll need to install ruby and all the libraries you need locally. I know many people who use Windows end up using virtualization and running a linux environment for rails within their desktop windows box.
In development most people use an application server, Mongrel. In production the current standard is to use Apache 2 and Passenger.
With rails you're going to want to use source control. Most people today use git in the rails community, but it's possible to use subversion, perforce, or many other SCM's. To get your application from your source control to your staging and production systems, the rails community created an application called Capistrano. It handles deployments. You setup your server information, ssh keys, define access, and then you can release your application with a single command.
cap deploy
It's a pretty good system. Back several years ago now when i was working on odeo.com we had people using windows, linux, and mac's all for development with production deploys to debian linux. It wasn't intentional that our application be cross platform, it just worked out that way because we had people who wanted to add to it, including designers and biz types, who were on windows.
I highly recommend you check out http://guides.rubyonrails.com for more information.
Related
I'm looking on ways to deploy a ruby on rails 4 app built on windows 7 box. I'm looking to use Heroku at the moment.
Can you please provide any pointers regarding heroku or any other easier and cheaper deployment options available out there..
Any issues That I may face due to the difference in OS in the dev environment (windows) and the deployment environment (linux on heroku)?
This is my first professional app, so any pointers will be helpful for now and also for future applications that I may work on.
Also what is the more preferred OS for ruby on rails development ?
Thanks in Advance!
You probably won't face any issues with deployment on Heroku. Heroku is the easiest option out there (albeit one of the priciest once you're off the free tier)
What's more likely to happen on Windows is that you'll find it hard to build certain gems for development, and cutting edge releases will probably not work well.
Much better to pick up a Linux distro for this.
You can also check out bluemix , which is also free for small projects. I know Heroku is not particularly windows friendly, not sure if bluemix is any better in that reguard, but it is extremely easy to deploy to.
Heroku has set of tools called heroku toolbelt, that makes easy to deploy apps to heroku. you can download heroku tool belt for windows from here
Generally you should be able to port any rails app you develop in windows to Linux/Mac, how ever since the ruby/rails community is largely built around Linux/Mac, responses/options to your issues regarding the rails apps will be low. and there are some gems which doesn't work on windows at all. So its best to move to either Mac/Linux if you are planing to continue on rails.
Once you come to Linux/mac world there are lots of providers much cheaper than heroku like DigitelOcean, however heroku would be the easiest for a beginner I believe.
HTH
One strategy you could try is to do the following:
Set up a VirtualBox or VMWare VM running Linux (Ubuntu would be a good candidate if you are not used to Linux).
Get your project into the VM and get the bundle install and everything working in Linux, you will probably find you need to make some changes in your Gemfile if you have anything windows specific there.
Install the Heroku tool-belt on the Linux VM and install to Heroku from there.
Taking the Windows / Linux transition pain on your local machine will make it much easier than Windows direct to Heroku.
My next work project is going to be using the Meteor framework. Our team recently got licensed to use WebStorm IDE, which has been our favorite up until this point. so we were planning on continuing the project with it.
That is, until it was time to install it. Then we found out that the Windows version of Meteor is only partially finished, and all of our development PC's are windows based.
So we were considering as a work-around for this, we may use Cloud9 as our development IDE, as it supports Meteor. The sharing functions may help our team productivity a bit as well.
But this has some problems...
First, we just invested in WebStorm, so we would ideally like to use it as our primary IDE. But I do not know how we would be able to work with WebStorm if we can not run an up to date version of Meteor on our windows systems?
Second, I'm not sure if it's even possible to use Cloud9 as the development IDE, but then move the C9 project over to our Ubuntu server for hosting when it is time to go live?
Third, even if we could deploy to our Ubuntu server after C9, we plan on many updates to our live application after deployment. I'm not sure if there would be issues with this if our development is on C9 and deployment on a completely different server.
So I'm wondering if anyone has a potential solution for these issues? Is there any way for us to work with Meteor on our live Ubuntu server, or Cloud9, from WebStorm on our Windows systems? Or any way we could integrate Cloud9 and WebStorm together for the best of both worlds? Or any way we could use a Linux emulator or something to allow us to use Meteor on our local windows system, without making it difficult for multiple developers to work on the project at the same time?
Thanks in advance!
The Windows port of Meteor actually is working quite well; the only major issue is that mobile development doesn't work. That is going to be fixed in Meteor 1.1 anyway, whose primary goal is to get Windows support up to that of Linux and Mac OS X.
As the user who initially pushed for Webstorm to add Meteor support back in October 2012, I'd recommend starting with Webstorm and Meteor on Windows right away, unless you need mobile development. In that case, you need native *nix machine (an Ubuntu VM on Windows won't be able to run the Android emulator, for example).
WebStorm also supports server-side Meteor debugging, and they're pretty responsive when it comes to fixing bugs you report on YouTrack. See for example https://youtrack.jetbrains.com/issue/WEB-13490
With Cloud9, you cannot currently SSH into a workspace you have, so a hybrid Webstorm/Cloud9 situation might not be doable at this point.
As for deploying your stuff from Cloud9, that is very doable. There's some documentation here about that: https://docs.c9.io/v1.0/docs/deploying-via-the-command-line
I have a few Mac Minis and old Mac Pros we use as Jenkins slaves for automated testing.
Occasionally gems simply disappear and I have to re-install them. This is using the built-in Ruby from Mac OS Yosemite.
Why does this happen?
I use RVM on my personal Macbook Pro, and occasionally it autonomously decides to switch to a new Ruby version, so it makes sense that it won't have all my gems. When I switch back, the gems are gone again.
As for the slaves, they don't have RVM installed, and the outcome is the same.
Could this be caused by Mac OS updates?
The gems are not installed in a Jenkins workspace, I installed them before we installed the Jenkins agent.
The Macs are shared with the test-automation team who also ssh/sudo on them, but don't do anything in Ruby because their code is Java.
Could this be caused by mac OS updates ?
It could be caused by OS updates, and this is one of the big reasons you should not use the system Ruby for your development unless you're content with leaving it plain vanilla. Rightly so, Apple considers that Ruby theirs, and they can and will stomp on it with an update if it suits their purposes and you upgrade the OS.
Instead, at a minimum, install a separate Ruby from source or via Homebrew and consider that yours. Or, investigate using rbenv or RVM on the Jenkins boxes to manage your Rubies, which is what we do. That allows builds to use different Rubies and/or sets of gems and lets you fine-tune the Ruby environment on the Jenkins box to whatever the final-destination Ruby will be.
You say your personal RVM changes on its own? Unh-uh, can't happen on its own; SOMETHING told it to change. Don't attribute that stuff to voodoo or juju, something is making those things happen such as your environment variables changed or the .rvmrc file got stomped on. If your RVM configuration is correct it should be very stable; My rbenv and RVM setups have always been very solid unless I screwed them up.
Without dumps of your gem env or rvm info there's not a whole lot we can do to help you straighten it out. In general though, it sounds like you need to treat your Jenkins hosts like they are production boxes, change them very little, and separate your assets from the vendor's.
Of course I know howto install RVM and maintain multiple versions that way, and since I'm a developer I have all the requirements on my own macs (things like xcode etc). Everything is working fine on my own machines.
But how should I distribute my nifty scripts to other mac-users that only have the default 1.8.7 version installed?
I want them to upgrade to 1.9 but I can't expect them to run shell-scripts, rvm (with all its external requirements) etc to be able to run my short 30-line scripts?
Is there a shortcut/tool available so I can get them to upgrade to Ruby 1.9?
Instead of forcing your users to upgrade Ruby, you could package your script into a standalone executable - see SO question on packaging Ruby scripts into Mac OS X applications
There are a few options for automatically setting up development environments.
Thoughtbot's laptop: Laptop is a shell script that turns your Mac OS X laptop into an awesome development machine.
Github's boxen: Automate the pain out of your development environment. Boxen installs your dependencies so you can focus on getting things done.
Pivotal Lab's Workstation: A cookbook of recipes for an OSX workstation.
Thoughtbot's laptop focuses on getting a well-chosen standard set of tools to work on your Mac (you can see which ones in the script).
Boxen seems to be more for teams trying to build their own replicable custom development environment.
I have a pc running windows but I want to use a linux server. Is there a way for me to develop my website on my computer before I rent space on a server? Also its probably important to note that I have no linux experience. Should I just stick with wamp?
Unless you specifically and purposely use .NET features in your PHP Application, then an application developed in WAMP will work fine on a LAMP Server as long as you have included all the same PHP plugins.
PHP is independent from Linux or Windows. 99.9% of the time you have to knowingly use features from the host OS.
You should try ubuntu in a virtualbox, there are lots of well written guides that'll get you up and running.
For best performance, use coLinux. Install a linux distro like ubuntu (easier for beginners) and you should be ok.
Yes. I have developed and maintained a website like this before. My development environment was WAMP and the server was a LAMP shared server. Shouldn't be a problem till your site is using fairly basic libraries and they are available both for windows/linux.
However as others mentioned, its wiser to have the development environment as close possible to the production environment. You don't hit any surprises that way. And hey its not difficult and involves no cost:
You can use dual boot to have linux as other operating system.
Depending on your machine, you can just install VirtualBox and install a Linux VM.