How do you deploy RoR? Newb alert!

Hi there, I'm a newb when it comes to RoR but I have some questions about deployment that has eluded me since I heard about RoR 2+ years ago. I was hoping someone could shed some light for me on this subject.

I've read many books on Ruby and Rails, and I've watched many video tutorials but after hours of reading up on Ruby and Rails, I am still confused about how deployment is done. Mind you, I'm learning this stuff on my own without help from a real person, so I'm a little frustrated about how difficult it is to deploy a site/app.

Also, another question is where can I find a very cheap host to upload my RoR app/site? Or what host would you recommend that wouldn't cost an arm and a leg? I see to use Joyent.com it cost ALOT to host with them (http://www.joyent.com/services/cloudhosting/) like around $500+/ mo for 4GB Ram... That's crazy if you ask me... Especially, if you're just starting out and want to play around before you get into paying more money for a host.

Anyway, here's what I understand thus far about deployment... I can use either "SVN" or "Git" to upload my RoR project to a server, is that correct? Why can't I just use FTP? (newb question I know...)

I've been hearing a lot about Phusion Passenger, but it's a little overwhelming. So just wondering if this is all I need to deploy an app? Would I need git or svn if I used passenger?

What books would you recommend for learning to upload a Ruby on Rails site/app to a server?

I did a few searches here to find out if i could get an answer for my questions but it's a little overwhelming.. I know it's a lot of questions so my apologies in advance. Any guidance I can get about these topics would be very appreciated and helpful. Even if it's just listing a couple books that specifically target these subjects would be great.

Thanks again, Jeremy

P.S. I work on Mac OSX - Snow Leopard 10.6.4, 3.06 GHz Intel Core2 Duo and 4GB memory... Also, I'm working with the current stable versions of Ruby, Rails and gems as of June 27 2010.

Hi,

Try "Deploying Rails Applications"[1] from the Pragmatic Bookshelf. It covers what you're looking for.

[1] http://pragprog.com/titles/fr_deploy/deploying-rails-applications

-- Bob

Hey Bob, Thanks for the information, it's much appreciated.

Quick question though.. I had thought about getting this book but I saw that it was written 2+ years ago (may 2008).. Do you think there is more up to date book out there that would cover this or do you think this book would still be suitable? I'm just worried I'm going to waste money on an outdated book :slight_smile:

Thanks again for your time. Jeremy

At work we use capistrano. Our code comes out of mercurial by allowing the servers access to the mercurial repository.

On my personal site I use capistrano and the code comes out of SVN by being tared up and unpacked at the destination.

Capistrano is a sort of ‘given’ tool if you are a Rails developer, it would be useful if you knew how to use it.

Also it is quite handy :slight_smile:

Hi,

Yeah, stuff moves pretty quickly but a lot of what is in the book still applies. I bought it about a year ago and didn't think it was outdated. It will also give you a really good foundation and makes learning the newer choices easier to pick up.

--Bob

Hi,

SVN and/or GIT has nothing to do directly with deployment or passenger but you should study on Source Code Management or Source Code Version SVN and GIT both are a source code management tools and you can manage the updates of your source code with them.

SVN though is older yet solid, GIT is relatively newer but more popular in Rails community. So if need to start with something, I would say to pick up GIT directly. Get some proficiency in GIT and so if you just wanna test out things, you can get yourself a free account on http://github.com to host public repositories and if you need to keep your code private you might like to go for a paid account. Though GitHub is the most respected provider for hosting Git repos, there are some other good providers for hosting private Git repositories which comes with more economical plans, viz. repositoryhosting.com

Once you are good with Git... time to deploy on a server. In Rails, just forget the old school FTP deployments... it's much more interesting and awesome here once you are familiar with.

Also, another question is where can I find a very cheap host to upload my RoR app/site? Or what host would you recommend that wouldn't cost an arm and a leg? I see to use Joyent.com it cost ALOT to host with them (http://www.joyent.com/services/cloudhosting/) like around $500+/ mo for 4GB Ram... That's crazy if you ask me... Especially, if you're just starting out and want to play around before you get into paying more money for a host.

Why would you need 4GB RAM just to jump start your first rails site (with no live users I suppose). 4GB anyhow is going to cost you a bit more. Go for some economical hosting providers, Linode or SpeedyRails etc. I don't have personal experience with Linode, but SR guys will setup everything for you ... including.. MySql, Phusion Passenger and automated deployment with Capistrano.... you will just need to give them your repository information (and money :). Capistrano is a tool for automating your deployment process, especially for Rails apps.. you can read more about it here http://www.capify.org So, there after, any change you'll make in your code, you just need to push the changes to the repository and fire just one command from your application root... most likely this "cap deploy" to redeploy with the latest changes.

I hope this would help you somehow.

regards, Sur

Hi everyone, I have to say that I am very pleased that I have received such great responses! I kept expecting that I would get the cold shoulder but instead I got real answers. I feel I have a solid direction and don't feel like I'm blindly trying to figure this stuff out. So please accept my sincerest thank you to all of you for helping me out!

Bob, I decided to go ahead and buy the book regardless if it's outdated :slight_smile: I kinda figured the way deployment is done couldn't have changed too much.

Peter, Thank you, I appreciate your contribution as well. Although, it was a little over my head when you started talking "mercurial repositories" but I'm sure I'll understand what that means sometime in the near future.

Sur, This helps greatly! You have certainly gone above and beyond what I was looking for, so thank you for all the time and effort you put into this thread. I'm sure all this information will help other newbs as well when they go looking for an answer.

Thanks again!

Jeremy wrote:

Hi everyone, I have to say that I am very pleased that I have received such great responses! I kept expecting that I would get the cold shoulder but instead I got real answers. I feel I have a solid direction and don't feel like I'm blindly trying to figure this stuff out. So please accept my sincerest thank you to all of you for helping me out!

Bob, I decided to go ahead and buy the book regardless if it's outdated :slight_smile: I kinda figured the way deployment is done couldn't have changed too much.

It probably has. I don't think Passenger was in wide use at the time, and it's now probably the most common choice for deployment.

Peter, Thank you, I appreciate your contribution as well. Although, it was a little over my head when you started talking "mercurial repositories" but I'm sure I'll understand what that means sometime in the near future.

Mercurial is a version control system -- though it's not in all that wide use in the Rails community. I think most Rails developers use Git. Which version control system are you using?

(Hint: if the answer is "none", fix that *today* by installing Git. There is no excuse whatsoever for neglecting version control.)

Also, check out Heroku for very easy Rails deployment.

Best,

Hi Marnen,

    > It probably has. I don't think Passenger was in wide use at the time,     > and it's now probably the most common choice for deployment.

So you're saying Passenger is a good choice for deployment then? I still plan to read the aforementioned book, I don't think it would hurt.

   > Which version control system are you using?    > (Hint: if the answer is "none", fix that *today* by installing Git.    > There is no excuse whatsoever for neglecting version control.)

Well, I never plan to neglect vc... that's partially why I created this thread because I wasn't sure what to use. I already have Git installed (which I installed quite some time ago), but I don't understand how to use it quite yet so that's why I'm reading what I can about it... but I need a book that is going to take me through it via baby steps since I don't have any experience whatsoever using Git, (or any other vc as far as that goes but Git is what I'll probably use in the end.)

Also, check out Heroku for very easy Rails deployment.

I will def look into that, thank you for the reference.

Thanks again, Jeremy

Jeremy wrote:

Hi Marnen,

> It probably has\. �I don't think Passenger was in wide use at the

time, > and it's now probably the most common choice for deployment.

So you're saying Passenger is a good choice for deployment then?

Definitely.

I still plan to read the aforementioned book, I don't think it would hurt.

Why do you want to read an outdated book?

> �Which version control system are you using? > (Hint: if the answer is "none", fix that *today* by installing Git. > �There is no excuse whatsoever for neglecting version control.)

Well, I never plan to neglect vc... that's partially why I created this thread because I wasn't sure what to use. I already have Git installed (which I installed quite some time ago), but I don't understand how to use it quite yet so that's why I'm reading what I can about it... but I need a book that is going to take me through it via baby steps since I don't have any experience whatsoever using Git, (or any other vc as far as that goes but Git is what I'll probably use in the end.)

I don't know of any books on Git. But there are plenty of Web tutorials.

Just start using it. Also use RSpec and Cucumber to do all development test-first. Serious development in 2010 absolutely requires both version control and automated tests.

Hi Jeremy and everyone :slight_smile:

Found myself following this discussion and all the great informative answers supplied here. I am too in a learning process with my first app, very much a Newbie (in RoR and Web in general, though have a programming experience) and lately have been trying to figure out the deployment process, terms, and sort of 'what belongs where' :slight_smile:

I wish to validate what I understood so far, it probably contains mistakes and wrong assumptions as I'm still learning , so please correct me when I'm wrong :slight_smile: (@Jeremy: hope it's ok I joined the discussions you opened..)

I'm currently developing on Windows.. started with using InstantRails and installed Git on Cygwin. This allowed me to experiment with some developing locally, begin with local version control and git-clone repositories for plugins/Gems. As I read some more, I realized I'd probably want to deploy my App on a Linux/Unix based server rather than a Windows one and that developing on windows and deploying on Linux (the way I initially started developing) might not be a good idea at all. Therefore I decided to install VM on my Windows machine.. have seen some posts lately on the subject.. currently I just installed VMWare Player (had to use version 2.5, my CPU wasn’t compatible with 3.1) but have thoughts of maybe trying VirtualRails instead (if it works on my machine) – I did see VirtualRails is using MintLinux-based Linux and was wondering whether that might cause future problems (as opposed to using Ubuntu for example)? After deciding and once I have that set (I expect future questions about setting it all up as well) – more questions.. these I'm afraid are going to reflect my newbie confusion.. but sincere informative and patient answers can help me "map" the information I have in my head, the information I'm reading and looking for and focus me, and thus will be very much appreciated.. I will say in advance I think some of the mistakes I'm about to describe may result from the fact English isn't my first language and so maybe I don't understand the different terms fully (such as deployment, hosting, etc.), that and being also new to Web development.. Ok – deployment questions: I couldn't understand for sure whether I need both a host and a place to deploy my App? And also was confused by the lines Sur wrote: "Go for some economical hosting providers, Linode or SpeedyRails etc. I don't have personal experience with Linode, but SR guys will setup everything for you ... including.. MySql, Phusion Passenger and automated deployment with Capistrano.... you will just need to give them your repository information (and money :). " I mean – it didn't make sense I'd use both Passenger and Capistrano (probably it does but I understood they're both used for deployment, thus the confusion..), unless Capistrano does both automated deployment but can also be used when using a different deployment service.. I feel and know I mix everything up here, but any light you can put for me on this subject will be very helpful.. Was also confused by the fact Phusion Passenger offers "Phusion Passenger for Nginx".. while I got the impression (obviously a wrong one, or not full) – I can deploy my app on Nginx as well? At least I heard people mentioning Nginx at the same sentence with Heroku and Passenger.. This brings me to another question: I also understood I can use heroku for deployment, which will require not more than one git push every once in a while (of course I know there's much more to it, but it was to explain me the ease of use).. in case I do use heroku (couldn't find any cons to using it I should be aware of, if someone can write a few from his/her experience, I'll be glad to learn..) – can I git push from my local repository or do I need first to push to a remote one, such as a public/private repository on GitHub? Moreover, if I'm the only one playing around with this app right now – what benefits can a GitHub repository give me comparing to using it locally? (this question is relevant, of course, only in case it's not a mandatory step for deployment, for example.. from Sur's quote it sounds it is a required step, at least if I used Capistrano..) More about Heroku – if I choose to use it, do I need a host as well? From what I understood concerning Heroku – I git push my code there (which should be possible with local Git repository to my understanding), and I also need to point my DNS to Heroku, but then it means I only need a DNS provider and not a necessarily a host.. (?) I feel whenever I think I begin to understand bits of information, I'm faced with more information which doesn't fit the previous one.. think once I have the terms and process better mapped I can better learn and understand.. I'm also feeling this might be seen as a very clueless, mixed post.. To sum this long post up – I'm a NewB, and this is the reason I'm asking many questions here, as I'm teaching myself and don't have anybody to correct me or direct me when I do mistakes :slight_smile: It does not mean I'm not doing my heavy reading to figure things out on my own, but doing lots of reading with no experienced person around to direct me led me to such confusion at the moment of writing.. Many thanks in advance to anyone patient enough to address some of my questions / direct me :slight_smile:

Nin.

newcomer wrote:

Hi Jeremy and everyone :slight_smile:

Found myself following this discussion and all the great informative answers supplied here. I am too in a learning process with my first app, very much a Newbie (in RoR and Web in general, though have a programming experience) and lately have been trying to figure out the deployment process, terms, and sort of 'what belongs where' :slight_smile:

Welcome!

[...]

I'm currently developing on Windows.. started with using InstantRails and installed Git on Cygwin. This allowed me to experiment with some developing locally, begin with local version control and git-clone repositories for plugins/Gems. As I read some more, I realized I'd probably want to deploy my App on a Linux/Unix based server rather than a Windows one and that developing on windows and deploying on Linux (the way I initially started developing) might not be a good idea at all. Therefore I decided to install VM on my Windows machine.. have seen some posts lately on the subject.. currently I just installed VMWare Player (had to use version 2.5, my CPU wasn�t compatible with 3.1) but have thoughts of maybe trying VirtualRails instead (if it works on my machine) � I did see VirtualRails is using MintLinux-based Linux and was wondering whether that might cause future problems (as opposed to using Ubuntu for example)?

I doubt that that would be a problem. I develop on Mac OS X (which is BSD, not Linux) and routinely deploy to Linux servers without any problem.

[...]

Ok � deployment questions: I couldn't understand for sure whether I need both a host and a place to deploy my App?

No. A host is a place to deploy your app. Same thing.

[...]

I mean � it didn't make sense I'd use both Passenger and Capistrano (probably it does but I understood they're both used for deployment, thus the confusion..), unless Capistrano does both automated deployment but can also be used when using a different deployment service..

They are different tools for different purposes. Capistrano takes care of putting your app on the server, while Passenger serves it once it's there.

I feel and know I mix everything up here, but any light you can put for me on this subject will be very helpful.. Was also confused by the fact Phusion Passenger offers "Phusion Passenger for Nginx".. while I got the impression (obviously a wrong one, or not full) � I can deploy my app on Nginx as well? At least I heard people mentioning Nginx at the same sentence with Heroku and Passenger..

Apache and Nginx are Web server programs. By themselves, they just serve static files without any server-side dynamic content. This is great for serving static websites, but obviously will not work if you're using a server-side programming language like PHP or Ruby. For Apache or Nginx to run PHP/Ruby/Python/whatever applications, it needs a module to connect it to the appropriate interpreter. That's basically what Passenger does.

In other words, you need Passenger (or something similar, but Passenger is probably simplest) in order for Apache or Nginx to talk to the Ruby interpreter. Passenger is available either as an Apache module or as an Nginx module.

This brings me to another question: I also understood I can use heroku for deployment, which will require not more than one git push every once in a while (of course I know there's much more to it, but it was to explain me the ease of use).. in case I do use heroku (couldn't find any cons to using it I should be aware of, if someone can write a few from his/her experience, I'll be glad to learn..) � can I git push from my local repository or do I need first to push to a remote one, such as a public/private repository on GitHub?

You can git push from anywhere. Heroku doesn't care.

Moreover, if I'm the only one playing around with this app right now � what benefits can a GitHub repository give me comparing to using it locally?

It gives you another copy of the code stored offsite.

[...]

More about Heroku � if I choose to use it, do I need a host as well?

Heroku *is* a host.

Best,

@Marnen: Thank you! I appreciate it a lot..

The joy I feel after reading your reply, when things start to make sense.. this is great, thanks :slight_smile:

wrote below..

newcomer wrote:

[...]

> I'm currently developing on Windows.. started with using InstantRails > and installed Git on Cygwin. This allowed me to experiment with some > developing locally, begin with local version control and git-clone > repositories for plugins/Gems. > As I read some more, I realized I'd probably want to deploy my App on > a Linux/Unix based server rather than a Windows one and that > developing on windows and deploying on Linux (the way I initially > started developing) might not be a good idea at all. > Therefore I decided to install VM on my Windows machine.. have seen > some posts lately on the subject.. currently I just installed VMWare > Player (had to use version 2.5, my CPU wasn t compatible with 3.1) but > have thoughts of maybe trying VirtualRails instead (if it works on my > machine) I did see VirtualRails is using MintLinux-based Linux and > was wondering whether that might cause future problems (as opposed to > using Ubuntu for example)?

I doubt that that would be a problem. I develop on Mac OS X (which is BSD, not Linux) and routinely deploy to Linux servers without any problem.

This one surprised me a bit as I heard many confident "no-no"s on this, though what you wrote sounds like good news. Naturally, best thing would be to try it out, just hesitated because of what I've heard on this subject.. (and besides, was also thrilled to get into Linux as well, though learning everything from scratch at the same time has it's pros and cons..)

I did have another reason to go and install VM, though I'm not sure it was a correct one, short description as follows:

In one of the posts around I read about Cappuccino and it looked great, so wanted to try it out as well for my User Interface.. but the download instructions contain a shell script I'm supposed to be running (if I understood correctly), when not building from the source (being a Newbie and after reading a bit I assumed this was not for me yet). Anyway, when happily going to Cygwin to run the bootstrap.sh file I encountered the following message:

"Error: Narwhal is not compatible with your JVM. Please switch to the Sun (HotSpot) JVM and re-run bootstrap.sh"

and from reading a bit (like here: http://groups.google.com/group/objectivej/browse_frm/thread/c4996786d8465be7/72d2fcdcfdf7ccb7?tvc=1#72d2fcdcfdf7ccb7 )

I understood (though haven't asked directly and I may be wrong here) VM won't encounter such problems.. it's Cygwin that's not supported

But.. now that I'm writing it here, I re-think this and actually don't know if that's a required thing for my needs of Cappuccino or even if I understood correctly.. (sigh..)

[...]

After this re-thinking and sighing, I still am very happy about the information you supplied me with..

Thanks again :slight_smile:

Nin.

newcomer wrote:

@Marnen: Thank you! I appreciate it a lot..

The joy I feel after reading your reply, when things start to make sense.. this is great, thanks :slight_smile:

wrote below..

newcomer wrote:

> started developing) might not be a good idea at all. problem.

This one surprised me a bit as I heard many confident "no-no"s on this, though what you wrote sounds like good news. Naturally, best thing would be to try it out, just hesitated because of what I've heard on this subject.. (and besides, was also thrilled to get into Linux as well, though learning everything from scratch at the same time has it's pros and cons..)

Er, I was talking about Mint Linux vs. Ubuntu Linux (which shouldn't be a problem), not Windows vs. *nix (which might well cause problems).

I did have another reason to go and install VM, though I'm not sure it was a correct one, short description as follows:

In one of the posts around I read about Cappuccino and it looked great, so wanted to try it out as well for my User Interface.. but the download instructions contain a shell script I'm supposed to be running (if I understood correctly), when not building from the source (being a Newbie and after reading a bit I assumed this was not for me yet). Anyway, when happily going to Cygwin to run the bootstrap.sh file I encountered the following message:

"Error: Narwhal is not compatible with your JVM. Please switch to the Sun (HotSpot) JVM and re-run bootstrap.sh"

[...]

This is probably better directed to a Cappuccino forum.

Best,

Hi :slight_smile:

confused again: My first question here is a bit less connected to the original post's subject, so @Jeremy - I apologise..

@Marnen: Just read this again: http://groups.google.com/group/rubyonrails-talk/browse_frm/thread/55bdcc2ee8fb0c3e/72613f954c70a9f2?#72613f954c70a9f2

After reading your reply, I thought I should give it a try to Passenger, but according to this I should be using VM while I just understood from the previous answer I do not have to (as I wrote before, will move to VM gladly, but just trying to understand first)

Also another question about Heroku - being a host, I was wondering why would it guide me to point my DNS server to Heroku, Zerigo being recommended? Do I need to purchase separately a DNS service when deploying to Heroku? Or is it again my lack of understading of an additional functionality?

(was looking on this page here:

)

Thanks again :slight_smile:

Best, Nin.

newcomer wrote: > @Marnen: Thank you! I appreciate it a lot..

> The joy I feel after reading your reply, when things start to make > sense.. this is great, thanks :slight_smile:

> wrote below..

>> newcomer wrote:

>> > started developing) might not be a good idea at all. >> problem.

> This one surprised me a bit as I heard many confident "no-no"s on > this, though what you wrote sounds like good news. Naturally, best > thing would be to try it out, just hesitated because of what I've > heard on this subject.. (and besides, was also thrilled to get into > Linux as well, though learning everything from scratch at the same > time has it's pros and cons..)

Er, I was talking about Mint Linux vs. Ubuntu Linux (which shouldn't be a problem), not Windows vs. *nix (which might well cause problems).

Funny, just sent another question about that :slight_smile: Got it, thanks.. will happily move to VM then..

> I did have another reason to go and install VM, though I'm not sure it > was a correct one, short description as follows:

> In one of the posts around I read about Cappuccino and it looked > great, so wanted to try it out as well for my User Interface.. but the > download instructions contain a shell script I'm supposed to be > running (if I understood correctly), when not building from the source > (being a Newbie and after reading a bit I assumed this was not for me > yet). > Anyway, when happily going to Cygwin to run the bootstrap.sh file I > encountered the following message:

> "Error: Narwhal is not compatible with your JVM. Please switch to the > Sun (HotSpot) JVM and re-run bootstrap.sh"

[...]

This is probably better directed to a Cappuccino forum.

yes, my embarrassment in sending stupid questions (like in this post) prevented me from asking them thus receiving answers. But after your replies I feel more confident to ask these :slight_smile:

Best,

Nin.

You have to pick a domain registrar -- Network Solutions, GoDaddy, etc. -- to register a domain name. That registrar should offer DNS service as part of the registration.

For development and learning purposes, you don't even need that, as your heroku deployment will just appear to be a subdomain, e.g. http://example.heroku.com/

@ Hassan: many thanks :slight_smile:

Was just going to rephrase this question to ask whether Heroku has its own DNS service or do I need to purchase one and point it to Heroku.. and you just answered me and cleared it up :slight_smile:

Best,

Nin.

Hi Nin,

subject, so @Jeremy - I apologise..

No worries at all, you bring up some good points and I welcome anyone who can offer guidance and newbs who might have questions that I haven't thought of or are confused about. I am learning this all myself so I also do not have a mentor or tutor to guide me through the steps. All I have is books and video tutorials and the ruby and rails community.

Anyway, the point you brought up about Passenger---      "I mean – it didn't make sense I'd use both Passenger and Capistrano      (probably it does but I understood they're both used for deployment,      thus the confusion..), unless Capistrano does both automated      deployment but can also be used when using a different deployment      service.. "

and the response that Marnen supplied---      "They are different tools for different purposes. Capistrano takes care      of putting your app on the server, while Passenger serves it once it's      there. "

This was so great because I was still confused about whether to use Passenger or Capistrano for deployment since I thought they basically did the same thing. Now that I understand this a little better, it will definitely help me when learning to use them.

So, thanks for your contributions to the thread :slight_smile:

@Marnen, and @Hassan--- You ROCK!

Best Regards, Jeremy

I am also new on Rails, This thread is very helpful. I also started development from windows but when i reached at the point of passenger, than I moved to Linux Ubuntu.

I start working with godaddy hosting, but face some problems than i move to site5.com and successfully upload my first demo project. (its working)

Now from this thread i understand the difference between Capis and Passenger.

Thanks for all contributes.

Now again when I upload the project from FTP, I found it is so hard, Because it is like installing whole application every time, than i understand the importance of version control system.

I looked for the way to use any thing else other than GIT, because it is not free, but did not find any thing , my question is that subversion and GIT work same task or different. If yes than will putty is right direction to go with subversion.

Thanks a lot