My favorites | Sign in
Project Logo
                
Search
for
Updated Feb 09, 2008 by subimage
Labels: Featured, Phase-Deploy
InstallingSubstruct  
How to install Substruct

Installing Substruct

Introduction

This software package is developed using the Engines plugin. To find out more about how to use engines in general, go to http://rails-engines.org

These directions assume you already have a working Rails hosting environment. This means...

  • A web server such as
    • Webrick (included with Rails)
    • Apache
    • Lighttpd
  • A rails app server
    • Mongrel
    • FastCGI
  • MySQL / PGSql
  • Ruby
  • Rails
  • Rubygems

These directions also assume you have some familiarity with developing Rails applications in general and a working knowledge of your file system.

Installation

0. Install the following gems...Substruct needs them to function properly.

gem install RedCloth
gem install fastercsv
gem install mime-types
gem install mini_magick
gem install ezcrypto

!! NOTE !! Be sure openssl is also installed. For Debian linux boxes this is not included in the default Ruby installer. If you are running on debian it's as easy as typing 'apt-get install libopenssl-ruby1.8'

1. Download & extract the latest release

All releases are stored as tar / gzipped files here: http://code.google.com/p/substruct/downloads/list

They are marked with version numbers. Grab the latest one and extract it.

For instance, if you were working with release 0.97, you'd type the following on OS X and Linux

tar -xzvf substruct_rel_0-97.tar.gz

If you'd rather use SVN to download the latest code click here.

2. Set up your databases and edit your database.yml file

You'll need to have a running MySQL or PGSql instance, and create the proper databases for use.

We recommend the following:

Edit your database.yml file to make sure that Rails can access your database properly. For more information on the database.yml file, visit this url: http://wiki.rubyonrails.org/rails/pages/database.yml

3. Initialize your database

Run this command from inside the substruct directory you extracted previously

rake substruct:db:bootstrap

Usage

Fire up your environment!

ruby script/server

Try to login to http://localhost:3000/admin as ''admin'' / ''admin''

Misc

If you're going to be doing credit card transactions you need a processor account. Check out how to get one.

Make sure you check out how to maintain Substruct via cron as well.


Comment by rogerpack2005, Feb 18, 2008

Note: after installing substruct you may want to go in to order_account.rb (model) and change the salt and/or password listed there, if you are concerned about security.

Comment by rogerpack2005, Mar 01, 2008

run rake db:create before rake substruct:db:bootstrap to create it (if desired)

Comment by edmundo.vn, Mar 05, 2008

The mini_magick gem is only a wrapper to the ImageMagick? command line tools. The lack of these tools makes the images not being resized and just a discrete error message is issued in the logs/shell.

Comment by frantz.pierret, Mar 17, 2008

Hi I have a strange error message when I try to fire up :

Macintosh:substruct_rel_0-97 frantz$ ruby script/server
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
[SUBSTRUCT WARNING]
Mail server settings have not been initialized.
Check to make sure they've been set in the admin panel.
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready.  TERM => stop.  USR2 => restart.  INT => stop (no restart).
** Rails signals registered.  HUP => reload (without restart).  It might not work well.
** Mongrel 1.1.4 available at 0.0.0.0:3000
** Use CTRL-C to stop.
Attempting to copy plugin assets from '/Site2008/substruct_rel_0-97/vendor/plugins/substruct/assets' to '/Site2008/substruct_rel_0-97/public/plugin_assets'
  SQL (0.000252)   SET NAMES 'utf8'
  SQL (0.000094)   SET SQL_AUTO_IS_NULL=0
  Preference Columns (0.000000)   Mysql::Error: Can't create/write to file '/var/folders/Da/DaPsc8XvEceUa+-y736wi++++TI/-Tmp-/#sql_834a_0.MYI' (Errcode: 13): SHOW FIELDS FROM `preferences`

What did I done wrong ?

Comment by rogerpack2005, Mar 18, 2008

see http://groups.google.com/group/substruct/browse_thread/thread/b30511a0ca11d31e if you'd like to be able to edit files within /vendor/plugins/substruct and, in developer mode, have it automatically reload classes that change.

Comment by rogerpack2005, Mar 18, 2008

With regard to the mysql error, I'd say recreate your database from scratch, and try and run 'select from preferences' within a mysql command line to make sure it's working. Maybe myql is being run as a lesser privileged user?

Comment by nigel.pepper, Mar 25, 2008

Getting setup i've had some trouble with the initial substruct:db:bootstrap. A number of the column index names clashed. Easily fixed by renaming but rather tedious nontheless. Is this a known issue with rake 0.8.1, rails 2.0.2?

Regards, Nigel Pepper

Comment by jjbl...@abtinc.net, Apr 01, 2008

I know this may seem like a simple question but where is the best place to unpack the tarball? Inside a rails_app directory already set up using rails or by itself? What is the directory structure to look like. Is vendor overlaid in the existing rails_app structure (in instantrails) or in its own standalone directory? A bit confused on this point of installation.

Comment by hasmukhrathod, Apr 07, 2008

The rake substruct:db:bootstrap is breaking up on my Debian system and seems to give a strange error. I am pasting the command line output here, what could have happened??

Checking requirements... Initializing database... rake aborted! wrong number of arguments (1 for 0)

(See full trace by running task with --trace)

Trace Run shows the following:

rake aborted! wrong number of arguments (1 for 0) /home/safew/Desktop/saurabh/substruct_rel_1-0-a2/vendor/plugins/substruct/tasks/substruct.rake:94:in `execute' /home/safew/Desktop/saurabh/substruct_rel_1-0-a2/vendor/plugins/substruct/tasks/substruct.rake:94 /home/safew/Desktop/saurabh/substruct_rel_1-0-a2/vendor/plugins/substruct/tasks/substruct.rake:89:in `each' /home/safew/Desktop/saurabh/substruct_rel_1-0-a2/vendor/plugins/substruct/tasks/substruct.rake:89 /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `call' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `execute' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `each' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `execute' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:362:in `invoke' /usr/lib/ruby/1.8/thread.rb:135:in `synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in `invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in `top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in `each' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in `top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in `standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1733:in `top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1711:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in `standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1708:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/bin/rake:7 /usr/bin/rake:16:in `load' /usr/bin/rake:16 localhost:/home/safew/Desktop/saurabh/substruct_rel_1-0-a2/vendor/plugin

Comment by rogerpack2005, Apr 23, 2008

sudo gem update rake to hasmukhathod

Comment by geoffgolder, May 03, 2008

when running the

rake substruct:db:bootstrap

i get the following error:

(in /home/eof/sources/substruct_rel_1-0-a3) Checking requirements... Initializing database... WARNING? Mail server settings have not been initialized. Check to make sure they've been set in the admin panel. rake aborted! Access denied for user 'root'@'localhost' (using password: NO)

(See full trace by running task with --trace)

i fixed this by removing the password for mysql root. but for the life of me could not figure out how to just supply the password

Comment by jjeffus, May 05, 2008

Install works great (Ubuntu Server 7.10). I installed it using fcgid under Apache2. Is there any way to use a different DocumentRoot??? Say, for example, /catalog/. I got it working under /catalog/ only I had to change vendor/plugins/substruct/assets/stylesheets/.css with a:

perl -pi.bak -e 's!url\(/!url(https://mysite.com/catalog/!g' admin.css \ accounts.css
perl -pi.bak -e 's!url\(/!url(http://mysite.com/catalog/!g' main.css

This then fixes the display problems but all is not well with substruct. When I navigate to http://mysite.com/catalog/admin/ I can login but some links do not respect the new document root. Namely, the Orders button at the top of the admin menu. It tries to go to https://mysite.com/admin/orders. Also, changing the password of a user fails with:

Completed in 0.03238 (30 reqs/sec) | Rendering: 0.01832 (56%) | DB: 0.00000 (0%) | 200 OK https://mysite.com/catalog/admin/users/edit/1 /!\ FAILSAFE /!\ Mon May 05 08:42:49 -0700 2008

    Status: 500 Internal Server Error undefined method `[]' for nil:NilClass? 

/home/user/substruct/vendor/rails/actionpack/lib/action_controller/request.rb:461:in `clean_up_ajax_request_body!' /home/user/substruct/vendor/rails/actionpack/lib/action_controller/request.rb:380:in `parse_formatted_request_parameters' /home/user/substruct/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:78:in `request_parameters' /home/user/substruct/vendor/rails/actionpack/lib/action_controller/request.rb:287:in `parameters' /home/user/substruct/vendor/rails/actionpack/lib/action_controller/request.rb:22:in `request_method' /home/user/substruct/vendor/rails/actionpack/lib/action_controller/request.rb:35:in `method' /home/user/substruct/vendor/rails/actionpack/lib/action_controller/routing.rb:1483:in `extract_request_environment' /home/user/substruct/vendor/rails/actionpack/lib/action_controller/routing.rb:1424:in `recognize' /home/user/substruct/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:170:in `handle_request' /home/user/substruct/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:115:in `dispatch' /home/user/substruct/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi' /home/user/substruct/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:9:in `dispatch' /home/user/substruct/vendor/rails/railties/lib/fcgi_handler.rb:101:in `process_request' /home/user/substruct/vendor/rails/railties/lib/fcgi_handler.rb:149:in `with_signal_handler' /home/user/substruct/vendor/rails/railties/lib/fcgi_handler.rb:99:in `process_request' /home/user/substruct/vendor/rails/railties/lib/fcgi_handler.rb:77:in `process_each_request'

    /usr/lib/ruby/1.8/fcgi.rb:612:in `each_cgi' /usr/lib/ruby/1.8/fcgi.rb:609:in `each' /usr/lib/ruby/1.8/fcgi.rb:609:in `each_cgi' 

/home/user/substruct/vendor/rails/railties/lib/fcgi_handler.rb:76:in `process_each_request' /home/user/substruct/vendor/rails/railties/lib/fcgi_handler.rb:50:in `process!' /home/user/substruct/vendor/rails/railties/lib/fcgi_handler.rb:24:in `process!' /home/user/substruct/public/dispatch.fcgi:24 /!\ FAILSAFE /!\ Mon May 05 08:46:17 -0700 2008

Oddly enough, adding a user does not fail. I tried to fix the DocumentRoot?? problem with a rewrite rule like so:

   RewriteCond %{HTTP_REFERER} !^$
   RewriteCond %{HTTP_REFERER} ^.*/catalog/(.*)$ [NC]
   RewriteRule ^(.*)/(.*) $1/catalog/$2 [F]

But this gives a 403 Forbidden with no message in the error log or the Rails log!

I wanted to emphasize that everything works great when run through WEBrick. I would put substruct in / on the server, except my SSL cert is for the main domain and I have Radiance installed under fcgid in the DocumentRoot?? of the main server.

What am I doing wrong? Is this not possible to setup under fcgid?

Comment by jjeffus, May 05, 2008

Got it! I RTFM'ed the mod_rewrite docs and wrote this, which fixes all problems including the nil:NilClass? exception when changing user passwords:

   RewriteEngine On

   RewriteCond %{REQUEST_URI} !^/catalog.*$ [NC]
   RewriteCond %{HTTP_REFERER} !^$
   RewriteCond %{HTTP_REFERER} ^.*/catalog/.*$ [NC]
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ /catalog/dispatch.fcgi [QSA,L]

   RewriteCond %{REQUEST_URI} !^/catalog.*$ [NC]
   RewriteCond %{HTTP_REFERER} !^$
   RewriteCond %{HTTP_REFERER} ^.*/catalog/.*$ [NC]
   RewriteRule ^(.*)$ /catalog/$1 [QSA,L]

   RewriteCond %{REQUEST_URI} !^/catalog.*$ [NC]
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

   RewriteCond %{REQUEST_URI} ^/catalog.*$ [NC]
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ /catalog/dispatch.fcgi [QSA,L]

This allows a RoR app on / and Substruct at /catalog under fcgid or fastcgi. In this case I've got Radiance installed in / and it works great!

Comment by rogerpack2005, May 23, 2008

Note you'll also want to install imagemagick convert command? along with mini_magick well be listed as a pre-requisite?.

Comment by patrickberkeley, Jul 07, 2008

@jagdeepkh: I believe you need to have your secure certificate in place before you'll be able to access the admin section in production mode.

Comment by nguyendinhhai, Jul 30, 2008

Hi patrickberkeley,

I have the same problem with jagdeepkh, can you help to explain more on your solution?

Regards, Dinh Hai.

Comment by jawjaw, Aug 08, 2008

Nguyendinhhai/Jagdeepkh -- I'm also running into the same problem in production. I've got an SSL cert in place, but I still can't access those parts of the store (Admin, Wishlist, Login, etc).

Is there a setting somewhere that needs to be changed? It works fine in development, but my production enviornment on the server can't seem to find the resource, with http:// or https://

Any info will help

Comment by nguyendinhhai, Aug 09, 2008

my method:

modify: vendor/plugins/substruct/lib/substruct.rb set: self.override_ssl_production_mode = false

Comment by harryche888, Aug 18, 2008

If you get error like: no such file to load: tmail/version

then you will need to install TMail:

gem install tmail

Comment by adnanbinwaheed, Sep 05, 2008

can this thing work with sqlite? i tried to use sqlite3 but got some error about some index being created which already existed. Is there some code/sql which cant be executed on sqlite?

Comment by james.throgmorton, Sep 19, 2008

rake aborted! no such file to load -- /mnt/srv/webapps/rails/substruct6/config/../lib/mephisto/plugin

I am getting an error for Mephisto when I try to run substruct.

--does this make any sense to anyone?

I am confused.

Comment by rogerpack2005, Sep 30, 2008
Comment by tekknikk, Oct 17, 2008

For NGINX users running in PRODUCTION mode. You need to add the following line:

proxy_set_header X-FORWARDED_PROTO https;

In your virtualhost config for the server listing on 443 within the "location /" block.

Otherwise you get an error like:

Filter chain halted as :ssl_required? rendered_or_redirected.

Comment by alfredfong, Oct 17, 2008

I suffer this problem when I use command rake substruct:db:bootstrap

rake aborted! can't activate activesupport (= 2.1.1, runtime), already activated activesupport -2.1.0 C:/rubydev/substruct_rel_1-0-a6/rakefile:10 (See full trace by running task with --trace)

Comment by rogerpack2005, Oct 17, 2008

please post your question to the substruct group. Thanks! make sure environment.rb has version 2.1.0, make sure you have that version in vendor/rails, and, if necessary gem uninstall version 2.1.1?

Comment by barnettech, Nov 13, 2008

none of the graphics show up. I followed the instructions.... It just looks like a rough unrefined html page without styling, or graphics. Any guesses as to the problem?

Comment by barnettech, Nov 13, 2008

is that just how it looks out of the box before installing your own templates?

Comment by barnettech, Nov 13, 2008

Are there quick instructions on making it look presentable? Based on the instructions here: http://code.google.com/p/substruct/wiki/Customizing it seems it wont look presentable without a lot of fiddling. Is this correct?

Comment by rogerpack2005, Nov 13, 2008

the graphics should show up look just like http://substruct.subimage.com/ ? -- make sure you're running it from the 'root' directory / shows the start page?. Feel free to post questions to the substruct group. redcloth you may have to try --version 3.0.4 Cheers. -=R

Comment by hughwaynemuirhead, Nov 28, 2008

hi, i want to import 20, 000 products, can i do this with substruct? , thanks

Comment by almigo10, Dec 03, 2008

Hi I'm getting that error the first time I start my server:

Attempting to copy plugin assets from 'C:/NetBeansProjects?/substructCrystal/vend or/plugins/substruct/assets' to 'C:/NetBeansProjects?/substructCrystal/public/plu gin_assets' WARNING: Couldn't create the public file structure for plugin 'substruct'; Error

follows:
Invalid argument - C:/NetBeansProjects?/substructCrystal/public/plugin_assets/sub struct/C: checking plugin 'engines' for 'application_helper' checking plugin 'active_merchant' for 'application_helper' checking plugin 'acts_as_tree' for 'application_helper' checking plugin 'ar_fixtures' for 'application_helper' checking plugin 'attachment_fu' for 'application_helper' checking plugin 'attachment_fu_fixtures' for 'application_helper' checking plugin 'substruct' for 'application_helper' ==> loading from plugin 'substruct' checking plugin 'will_paginate' for 'application_helper' (file not found in application) checking plugin 'engines' for 'substruct_application_controller' checking plugin 'active_merchant' for 'substruct_application_controller' checking plugin 'acts_as_tree' for 'substruct_application_controller' checking plugin 'ar_fixtures' for 'substruct_application_controller' checking plugin 'attachment_fu' for 'substruct_application_controller' checking plugin 'attachment_fu_fixtures' for 'substruct_application_controller' checking plugin 'substruct' for 'substruct_application_controller' ==> loading from plugin 'substruct' checking plugin 'will_paginate' for 'substruct_application_controller' (file not found in application) loading routes from C:/NetBeansProjects?/substructCrystal/vendor/plugins/substruc t/routes.rb
←[4;36;1mSQL (0.000000)←[0m ←[0;1mSET SQL_AUTO_IS_NULL=0←[0m ←[4;35;1mPreference Columns (0.015000)←[0m ←[0mSHOW FIELDS FROM `preferences
`←[0m
←[4;36;1mPreference Load (0.000000)←[0m ←[0;1mSELECT FROM preferences WH
ERE (preferences.name = 'use_smtp_tls_patch') LIMIT 1←[0m
←[4;35;1mPreference Load (0.000000)←[0m ←[0mSELECT FROM preferences WHER
E (preferences.name = 'mail_host') LIMIT 1←[0m
←[4;36;1mPreference Load (0.000000)←[0m ←[0;1mSELECT FROM preferences WH
ERE (preferences.name = 'mail_port') LIMIT 1←[0m
←[4;35;1mPreference Load (0.000000)←[0m ←[0mSELECT FROM preferences WHER
E (preferences.name = 'mail_auth_type') LIMIT 1←[0m

Could someone help please

Thanks

Comment by rogerpack2005, Dec 05, 2008

please see the group. Thanks! I'll let you off this time, though. See  issue 148 .

Comment by n...@diablocreative.co.uk, Feb 25, 2009

Am having real difficulty getting the database schema to create when running 'rake substruct:db:bootstrap', error ...

Mysql::Error: Specified key was too long; max key length is 767 bytes: CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations (version)

Am trying to create the index manually which perhaps will help, anyone got any better ideas?

Thanks

Richard.

Comment by tvsbpkumar, Feb 26, 2009

im having my rest-full rails application, i just put the substruct folder in vendor/plugins. now, my problem is to redirect the application when url is localhost:XXXX/admin, it is not working fine... any help..

i found out that the substruct is not rest-full....i hope...

Please guide me, if i am wrong....

Comment by fedefinki, Apr 03, 2009

hi, i just finished the installation and i get this error,

fede@fede-laptop:~/Desktop/principal/downloads/substruct$ ruby script/server => Booting lighttpd (use 'script/server webrick' to force WEBrick) => Rails 2.1.0 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server (see config/lighttpd.conf for options) Exiting Couldn't find any pid file in '/home/fede/Desktop/principal/downloads/substruct/tmp/pids' matching 'dispatch.0-9?.pid' (also looked for processes matching "/home/fede/Desktop/principal/downloads/substruct/public/dispatch.fcgi")

any ideas what im doing wrong? thanks.

Comment by rogerdpack, Apr 04, 2009

maybe try it with script/server webrick?

Comment by luigi.dollosa, Oct 10, 2009

hi there, i get this error when i run rake 'substruct:db:bootstrap'...

rake aborted! development database is not configured

what seems to be the problem here?


Sign in to add a comment
Hosted by Google Code