Any recommended Rails Deployment tutorial book? [closed] - ruby-on-rails

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm confused by Rails Deployment.
I followed this guide(https://github.com/rocodev/guides/wiki/setup-production-development) to setup environment on my server.
I have done all the installation proccess, but it doesn't work!!
When I run 'cap deploy:setup', it asked me to type password, and I typed, but it said permission denied.
I couldn't find out what the problem is, and I can't clearly know some parts of this guide.
Are there any resources(maybe a book) can give me a robust understanding about Rails Deployment?
Thank you.

There are a couple of books on Rails deployment practices:
Deploying Rails: Automate, Deploy, Scale, Maintain, and Sleep at Night published by the PragProgs. Written in 2012, and focusing on Rails 3.x, but should still be mostly up to date (really nothing much has changed in the space in the last 2 years). (Or, the old versions of the tools aren't super broken and still widely used).
Reliably Deploying Rails Applications, published via LeanPub. 80% done as of this writing, and does incorporate the bleeding edge tools.
I haven't read the latter book, but I have read the former book and liked it reasonably well.

I don't think you need to read a book on rails deployment for fixing production issues. Once you complete a book, It's not mean you able to deploy your app seamless manner. Still issue will occur and you will run to Google. We always leant form our mistakes and by fixing them.
I would suggest have a look to small blogs and tutorial.
Deploying to a VPS
HOW TO DEPLOY RAILS APPLICATION TO VPS
Setup A Ubuntu VPS For Hosting Ruby On Rails Applications
Deploying Rails to Dreamhost VPS
Capistrano Tasks
Capistrano Tasks (revised)
If you really want a deep understanding of rails development. Go ahead with below book.
Deploying Rails: Automate, Deploy, Scale, Maintain, and Sleep at Night

I started with these two RailsCasts:
Manual setup of a rails environment on a VPS: http://railscasts.com/episodes/335-deploying-to-a-vps
Automating the above with capistrano: http://railscasts.com/episodes/337-capistrano-recipes
There's a lot of other tools / options, but this is a pretty common (simple) way of managing and deploying servers. I use this basic setup for managing 2 different clustered environments, with 3 servers each (one of them is not rails) + an NFS between them - works well.
BUT, if you can, I'd really look at PaaS (like Heroku) options. I also run a more vanilla rails web app on this platform and it saves me a lot of time in server maintenance, management, and scripting.

Related

What do I need to learn to manage a server/deploy? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I'm a rails developer (with about a year of experience) and I am getting pretty comfortable with it, but I find that I lack even a cursory understanding of how deploys or servers work. I am familiar with terms like Unicorn or Apache, but I don't know much beyond the notion that they manage rails instances (?).
I have heard of chef, and I know it is used for deploys, but I don't know where I'd begin.
Is there a book or a screencast series that would be useful in learning this sort of thing?
(Side note: I have a project I want to make that will run sort of like a template builder and a web host, so understanding how to add domains/subdomains/manage that sort of thing is one of the primary drives for learning, other than the natural want to learn).
When dealing with remote (or even local) deploys, I find that the best solution is using capistrano. You can find all the information you need at their website.
You can start reading the long README from Github and then switch to more detailed information starting from here.
When deploying a Rails application, usually servers like Apache or nginx acts as a router to your application's local server. Eg. you start a thin server for your deployed app that answers on the 1234 port and configure Apache to redirect all the calls to you remote address to the local server at localhost:1234.
Capistrano will start/restart/stop the local Rails server through the configuration you'll put in the config files, so you'll have complete control over it.
Hopes this helps. You can find lots of information online about capistrano and the integration with various http servers and rails servers.
Eg. a good starting point can be this screencast made by Ryan Bates, but beware! This is for the older 2.x version of capistrano.
Don't go anywhere but straight to latest awesome chef fundamental series, check opsode user on youtube (http://www.youtube.com/user/Opscode).
First episode:
http://www.youtube.com/watch?v=yh9osPQA_-k
after it you can go to irc, docs, watch other advanced things (including berkshelf). But first things first.
I have lots of things to tell regarding this. I'm on chef for around a month, and I've spent tons of hours understanding how it works. And I'd say the official docs are just a disaster. They give everything in one place, although you don't need to know it in the begging. I can only offer you some resources like: http://learnchef.getharvest.com/ which is best ever introduction I've found around. All those official learnchef links didn't work out for me.
I'd really recommend to stay away from Vagrant for a while, just buy a 5$ vps on DigitalOcean cloud and try this manual: http://adamcod.es/2013/06/04/deploy-a-basic-lamp-stack-digital-ocean-chef-solo.html
Start with a chef-solo instead of chef-server, and try knife-solo. Use berkshelf although it's rarely mentioned in official docs, because chef can't handle cookbook dependencies although it can download cookbooks. then slowly start looking how I've automatized a chef-server installation: http://github.com/holms/chef-starter This will give you an idea, which steps to take for chef-server setup, and how to deploy stuff with knife.
After all that, try vagrant, as it offers to run everything from your desktop machine. I've started from vagrant and I've wasted too much time. When you put chef-server and vagrant together, you get tons of information which you just unable to handle. Lots of cave heats appears, lots of things to write.. you ending up wasting your 40 hours non-stop learning, without achieving your desired results.
You can contact me on freenode irc if you need any help. I'd never wish this chef experience even to my enemy.
Update:
This is quite old comment :) So just ignore it. Ended up using vagrant+chef, then vagrant+ansible, now using docker. To be exact docker+traefik

Experienced web developers, what's the learning curve like on heroku? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I just began switching from spring development to ruby on rails. I wanted to know from those who have used it before, what's the learning curve, if any, on a rails application being deployed for heroku?
Are there any special needs for heroku deployment?
What are the major advantages and disadvantages of heroku?
Thanks in advance :D
Heroku is the easiest possible Rails deployment. It's a fully managed black-box solution for your app with excellent documentation, and they are consistently improving it with an eye to usability. Once you have a working development version of your app, it's a very short hop to being up and running on Heroku. See the Quickstart and Getting Started with Ruby articles for the specifics.
The cost of this ease-of-use is a certain amount of inflexibility. They do a good job of making things open-ended, but a one-size-fits-all approach to hosting architecture inevitably will lead to issues. If you just have a small to medium web app with a standard relational database and common load profile this is not much of a problem. If you need a more custom stack with various additional services (eg. redis, sphinx, rabbitmq, etc) then you'll likely be getting into third-party addons. All of these hosted solutions and Heroku itself charge a premium over the Amazon Web Services that they are built on, which in turn charges a premium over raw hardware / colocation costs of running your own servers. If your site scales very large not only will you be paying a huge premium, but the assumptions that hosted service providers make for the general case will inevitably not fit your particular case as well as a custom-tuned cluster. This is why all truly massive companies like Google, Facebook, Yahoo all run their own data centers, because at that scale having a cadre of dedicated $200k/year systems engineers designing and maintaining your infrastructure pays for itself for many times over simply from the savings of moving away from commodity solutions.
But at small scale, especially during the early rapid iteration of a product, using something like Heroku means you can focus entirely on your application and have a minimum of worry about infrastructure. One exception is if you have a lot of Linux sysadmin chops, then Heroku may not be worth the cost even early, and in that case you might be more comfortable with something like Engine Yard that still provides you with a full Rails stack out of the box, but keeps you closer to the metal.
In any case though, Heroku is a great place to start for a Rails beginner. It's free to get started, and there's no reason you can't do a cost assessment and migrate away later when you have more experience.
The answer by gtd is great, just to add a bit about the problems I have ran into with heroku:
When I started with Ruby on Rails and Heroku about a year ago, the thing that gave me most problems was that by default on my dev machine, Rails used SQLite, and on Heroku the default is postgreSQL.
It usually doesn't give much trouble but certain things such as GROUP BY work differently which led me to lots of frustration when certain things would work on my dev machine and not on Heroku. I would suggest you install a postgreSQL server on your dev machine, for non trivial apps that you are planning to deploy on Heroku.
There are a couple other things that you can't do on Heroku and you can on a VPS, I had problems when working with a payment provider which required me to have a static ip, because Heroku is a cloud service it couldn't be done, and I had to use a proxy to connect with the provider.
Also there are a couple of gems (very few) which you can't install there, and you can't install binaries which some gems depend on, although it's never been a problem for me, bear that in mind.
Other than that couple of gotchas, Heroku is the easiest place to start deploying your apps.

Downgrading Michael Hartl's Rails application to Rails 2 [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I built (hacked) my web app by extending Michael Hartl's Rails 3 tutorial, only to discover that my web hosting service requires Rails 2.3.8. I am a complete newbie to Ruby/Rails, and was wondering how feasible a downgrade from Rails 3.x to Rails 2.x would be.
Unfortunately my webhost is not able to upgrade to Rails 3.
Edit
To be more specific: my application is largely based on the tutorial mentioned above. I am looking to determine what type of effort is involved in downgrading the Rails 3 tutorial application into a Rails 2 application. I will try it out anyway, but due to my inexperience with Ruby / Rails, before I started I just wanted to get an idea of what to expect (i.e., if there will be a lot of syntax changes, or will I have to restructure the file directory, etc.)
You do NOT want to do this, it's a really bad idea, You'll end up chasing your tail forever with weird error messages and when yuo ask about them you'll be a very unusual case.
Either
Find a host that support Rails 3, while you get ready for Rails 4 (tee-hee)
Seek out of of the (many) books on amazon or ebay that cater to rails 2 (still probably a majority at this point).
Use Heroku - many people are using Heroku to go live for free and then be low cost when more's needed.
The main thing here about rails is that the versions advance quickly - and the code structure changes a lot with each version. You have to work much harder to avoid technical debt than with other, more mature, technologies.
Agree with the 'new host' suggestions. I haven't downgraded an app, but the upgrades I've done have taken weeks on large apps. So my answer is that it's not feasible enough for me to want to try, and I've been using Rails for years.
I've had a cheap Dreamhost account for years, and they stay up to date. I've also heard good things about bluehost. Note that both of these shared providers are "get what you pay for," but if you value your time, it's certainly worth $7 or whatever the monthly fee is to not spend your time downgrading the app.
It can be done though if that's what you really want. But it is a lot of work. I remember upgrading one very large app from rails 2 to rails 3. You will need to do this reversely. I had to solve gem compatibility(some gems only work with rails 3 and it might be harder to get support for rails 2 now), active record had a different API in the past versions, I'm not even sure if there was the chaining feature. E.g. instead of Model.where, you would often write Model.find(:conditions => {...}), if you're using generic ajax helpers(with :remote => true) that appeared in rails 3, then these would not work. Plus I would also scan the rails changelog for any security patches that were done in rails 3 just to be sure. Could be that you will have to tighten security on some places on your own in the older version. If you have your app test covered (and I hope you do :-)) than there might be some problems with older versions of rspec or cucumber but generally these were not so big. I think gem compatibility is the greatest issue. The rest is more or less mechanical work. Find and replace.
Good luck with that but as was said before, if you can switch your hosting then I advise to do so and stick to the latest version of rails.

Suggestions for the best Rails collaborative development stack? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Looking for some suggestions from the community for development stacks for collaborative environments. Could you share what you have and what has worked for you or your team?
The following is probably too verbose for some and an expression of just some rambling thoughts I've had about my particular scenario as I'm working with a hatchling dev group. SO, if you read it 1UP for you, otherwise, please just feel free to just share your thoughts re: the first question and what's worked for your team.
I have a situation where myself and a couple other developers are working together and I'd like to set up the "best" dev environment possible for Ruby on Rails development. At the moment I use git and some of the usually accepted best practices for development, however the other guys are new and not terribly familiar with the shell, git, etc. They're more from a php and monolithic environment.
I do have a central linux server that has been used hitherto for LAMP based dev for them. I can retool it to anything I'd like it to be as I'm quite adept and experienced at Unix system and network admin.
Could someone please suggest what may work well in this scenario? Again, ultimately we need to do collaborative development that has the lowest learning curve. I'll be the only one deploying to Heroku until I feel comfortable with their experience.
I would like to put something together that can get us all up to speed quickly in a matter of a day vs a longer learning curve and then allow them to grow into the shell and so forth over the next couple weeks.
What I was thinking was more of a shared SMB (mixed Windows and Mac workstations) and SFTP unified projects folder that has either apache virtual hosts for each project or thin rack. I'd continue to use my methods, but this could provide the flexibility for them to grow into this and be able to restart httpd or thin as per need.
Am I on the proverbial right track or has someone seen a better alternative? A lot of things have crossed my mind such as Gitorious (since we'll have a lot of small projects needing to be tracked and an enormous GitHub account is not feasible), Heroku, OpenShift and a lot of other things, but I have enough uncertainty that I'd like to get some input from the community as to the right mix for great collaborative agile development.
I have an answer but I think you have conflicting requirements: i.e. lowest learning curve vs low/free cost.
You say that GitHub is not feasible but it does offer unparalleled features for novice users. They can see commits on a website instead of on the commandline, can even edit files right in the browser (since yesterday, uses Ace) and gain insight into the branching/merging process.
Another paid option is http://cloud9ide.com/ which is also web-based.
I use my own development server as well but only use it for experienced people who need no hand-holding. If I were to let everyone on there the amount of support would consume my entire day.
It is my opinion that doing Rails development people should adopt the best practices in the field. See it like this: at least you won't burden them with learning Subversion or --eek-- CVS. Just seeing the commits on GitHub and having a discussion right after puzzling pieces of code is worth the money.

PHP developer learning Ruby and Ruby on Rails [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I have been interested in learning Rails for some time now and feel now is as good as time as ever to dip in and actually get my hands dirty. I've spent the past week reading every free ebook on Ruby and Ruby on Rails I can find. I just finished reading Ruby Essentials. I have also been playing with http://tryruby.hobix.com/
I have installed Ruby, Rails, MySQL, PHP, phpMyAdmin on a Windows XP machine, I also have access to a Ubuntu machine.
I come from several years of PHP experience and around a year using CodeIgniter.
What I would really like now is a fairly basic Rails app that is a little more in depth than Hello World but not quite up to par with say a forum or blog.
I find its much easier to learn how something works when I can play with already made code and do some trial and error changes.
What I am really looking for is that 'Ohhh, I totally understand now!' moment I had when I first started learning PHP.
Does anyone have an app or know of one that could possibly provide that moment?
Check out the screen casts on Rails at BuildingWebApps . I've watched several and they have been exactly what I was looking for when learning rails. They start simple and keep adding more and more functionality. The commentators move at a good pace and subscribing to the lessons is free.
If you want something that is built already build the sample application that comes with Agile Web Development on Rails, buy the pdf from pragprog.com, the latest version is set to work with Rails 2.2, so will work with 2.3 as all the basic features of the framework will be the same.
When you are ready to move on from that, the Rails Guides website is all new and is a great resource for all developers new and old.
dwc is right though, a blog is a good thing to start on your own, so when you are confident give it a go, even if you don't put it in production it will help you along.
I would recommend railsforphp.com. They have a PHP to Ruby reference which could be quite helpful.
You can also buy the 'Rails for PHP Developers' book as either a paper or digital copy (or both if you really want to). The book is full of examples that show the PHP way and how it compares to the Ruby/Rails way.
As for ready made code, I suggest having a play with Enki. It is a somewhat bare-bones blogging system that should give you a good testing ground.
You should rethink your idea that a blog is too complex. At it's simplest a blog is a textarea and a submit button, and then storing and regurgitating the results. Start with that to get your hands dirty, then add features as you go. In fact, why not practice some Agile and do your own iterations?
The Rails Guides are nice http://guides.rubyonrails.org/
If you don't like the blog idea, you could make a wiki, this isn't very complex either. you simply need a edit button on every page with the text from the linked to it. This will teach you how to handle rails and play with ruby for things like regular expressions and such.
Take your time, break down these problems and and they should be easy for you to solve with rails.
And go on IRC (server freenode channel #rubyonrails) you can use MIRC for that. Ask questions there, I usually am there, (look for nims).
My suggestion would be to start with a simple CMS. This is something you can continue to use and expand as your skills progress and you start other more complicated projects. In the most basic form, this consists of a Page model, and a Topic model. You could then add a User model, some login capabilities and a simple admin interface. After all, Rails was originally envisioned to make it easy to CMS type sites.
As you get this up and running, you can add some plugins to extend the functionality to include tagging, comments, and more. Or you can roll these capabilities yourself.
Set up an account on Github and learn how to use Git. Its great, and better than what you used before (if anything.) You should also learn rake, and capistrano, as these are huge timesavers and work hand in hand with Rails and Github.
http://blog.caboo.se/articles/2007/4/11/sample-rails-application
http://www.railsinside.com/elsewhere/100-7-barebones-rails-apps-to-kick-start-your-development-process.html

Resources