|
#176
|
|||
|
|||
|
Has anyone here had any success installing an app like "typo"? I keep getting an application error.
|
|
#177
|
|||
|
|||
|
Hi Everyone!
We've gone through a lot of changes since we initially rolled out our RoR support and the first tutorial for our customers was posted. For starters, we now support RoR via FastCGI. Additionally, we now support eruby on request, for for all of you who would like to design a ruby web application without the help of the rails framework, you can now request that this be enabled for your account. This is a small tutorial on setting up, configuring, and troubleshooting your rails application. Prerequisites are having jail-shell enabled on your account. If you do not have this enabled, you can contact us and it is free to enable this for your primary account. Before you begin: Check to see if the rails version on the server is adequate for your needs. You can do this by typing the following at the command line: Code:
user@host $ rails -v Rails 2.2.2 in your local command line (example is for rails 2.3.2): Code:
user@host $ rake rails:freeze:gems user@host $ rake rails:freeze:edge RELEASE=2.3.2 Code:
user@host $ rake rails:update:configs To create your own rails application, in stead of using "rails appname", we recommend that you use the following command string: Code:
user@host $ rails -d mysql --with-dispatchers railsapp Code:
user@host $ cd ~ AddHandler can be changed from : Code:
AddHandler fastcgi-script .fcgi Code:
AddHandler fcgid-script .fcgi Code:
RewriteRule ^(.*)$ dispatch.cgi [QSA,L] Code:
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] to exist without being called as a model, view, or controller: Code:
RewriteCond %{REQUEST_URI} ^/notrails.*
RewriteRule .* - [L]
Now you are ready to set up the public directory. To do this, assuming you want the public_html to be your rails application, you would erase public_html and run the following: Code:
user@host $ ln -s testapp/public ./public_html Code:
user@host $ ln -s testapp/public ./public_html/addondomain.com Configuration: Because we're using FastCGI, it will be a main instance of a FastCGI which runs your application. This means that you do not "start" and "stop" your application as you normally would. In stead, there is a constantly running process, which can create problems if the connection to the MySQL server is lost. To mitigate this, make the following change to testapp/config/database.yml: Code:
reconnect: true Code:
socket: /tmp/mysql.sock Code:
socket: /var/lib/mysql/mysql.sock config/environment.rb : Code:
ENV['RAILS_RELATIVE_URL_ROOT']="/rails" Logging: Typically the logs for a rails application are stored in log/development.log or the appropriate environment for your application. Sometimes though, this is not available. If this is the case, you will want to check your error log from your home directory. Troubleshooting: There are a couple of steps that you can take before filing a support ticket or contacting our live representatives to determine whether this is a problem with rails on the server, or a problem with code inside the application. We'd ask that users take these steps before submitting a support request if at all possible. Ruby provides a debugger and interpreter which you can write applications in on-the-fly. This also helps to determine if there is any issue with a specific line of code. The interpreter, which many of you are most likely familiar with, is called "irb". To access this, you can simply type: Code:
user@host $ irb Code:
user@host $ irb irb(main):001:0> require 'mysql' => true irb(main):002:0> Code:
user@host $ find -name \*.rb -exec ruby -c '{}' \;
Contacting support: If possible, please have the error logs in your original request for support regarding ruby on rails tickets. For example, if you are having an issue with the mysql gem, you could provide something along the lines of the following IRB output: Code:
irb(main):001:0> require 'mysql'
LoadError: /usr/lib/libmysqlclient.so.15: version `libmysqlclient_15' not found (required by /usr/lib/ruby/site_ruby/1.8/i386-linux/mysql.so) - /usr/lib/ruby/site_ruby/1.8/i386-linux/mysql.so
from /usr/lib/ruby/site_ruby/1.8/i386-linux/mysql.so
from (irb):1
Last edited by GatorJReynolds; 06-20-2009 at 11:59 PM. Reason: formatting |
|
#178
|
|||
|
|||
|
I recently struggled (but eventually succeeded) in getting a locally created app uploaded and running on a hostgator shared server. For a first-time ROR deployment it was pretty frustrating so I've written a summary for first timer's like me below. (Written: 20/7/09)
(if you're familiar with SSH skip this first section) SSH ACCESS You will have to have to request jailed SSH access on your Hostgator account by submiting a support ticket. You can then use SSH to execute commands (rake, script/generate etc) like you would locally. To log in to SSH run: Code:
ssh -p 2222 username@primarydomain.com Even though you have created your app locally, you want to create a new app in SSH (and let it create the folder hierarchy) and then replace all the controllers/views/models/db/config etc with your app. To create the new app in SSH: First navigate to a location where you want to create the new app folder – it doesn't matter where although cpanel likes to put them in ~/etc/rails_apps/. Run: Code:
rails -d mysql --with-dispatchers mynewapp If you're running Win, I've heard a lot of people rave about Filezilla, If you're on linux – I suggest avoiding gFTP (It kept crashing due to the ~100 folder hierarchy typical in a rails app), I used Krusader. Don't overwrite the files yet! Create another folder out of the way and upload it there for now. You have to be careful when overwriting the ssh created app that you don't accidentally wipe some necessary files. You can completely overwrite all files and folders EXCEPT the public folder. When dealing with the public folder, I suggest you overwrite the individual images, stylesheets and javascripts folders without touching the files already in /public/. Specifically: public/dispatch.rb , public/dispatch.cgi and public/dispatch.fcgi must all be present otherwise your app will not function. Once you've got your locally created app in place go on.. .HTACCESS To get the app running properly it is necessary to edit .htaccess. Navigate to ~/etc/rails_apps/mynewapp/public: Code:
cd /etc/rails_apps/mynewapp/public Code:
pico .htaccess Code:
AddHandler fcgid-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/notrails.*
RewriteRule .* - [L]
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
DATABASE SETUP In cpanel go to MySQL databases and create a new database: eg. New database: records Note that cpanel will automatically add username_ to the front of it, thus database name is: username_records You also need to create a user for this database: eg. Username: jsmith pw: ***** Note that cpanel will also append username_ to the front of each user toO, thus database user will be: username_jsmith Finally in cpanel Add user to database: username_jsmith to username_records. You can now use this database, username and password in database.yml DATABASE.YML in SSH or filemanager: Code:
cd /etc/rails_apps/mynewapp/config/
pico database.yml
Code:
development: pool: 5 timeout: 5000 adapter: mysql database: username_records username: username_jsmith password: ******* socket: /var/lib/mysql/mysql.sock # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: sqlite3 database: db/test.sqlite3 pool: 5 timeout: 5000 production: adapter: mysql username: username_jsmith password: ******* socket: /var/lib/mysql/mysql.sock pool: 5 timeout: 5000 reconnect: true socket: /var/lib/mysql/mysql.sock SYMLINK Currently we have the app loaded at /etc/rails_apps/mynewapp. However, pages that are visible on the web need to be in the /public_html/ directory. Because of the way rails separates public from models/views etc, we use a sym link to make the files from /mynewapp/public appear also in /public_html/. It will essentially seem like the one folder (public) has 2 different paths to it. A few variables: Do you want the app to be displayed at www.mydomain.com/ or www.mydomain.com/blog/? Do you have addon-domains or is this your only domain? CASE: Display at mydomain.com/ and YES I have addon domains If we want to display at mydomain.com/ we need to create a symlink to /public_html/. The issue is that you must delete public_html and then recreate it with the symlink. (can't symlink to an existing folder) As you probably know, addon domains are stored in /public_html/addondomain.com/. To ensure that you don't loose you addon domain data it is necessary to:
In SSH (at /home/username/) execute: Code:
ln -s ~/etc/rails_apps/mynewapp/public ~/public_html This is the hardest scenario, if you have no addon domains – obviously the same procedure applies without needing to backup anything. If you want the rails app to display on an addon domain: Code:
ln -s ~/etc/rails_apps/mynewapp/public ~/public_html/addondomain.com Code:
ln -s ~/etc/rails_apps/mynewapp/public ~/public_html/blog Code:
ENV['RAILS_RELATIVE_URL_ROOT']="/blog" ENVIRONMENT.RB At the top of the file I added: Code:
ENV['RAILS_ENV'] ||= 'production' Code:
config.load_paths += %W( #{RAILS_ROOT}/vendor/plugins )
You can also have problems if you are using gems in your app that hostgator hasn't got installed. You can view which gems are installed in cpanel RubyGems and also install gems through cpanel. I was unsuccessful at correctly pathing to them in my app – so instead send a support ticket and ask for which gems you would like installed on the server and Hostgator will do it in a few hrs. TROUBLESHOOTING Hopefully that's it and your app is now working. If you're not having any luck I reiterate: make sure you didn't overwrite anything important when uploading your local app. Specifically: public/dispatch.rb , public/dispatch.cgi and public/dispatch.fcgi must all be present otherwise your app will not function. (this caused me some headaches). Also you can sometimes ID errors by running “ruby script/console production” in SSH from your mynewapp dir. |
|
#179
|
||||
|
||||
|
Hello all,
As you know we have gone through changes for ROR apps on our servers. Here is the latest quick start instructions. 1. go to the dir in which you want to store the app 2. make app: rails --with-dispatch appname 3. go into the README and copy the section: Apache .htaccess example 4. put this in the .htaccess file in public 5. change in what you just pasted the following: AddHandler fastcgi-script .fcgi to AddHandler fcgid-script .fcgi And RewriteRule ^(.*)$ dispatch.cgi [QSA,L] to RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] 5.(a) just for ref you find out what to change the first one to from here: /usr/local/apache/conf/includes/pre_main_2.conf 6. make a symlink for app ln -s /path/to/public /home/username/public_html/link to have rails use mysql: 1. rails --with-dispatch -d mysql appfolder 2. create mysql database 3. set the username and password in database.yml if you need to install fcgi for rails: gem install fcgi -- --with-fcgi-dir=/opt/fastgcgi/ if you get a route error: in config/environment.rb put: ENV['RAILS_RELATIVE_URL_ROOT']="/link" kill the fcgi proccess: killall -9 dispatch.fcgi |
|
#180
|
|||
|
|||
|
Hi,
After following these steps I am not able to connect via web server. The database connection and the application seem okay. I can run "ruby script/console" and manually create and read database objects. However, when I post to the web server, I get a disconnect error on the client and a bunch of entries in fastcgi.crash.log, starting with: Dispatcher failed to catch: uninitialized constant Rack::Handler::FastCGI (NameError) Help? |
|
#181
|
|||
|
|||
|
To be more precise:
If I view "http://www.<username>.com/<appname>", I get the "Welcome Aboard" message I expect. However, if I create a model and controller, then try to view "http://www.<username>.com/<appname>/<modelname>" I get the error. It appears that somehow the dispatch is failing. I'm a newbie on the dispatch mechanism, so I'm having a hard time getting past this. Thank you. |
|
#182
|
|||
|
|||
|
The symlink doesn't want to work unless you submit a ticket..
ln -s /home/username/railsappdirectory/public /home/username/public_html always wants to create a public folder within it, so it looks like public_html/public. Is there a fix for this? |
|
#183
|
|||
|
|||
|
jhong,
If you use the command: ln -s /home/<username>/<railsappdirectory>/public /home/<username>/public_html/<railsappdirectory> you will get what you want. Equally easy is to: cd /home/<username>/public_html ln -s ../<railsappdirectory>/public <railsappdirectory> For example, if your app dir is named "helpermonkey", go to public_html and type: ln -s ../helpermonkey/public helpermonkey You can check this with the "ls -l" command which shows the value of a symlink. Regards, John |
|
#184
|
|||
|
|||
|
What about passenger?? Are you thinking about?? Are there some possibilities to have that support?
Why if i use the cpanel for setting up a new RoR application it don't set the --with-dispatch option?? Thanks, Luca |
|
#185
|
||||
|
||||
|
Luca, we're testing out a few servers with Passenger now. It looks promising, and I think we'll be able to include it in the near future with our hosting.
|
|
#186
|
|||
|
|||
|
Are any of the old posting about starting ROR still valid? I used the Manage Ruby on Rails Applications icon from cpanel (X3) and got the ROR intro page up right away on my main domain (i.e. www.mydomain.net). My problem now is when I started second ROR application using the same tool from cpanel, i.e. I want to run second ROR application using www.mydomain.net/secondApp. Here, I got Routing Error. The cpanel tool seems to create all the ROR folders and files (in /etc/ruby_applications/secondApp versus in /etc/ruby_applications/firstApp). The cpanel tool also provides a mean to "rewrite" which dircts port request to ROR app in addition to start and stop the applications. I am new with ROR and the share hosting in general. Have anyone use this cpanel tool to bring up ROR app? Can it be used to start second ROR app like it appears to be providing? Can anyone tell me how the routing in the share server is done in this case? Typically, there should be dispatch files (dispatch.cgi, dispatch.fcgi, or dispatch.rb) in the public folder of the ROR app folder. I did not see any of them even on the first ROR app which appear to be working. Thank you for your helps.
|
|
#187
|
|||
|
|||
|
John,
Did you ever get your problem resolved on your post dated 9/20/09 about getting error after you created controller and view? I just started on the ROR and have the hell of a time getting anything to run other than the Welcome page. I used combination of the cpanel (x3) ROR tool and followed some of the posts found here. I don't know what the cpanel tool does. After following the post here, I get the welcome page regardless of whether the ROR is running or not (as commanded by the cpanel tool). I created a simple controller and not able to get to it and stuck at Routing Error. If you fixed your problem, please share your data. Thank you. |
|
#188
|
|||
|
|||
|
Hi,
I am trying to deploy my application on this url. http://www.dowsumi.com/pmp/ But it shows the listing of public folder. One thing more i want to confirm, i have started the Mongrel from shell. and it shows the server is running on 3000 port. How can i access the site i have tried http://www.dowsumi.com:3000/ but its not working. I have spent 2 days but unfortunatly not configured. Please help, Thanks in advance |
|
#189
|
|||
|
|||
![]() Newbie Requesting Specific Guidance Re Symlink for Redirecting incoming all lower case URL to Mixed Case URL Hi, I'd like to have traffic coming to my site that is using http://adamah.org/treeoflife.lan.io/whatever... be redirected to http://adamah.org/TreeOfLife.lan.io/whatever... ["whatever..." means different URLs as requested by the incoming traffic.] As you can see, the incoming string is using all lower case lettering for the Added Domain "TreeOfLife.lan.io," which doesn't automatically work with HostGator's Linux based system. The Jazzery J. on the HostGator Staff has told me that a symlink could be used for that purpose and Michael S. and Stephen N. helped me get a php.ini into my root directory. [HostGator Ticket BFF-12615905] How exactly do I go about making the above work? Where do I go from here? - I'm a Newbie at this and I don't know if I can understand your lingo enough to make this work??? Tree of Life (c) Last edited by Tree of Life (c); 11-02-2009 at 01:31 AM. |
|
#190
|
|||
|
|||
|
navidurrahman,
Your site www.dowsumi.com/pmp shows the ROR Welcome aboard page. So, it seems to be working. You can tried create controllers and views for it and check it again. If you created the rewrite in .htaccess file in your project public folder and symlink from public_html to your project public folder, then it should works. I also had hard time getting started, but I found following JPorter's posting (7/2009) very helpful. I tried creating the ROR via cPanel (X3), but it only leads to more problem. I followed JPorter's posting and my ROR project is now working as expected. |
|
#191
|
|||
|
|||
|
Tree of Life,
I am also a newbie, but you can try this: from your shell window, go to your main domain public_html folder, then create a symlink to your subdomain public folder: ln -s ~/YourMixCaseDomainFolder/public ~/public_html/YourMixCaseDomain What this will do is creating a symbolic link between the symbol YourMixCaseDomain to the public folder of your YourMixCaseDomainFolder subdomain. So, when a request comes into your main site (public_html), it will find the symbolic link and sends request to your subdomain public folder. You can check the link by type: ls -la I hope this help a little...good luck. |
|
#192
|
|||
|
|||
|
I am having problem getting my APP up.
There are two alternative I can work here: 1. Is install the App through Cpanel, and having a Subdomain redirected to that App folder. However, it may show the "Welcome" page. I can not access any of my controllers. It also shows a broken "Welcome" Page: The RoR Icon is missing and I can only see the text. The 2nd one is that I am creating the App through SSH. There are two things that I believe I am suppose to do. 1. Create the app with a Dispatched, 2. Edit the .htaccess file to the right dispatched. My problem here is that the dispatched.cgi is not being created, how can I get my app to work? Please advise. Thank you. |
|
#193
|
|||
|
|||
![]() Quote:
Thank you Manna, I sure appreciate your response, but I don’t quite understand how to follow your instruction… If you could please expand on these words of yours: Quote:
2. What does “ln –s” mean? 3. What exactly is the difference in my case between “YourMixCaseDomainFolder” and “YourMixCaseDomain” ? As you can see I am very much of a Newbie… I appreciate any further help you’ll provide! ![]() Tree of Life © |
|
#194
|
||||
|
||||
|
Quote:
Quote:
Quote:
|
|
#195
|
|||
|
|||
|
I am about to lose my mind...
I have followed the more recent steps (posted since June of this year) and still can't get a RoR app running on my site. Here are the steps I have taken so far: 1.) Install rails app into ~/public_html/blueteamdev via SSH 2.) Edit .htaccess in blueteamdev/public to include the info found in this post: http://forums.hostgator.com/showpost...&postcount=178 3.) Created a symlink named "btd" that links to ~/public_html/blueteamdev/public 4.) Added the following to environment.rb: Code:
ENV['RAILS_ENV'] ||= 'production' ENV['RAILS_RELATIVE_URL_ROOT']="~/public_html/blueteamdev" I have also tried ENV['RAILS_RELATIVE_URL_ROOT']="~/public_html/blueteamdev/public" I have also tried ENV['RAILS_RELATIVE_URL_ROOT']="/btd" Go back to SSH and create a dummy controller/model/view via: script/generate scaffold test name:string number:integer Check the directory structure and sure enough, the controller, model, and view are created correctly and "map.resources :tests" is added to routes.rb So I go back to the web browser and try: www.mydomain.com/btd/tests and I get "No route matches "/btd/tests" with {:method=>:get}". I try www.mydomain.com/btd/tests/index and get the same thing. BUT, if I go to www.mydomain.com/blueteamdev/tests, I get a generic HostGator 404 screen. So where am I missing something? I haven't even tried to upload my locally developed app to the site, I can only imagine how many gremlins that will uncover. Any help to get a simple server-created app running!? (I am on gator361 if that helps in any way) |
|
#196
|
|||
|
|||
|
Quote:
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|