How To Deploy on Bluehost

Source: Internet
Author: User
Tags ftp client cpanel ssh access
Document directory
  • 1. database. yml (in the config folder)
  • 2. environments. rb (in the config folder)
  • 3.. htaccess (in the public folder)
  • 4. dispatch. fcgi (in the config folder)

I 've noticed a lot of people asking about this one (probable because Bluehost is so cheap Its pretty similar to other others, but there are a few tricks.

SSH Access, and installing the gem

Because Bluehost doesn't allow shell access by default, you have to request it. See this article. You will need to have shell access to install the radiant gem and to runrakeTasks that will get your mysql database ready for action.

Once you have access, set up your bash profile so that it knows where gems go. Open up your root directory via ssh or ftp, and edit your.bashrcFile to look like this (you might want to make a backup copy just in case ):


# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

export PATH="$PATH:$HOME/packages/bin:$HOME/.gems/bin"
export GEM_HOME="$HOME/.gems"
export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8"
export GEM_CACHE="$GEM_HOME/cache"

Then, create a file in that same root directory called.gemrc, And give it the following contents, replacing [YOUR_USERNAME]... Your username (the one that is your domain name, or at least the first seven letters of it ).


gemhome: /home/[YOUR_USERNAME]/ruby/gems
gempath:
- /home/[YOUR_USERNAME]/ruby/gems
- /usr/lib/ruby/gems/1.8

Now you shoshould be ready to install the Radiant gem. Log in via SSH. (more on SSH + Bluehost) (if you are on a mac, just typessh yourusername@yourdomain.comInto terminal) Once logged in, you can typegem listTo see which gems are already installed, and make sure RubyGems is functioning properly. Then do:


% gem install radiant

This will install the gem on your account so that it can power your app once you put it on there.

Making your Radiant project

Since Bluehost has restrictions on what you can do with your ssh connection, it's easiest to create your Radiant project locally and then move the files over manually. if you don't have Radiant installed on your machine, install it with RubyGems by running the shell command % gem install radiant Or % sudo gem install radiant (Some linux machines restrict access to certain folders if you aren't the root user, andsudoTemporarily gives you that status.

Then create your app by doing:


$ radiant --database mysql WebsiteName

This will create a folder called WebsiteName (call it whatever you want) that contains all of the files for your app.

Edit the proper files within your app, then upload it1. database. yml (in the config folder)

Put your newly created database name, username, and password into database. yml for the Production database.

2. environments. rb (in the config folder)

Uncomment the lineENV['RAILS_ENV'] ||= 'production'

3.. htaccess (in the public folder)

Replace the first four lines with this code: (notice that it saysfcgid-script, Notfastcgi-scriptOrfcgi-script)


# General Apache options
AddHandler fcgid-script .fcgi
#AddHandler cgi-script .cgi
# Options +FollowSymLinks +ExecFCGI

(If you get the "Rails application failed .." when we get to that point, you can also try enabling this handler within cpanel under "Apache handlers .")

4. dispatch. fcgi (in the config folder)

Change the first line (shebang)#!/ramdisk/bin/ruby(Note: This is not what is listed in their help section for the path to Ruby. If you want to be sure you are using the right one, enterwhich rubyAt your SSH prompt.) then put the following before the require statements, replacing [user_name] With your account user name:


ENV['RAILS_ENV'] = 'production'
ENV["GEM_HOME"]= "/home/[USER_NAME]/ruby/gems"
ENV["GEM_PATH"]= "/home/[USER_NAME]/ruby/gems:/usr/lib/ruby/gems/1.8"

Use your FTP client to transfer the folder that contains your radiant app into your root directory on bluehost (not in public_html-we don't want people to see all of these files, especially database. yml ).

Create your MySql database

Go to the "MySQL Databases" tab in cpanel, and create a new database. then create a user and password (with all permissions), and assign it to that database. note that bluehost appends your username to these, so you will end up with username_database and username_user. in the past I was only able to access MySQL databases with my account username and password, but this appears to be fixed.

Run the rake task

With your SSH connection, navigate into the main directory of your app, and then run:


% rake production db:bootstrap

Follow the simple steps to create the first radiant user and it will deal with creating all of the database tables for you. you can choose to create an empty site or a blog (if you are new to radiant, looking at the default code for the blog is a great way to see how clever you can be with radius tags)

Create a symlink

In the same SSH window, while in your account's root directory, do


% ln -s ~/radiant_app_folder_name/public ~/public_html/website_name

This will place a folder in your public_html folder that will appear to contain what your app's "public" folder contains. you shoshould now be able to navigate to yourdomain.com/website_name and see your brand new Radiant install.

Note: If this doesn't work, let me know: nevin dot freeman at g_mail. it was a headache of trial and error for me, and I want this article to save time for future radiant users.

 

Original article: http://wiki.radiantcms.org/How_To_Deploy_on_Bluehost

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.