I have a client who wants to be able to add/delete/modify email addresses etc through cPanel, but I'd much rather add my own virtualhosts config for the actual site instead of a cPanel generated one. (A bunch of reasons. Don't want to install cPanel's ruby, would rather use passenger than mongrel, etc etc).
I don't have a whole lot of experience with cPanel, but by the look of things it takes over httpd.conf & auto-generates a virtualhost for the site - and overwrites stuff if I try to make any changes to the virtualhost settings. Is there a simple means to overwrite these settings without removing the rest of the site's functionality from cPanel?
Cheers...
You are correct in guessing that cPanel takes over a lot of things and auto-generates certain configs. To be honest, I have no idea what it does in regard to virtualhosts configs, but I do have recent experience in other areas which tends to confirm your suspicion:
So, to illustrate... cPanel comes stock with Rails 2.3.5. On the cPanel GemSet page, you can see Rails 3.0.6 shows as available, and even lets you install it via cPanel or SSH/BASH. This results in no error message at all (in fact, cPanel itself reports it as installed), but a rails --version command at SSH/BASH still shows version 2.3.5. After some research on on the cPanel forums, I discovered that this is because cPanel is hard coded for Mongrel support, and Mongrel doesn't support Rails past version 2.3.8. According to one of their moderators, they're looking at a possible Passenger solution, but it's still in the early stages of coding and months away.
So, while I realize my example doesn't specifically answer your question about virtualhosts, I think it confirms the validity of your suspicion that cPanel overrides certain settings, and may even be hard coded in ways that aren't immediately transparent...
Related
I've been building my first site using Rails, and I want to get it live. Up to now I've only ever put a site live by just dropping all the files onto my VPS via FTP, and I know that's not how it works with a Rails app.
What I don't know is where to even begin with making sure Rails is installed on my VPS (it's Linux based, I bought a package from Webfusion), and then how to deploy it and get it all running properly. My VPS has Plesk 10 installed on it, and from what I've read I need to install Rails alongside Plesk? I may have the wrong end of the stick, so don't hold back if I'm saying stupid things.
I realise this is a really green question to ask, but I've scoured forums looking for a solution I can understand and come up with nothing, so hoping someone here can help.
Thanks in advance!
I've never used a control panel like Plesk but I do have a VPS at linode.com. To get my rails sites up and running I got help from a smashingmagazine blog post and pro railscast episode. The railscast episode is not free but it has great info.
There are a lot of details with each step of getting a rails web server running on a VPS so please look at the blog or railscast video. But a high level overview of the steps is:
install rvm
install ruby and ruby gems
install rails
install a rails web server (a common option is passenger and nginx)
install a database (postgres is a common option)
capistrano for deployment
I wrote an ebook an this topic. After explaining how to set up a server from scratch it focuses on how to deploy an application manually, helping you to understand how this process works under the hood (I left automation out intentionally).
It covers a nginx/Unicorn/MySQL/rbenv setup. If you think that's something for you, you can get it here (it's free for people on my mailing list).
I've been spending the last few months on developing a (my first) Rails application all by my self, just me and my Linux box, all in my development RAILS_ENV, no SCM ("for shame!") or anything. It has become quite the beast now and I am getting ready to release it onto the world. My question is: how am I ever going to make this work?
I installed gems, plugins, servers (MySQL, node.js, nginx, sphinx, juggernaut), photo compression apps that I call, video compression tools (FFMPEG) etc, I also obviously have a DB and a (lot of) seed data. I can't even remember all the things I did to my system to make it all work, but it does.
So now, when I deploy this on some stranger's server, how do I make sure that all those things get installed and configured correctly? How is e.g. FFMPEG ever going to get installed on this server when I deploy my application. How will the seed data get uploaded, how will the servers get started, with the right parameters etc.
I have read (a little bit) about Capistrano which seems to be the deployment tool of choice in the Rails community, but I am not sure if that will cover all my needs. For example, how do I figure out all the gems I used or the plugins (do I even need to know?). Is there any way I can test the deployment on my own linux box,the same I am developing on, i.e. pretend that I am hosting my own production server/rails_env and "deploy" it there?
Any help will be much appreciated.
Cheers.
There a lot of standards to follow that make life easier...
As far as figuring out which gems you need, you could try and use RVM and make a local config that you keep adding gems to until your app works. This will be kind of like starting from scratch so that you are sure to know precisely what configuration you need to run. (And it should make it easy to stand up a new, identical environment each time.)
The RVM route will allow you to test in a specific environment, which should help.
You can list the required gems in your environment.rb file so that the server demands them on start-up.
Good Luck, Cowboy .
I just look up at rails sources and find folder named "dispatches". There is four file in it. I want to know purpose of this files. I know I use this files on my production server, but I never used to think of their purpose. I know there is something about attaching Rails app to Apache server. On my production server rails appname command add this files to public folder automatically. Can I set up this behavior on my development machine?
The rails dispatcher is the entry point for a rails application and is used to bootstrap the environment.
They have a long history and in a lot of ways they are almost obsolete. In days gone by rails apps used to be powered using cgi or fastcgi, which was a way for the webserver to communicate with a rails process. The boot process would be initiated by dispatch.fcgi or dispatch.cgi. Nowadays people are more likely to use apache/nginx+passenger or apache/nginx+mongrel/thin. (Does anyone still use lighttpd?)
I'm a little fuzzy on how dispatch.rb is used, but I think it's used by upstream rails servers such as mongrel/thin to bootstrap the rails process. However, now that rails is rack compatible I'm not entirely sure if that has changed.
You don't need to pay the dispatch.* files any attention.
I hope this helps.
I'm kind of lost, I try to deploy my application on a shared dreamhost server.
Now everything works fine locally. It's my first try at Rails, and I'm not really a programmer or sysadmin, just hacking something together.
On Dreamhost, if I start webrick, it works fine on port 3000, but webricks gets killed pretty quickly, I guess that makes sense.
So what do I have to do to make it run?
I enabled fastcgi support and mod_rails.
Now, how do I get the app constantly running?
I keep reading about having to do things to .htaccess and to dispatch.fcgi.
But I can't find any dispatch file in my rails app (2.3.2).
Do I have to create that one manually? Doesn't really feeld very rails-like to me. I didn't really manage to find out what this dispatch file does, and why it's needed.
Any help would be greatly appreciated.
I looked at the DH Wiki, but couldn't figure it out (http://wiki.dreamhost.com/Rails)
Additions:
I enabled mod_rails and pointed to the public directory (I had already done that).
I keep getting an error: screencast.com/t/KamqVawk
Hm, server logs look like there is actually no request, so this might be a problem on dreamhosts end. It's strange I see that the access.log show a new change date, when I try to access the page, but there is no request noted, error.log is empty too.
Dreamhost Support Answer:
The server was up to date, so that wasn't the problem.
They proposed freezing the Gems, which I did (see: http://wiki.dreamhost.com/Freezing_Gems)
But it didn't help.
I guess I'm giving up, and looking into hosting which is specialized for rails.
Thx for all your help!
Changed to hostingrails.com
I got the app working on hostingrails.com, passenger on hostingrails.com showed me errors, which weren't shown by dreamhost or mongrel. By correcting these errors, I got the app working.
Dreamhost won't let you use webrick if you're using shared hosting. You can either use FastCGI or Passenger to host Rails on shared DH (mongrel is an option if you upgrade to DreamhostPS, but that's obviously more expensive).
For FastCGI, you will need a dispatch.fcgi file (older versions of Rails would generate one when you created a new Rails app, but that stopped around 2.2 if I remember correctly) as well as code in your .htaccess to send requests to the dispatcher. See the Dreamhost Ruby on Rails wiki page for details about setting up FastCGI.
The more preferable option is to set up your application to run on Phusion Passenger (aka mod_rails). It should be pretty simple through your Dreamhost panel, you just need to enable the domain to use mod_rails, and then set the directory for the domain to the public directory of your application. See the Passenger wiki page for more details.
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.