-
Notifications
You must be signed in to change notification settings - Fork 0
Deploy to HostGator
othersk46 edited this page Jan 20, 2014
·
3 revisions
This page needs wikifying!
- Copy tarball of desired Server Git repo to HostGator
- Unzip to
~/public_html/mtmserver
- Wrap entire contents of
server.rb
in a Ruby class definition:class MTM < Sinatra::Base
- Leave require statements out of class def, at beginning of file
- Bring require for routes to end of file, after end of wrapper class
- Wrap each route file in
class MTM
, monkey-patching class fromserver.rb
-
classify.sh
script at end of page will auto-patch route files. Do not leave inroutes/
folder.
-
- Use existing
server.cgi
to callserver.rb
. (Contents at end of page if needed.) - In
.htaccess
file:- Ensure
Options ExecCGI
is on - Add a CGI handler for .cgi and .rb files
- Use
mod_rewrite
with base/
to prependserver.cgi
to requests if not already present - Full contents at end of page if needed
- Ensure
#!/usr/bin/env ruby
require 'rubygems'
require 'rack'
require File.join(File::dirname(__FILE__), "server.rb")
Rack::Handler::CGI.run(MTM)
#!/usr/bin/env bash
ROUTEFILES="category condition image point problem trail user"
for route in $ROUTEFILES; do
sed '1i\
class MTM' ${route}_routes.rb > ${route}_routes.rb.half;
sed '$a\
end' ${route}_routes.rb.half > ${route}_routes.rb.new;
mv ${route}_routes.rb.new ${route}_routes.rb;
rm ${route}_routes.rb.half;
done
Options Indexes FollowSymLinks ExecCGI
AddHandler cgi-script .cgi .rb
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} mtm.linncountytrails.org
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} !^GET\s/server\.cgi/ [NC]
RewriteCond %{REQUEST_URI} !/server\.cgi/ [NC]
RewriteRule ^(.*)$ /server.cgi/$1 [L]