Installing and configuring Turkopticon on BlueHost or HostMonster M. Six Silberman 26 Jul 2013 Turkopticon is a Rails 2.1.2 application. To set it up on BlueHost or HostMonster, do the following (details below). 1. Install Rails 2.1.2. 2. Create a new Rails application. 3. Configure the new Rails application to work on the server. 3.1. Create a new subdomain. 3.2. Remove the subdirectory of ~/public_html/ corresponding to the subdomain and replace it with a symbolic link to the public/ subdirectory of the Rails application. 3.3. Create a new MySQL database and user and grant the user appropriate privileges. 3.4. Edit config/database.yml to add the appropriate database and user details. 3.5. Add an appropriate .htaccess file to the public/ subdirectory of the Rails application. 3.6. Add GEM_HOME, GEM_PATH, and GEM_CACHE to the environment, and update PATH. 3.7. Remove public/index.html. 3.8. Add a simple controller, action, and route to test the application. 4. Install the annotate_models plugin (for convenience). 5. Install HAML. 6. Install ferret and acts_as_ferret. 7. Change line 1 of config/initializers/log.rb as appropriate. 8. Copy the codebase. 9. Edit config/database.yml again. 10. Edit config/environment.rb to include HAML. 11. Load the database. 12. Rebuild the index. 13. Restart the server and test the application. 14. Add cron jobs. 15. Configure and test email. 1. Install Rails 2.1.2. $ gem install rails --version=2.1.2 --verbose --no-rdoc --no-ri 2. Create a new Rails application. $ cd $ rails _2.1.2_ turkopticon 3. Configure the new Rails application to work on the server. 3.1. Create a new subdomain (e.g., via cPanel). 3.2. Remove the subdirectory of ~/public_html/ corresponding to the subdomain and replace it with a symbolic link to the public/ subdirectory of the Rails application. $ cd ~/public_html $ rm -rf turkopticon $ ln -s ../turkopticon/public turkopticon 3.3. Create a new MySQL database and user and grant the user appropriate privileges (e.g., via cPanel). 3.4. Edit config/database.yml to add the appropriate database and user details. For example: development: adapter: mysql database: turkopticon_devel host: localhost username: turkopticon_devel_user password: p00tp00t production: adapter: mysql database: turkopticon_prod host: localhost username: turkopticon_prod_user password: p00tp00tp00t 3.5. Add an appropriate .htaccess file to the public/ subdirectory of the Rails application. For example, for Passenger: Options -MultiViews PassengerResolveSymlinksInDocumentRoot on RailsEnv development RailsBaseURI / SetEnv GEM_HOME /home/user/ruby/gems or for FastCGI: AddHandler fcgid-script .fcgi Options +SymLinksIfOwnerMatch +ExecCGI RewriteEngine On RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] ErrorDocument 500 "

Application error

" 3.6. Add GEM_HOME, GEM_PATH, and GEM_CACHE to the environment, and update PATH, by adding to ~/.bashrc, if it is not already there: export HPATH=$HOME export GEM_HOME=$HPATH/ruby/gems export GEM_PATH=$GEM_HOME:/usr/lib64/ruby/gems/1.8 export GEM_CACHE=$GEM_HOME/cache export PATH=$PATH:$HPATH/ruby/gems/bin export PATH=$PATH:$HPATH/ruby/gems 3.7. Remove public/index.html. $ rm ~/turkopticon/public/index.html 3.8. Add a simple controller, action, and route to test the application. For example, replace ~/turkopticon/config/routes.rb with: ActionController::Routing::Routes.draw do |map| map.root :controller => "main", :action => "hello" map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' end and create ~/turkopticon/app/controllers/main_controller.rb with: class MainController < ApplicationController def hello render :text => "Hello Rails" end end You may need to restart the server with (for Passenger): $ touch ~/turkopticon/tmp/restart.txt If this simple application works, proceed to install Turkopticon. If not, there is something wrong with your configuration that should be addressed before proceeding. 4. Install annotate_models plugin. $ script/plugin install http://repo.pragprog.com/svn/Public/plugins/annotate_models 5. Install HAML. $ gem install haml --version=3.1.2 --no-rdoc --no-ri 6. Install ferret, acts_as_ferret, and mislav-will_paginate. These gems are included in the archive. $ gem install --local tmp/mislav-will_paginate-2.3.11.gem --no-rdoc --no-ri $ gem install --local ~/.gem/cache/ferret-0.11.6.gem --no-ri --no-rdoc $ gem install --local ~/.gem/cache/acts_as_ferret-0.4.4.gem --no-ri --no-rdoc 7. Change line 1 of config/initializers/log.rb as appropriate. It should refer to a file on your machine. 8. Copy the codebase. Specifically, the following subdirectories should be overwritten: app config db index lib public 9. Edit config/database.yml again. (It was overwritten.) 10. Edit config/environment.rb to include HAML. Add: config.gem "haml" within the block: Rails::Initializer.run do |config| # ... end 11. Load the database. $ mysql -u user -ppassword database < turkopticon-db-YYYY.MM.DD.HHMM.sql 12. Rebuild the index. $ rake ferret_index 13. Restart the server and test the application. 14. Add cron jobs. 15. Configure and test email.