Proper rails deployment steps to DirectAdmin (or any hosting not focusing in apps) hosted server?

Hi,

With PHP applications (only experience I had before), all I needed to do is to FTP all required files, create MySQL username/pass & upload SQL structure, add this username/pass in any given config file of the php script and the app worked.

Can you tell me what are standard/proper steps required to deploy an app that I worked on my local Ubuntu machine and want to have it working on ‘standard’ web hosting company that does not specialize in Rails app hosting?

Thanks,

Rob

Hi,

With PHP applications (only experience I had before), all I needed to do is to FTP all required files, create MySQL username/pass & upload SQL structure, add this username/pass in any given config file of the php script and the app worked.

Can you tell me what are standard/proper steps required to deploy an app that I worked on my local Ubuntu machine and want to have it working on 'standard' web hosting company that does not specialize in Rails app hosting?

While there are many ways of deploying rails applications, it's extremely unlikely that a non rails specialist will have installed/configured any of them. If you're looking for an easy way to deploy a rails app, it's hard to beat heroku for simplicity.

Fred

What is most popular way to deploy apps on non-Heroku machine that has standard Apache/MySQL setup? I would like to be able to deploy my apps (as I learn Rails) to my own dedicated machines. I have already installed Ruby, & rails gem, and I’m able to create apps on that machine without any issues. It is when I develop something localy when I face issue as I don’t know how to deploy it “properly”? Do I simply upload entire app folder structure over FTP, run bundle install, config database, and start the app OR is there a faster/easier way?

One option: http://www.capistranorb.com/

With PHP applications (only experience I had before), all I needed to do is to FTP all required files, create MySQL username/pass & upload SQL structure, add this username/pass in any given config file of the php script and the app worked.

Yes, deploying PHP is quite simple compared to Rails.

Can you tell me what are standard/proper steps required to deploy an app that I worked on my local Ubuntu machine and want to have it working on 'standard' web hosting company that does not specialize in Rails app hosting?

I don't have anything written (which I should) but just googling around, here's a few:

* http://blog.sudobits.com/2013/01/07/how-to-deploy-rails-application-to-vps/
* http://rubysource.com/deploying-a-rails-application/
* http://tommy.chheng.com/2013/01/23/deploying-a-rails-app-on-nginxpuma-with-capistrano/

There's also a pragprog book: http://pragprog.com/book/cbdepra/deploying-rails which I haven't read.

If you hosting solution does not offer shell access, it's going to be very difficult, I think to do an effective deploy. Even moreso if your application requires gems that need to have native extensions compiled.

There are some great Rails-hosting PaaS out there: heroku, EngineYard, CloudFront, etc.

My most recent job, we used AWS to host our app, and deployed using Chef (opscode.com) which was really nice to work with.

I’ve found Nitrous really nice for testing apps somewhere in the cloud: https://www.nitrous.io/join/WWm_3k15gFU

They encourage you to deploy apps (as others suggest) to heroku.

NB. I’ve no affiliation to Nitrious, but that link does include my referral code for more Nitrous points.

I have a dedicated DirectAdmin server running on CentOS and what worked for me is the following:

(Please note I make assumption you have default DA config setup with Apache/MySQL)

  1. Install Ruby, and Rails gem
  2. Install passenger: gem install passenger --pre
  3. Install apache server module: passenger-install-apache2-module
  4. Read the output from (3) and add necessary to your /etc/httpd/conf/httpd.conf. It will ask you to add few modules.
  5. Create Rails app in some directory (ie. /home/SOME_USER/rails_app). This means: PROD config/database.yml has mysql config filled out, gem ‘mysql2’ is installed, bundle install, RAILS_ENV=production bundle exec rake db:migrate, etc.
  6. Modify respective /usr/local/directadmin/data/users/SOME_USER/httpd.conf as per instructions from point (3):
  • change path within <Directory … > to point to /home/SOME_USER/rails_app/public and add these two conditions:

AllowOverride all
Options -MultiViews

  • change DocumentRoot to point to /home/SOME_USER/rails_app/public
  1. Restart Apache, and you are all set. You can now access your domain.com and your app is running. Steps 1-4 are one time setup only. Steps 5-7 when you want to run additional apps. Google for additional config / tuning.

Hopefully this helps,

Kamil