Installing crabgrass

How to install and run crabgrass on debian/ubuntu. This page is just a copy of the README included with the distribution.

Please Refer to labs.riseup.net/crabgrass/documentation for the latest

CRABGRASS

Crabgrass is a software libre web application designed for group and network
organizing, and tailored to the needs of the global justice movement. The long
term goal is to provide the technical tools to facilitate active, confederal,
and directly democratic social change networks.

Further reading:

  • for running the sphinx search daemon, see doc/SPHINX_README
  • for adminstration notes, see doc/ADMIN_README
  • for details about what the gems are used for, see doc/GEMS_README
  • for multilingual support, see doc/MULTILINGUAL_README
  • for plugin details, see vendor/plugins/README
  • for more information on crabgrass, visit we.riseup.net/crabgrass

INSTALL FOR DEVELOPMENT

prepare your environment

If you are running Debian Etch, you will need to pull some packages from backports.org. Please read the instructions on how to pull packages from Backports before continuing.

For more details, see docs/ASSETS_README.

Additional packages may be required for special features of crabgrass. See the
README files in the docs folder.

install gems

These gems are required:

gem install -y rails rmagick tzinfo RedCloth ruby-debug hpricot mime-types haml --no-ri --no-rdoc 

These gems are optional:
gem install mime-types ruby-debug hpricot nokogiri launchy chronic packet --no-ri --no-rdoc

See GEMS for a description of what these gems are used for.

grab the code

To get a copy of the most recent code:

git clone git://labs.riseup.net/crabgrass.git

Make sure your git-core is a version => 1.5.6.5
See labs.riseup.net/code for information on releases.

setup mysql database

Start Mysql Damean and check

sudo /opt/local/lib/mysql5/bin/mysqld_safe

You can check to see if its running "ps aux | grep mysql”

ps aux | grep mysql

create the databases:

mysqladmin -u root -p create crabgrass_development
mysql -u root -p -e 'GRANT ALL PRIVILEGES ON crabgrass_development.* TO crabgrassdevuser@localhost IDENTIFIED BY '"'1rdbp2Ucl8taZppPqcL8'"

(use only needed databases. obviously, choose a unique password on that last line)

When you are editing config/database.yml, set up the database name, user and password you just created as root in the “development” stanza.
codetitle. X.509 SHA1 fingerprint for code.autistici.org (prompted during svn step) should match:

 90:17:9C:87:C6:D3:63:E3:D5:C4:B7:2C:C3:00:2C:69:40:67:59:49

There is a sample database configuration file in the ‘config’ directory of the
crabgrass application. Use that to create a config/database.yml file. For some
linux distributions, you may need to specify a socket file for mysql like so:
“socket: /var/run/mysqld/mysqld.sock”. You can probably figure out what socket
to use by running “ps -ef | grep mysql”.

There is a sample database configuration file in the config directory of the crabgrass application. Use that to create a config/database.yml file:

  cd crabgrass/config
  cp database.yml.example database.yml

For development mode, the example database.yml should be good to go, unless you have a set a password for mysql.

install crabgrass

There are several required configuration files:

  • config/database.yml
  • config/sites.yml
  • config/email.yml
  • config/environments/production.rb

As a non-privileged user run in the crabgrass directory:

editor config/database.yml # and above the ther other config files accordingly
ln -s /usr/share/rails vendor/

Migrate Database
From inside crabgrass directory run these commands.
You might have to fix permission on this file crabgrass/log/development.log. run chmod 0666

export RAILS_ENV=production # just for development, of course
rake create_a_secret
rake db:schema:load # load the crabgrass schema
rake db:migrate # upgrade the crabgrass database after pulling in new code
rake db:fixtures:load
rake cg:load_default_data # populate it with test data

For some linux distributions, you may need to specify a socket file for mysql like so: socket: /var/run/mysqld/mysqld.sock. You can probably figure out what socket to use by running ps -ef | grep mysql.

Also, ‘rake —version’ must be 0.8.1 or greater.

To upgrade the crabgrass repository later:

  git pull
  rake db:migrate

run crabgrass

Start it Up

./script/server

This will run crabgrass in development mode, which is probably what you want. If
you don’t want to use webbrick (the mini-web-server that comes with rails) you
can install the mongrel gem or debian package. If installed, script/server will
pick them instead.

Goto Browser
localhost:3000
127.0.0.1:3000

If you have run ‘rake db:fixtures:load’, there will be a bunch of test data
loaded, including users. To get started, you can login as user ‘blue’ with
password ‘blue’.

testing

Run tests

rake db:test:prepare
rake test

A great deal of the crabgrass code is in the form of engines-enhanced
and crabgrass-specific plugins. See mods/README and tools/README for
more information. To run the tests for these special plugins:

rake test:tools rake test:mods

To run the test for a particular tool or mod:

rake test:tools TOOL=gallery_tool rake test:mods MOD=gibberize

You should now be able to connect to http://localhost:3000/, which will be your development instance.

I would not have been able to sort this all out without significant help from mlc and the existing documentation in the CG source. Thanks!

Things that are still needed

  • tzinfo is still being installed as a gem. can this be debianized? i haven’t found any indication that anyone is packaging it yet.
  • this doesn’t cover ferret
  • this doesn’t cover latex integration

INSTALL FOR PRODUCTION

If you are not running over https only, then you must comment out this line in
production.rb:

Crabgrass::Config.https_only = true

It is important that you specify your own secret in the sites.yml file.
You can use ‘rake secret’ to generate a secret value.

setup database

Create Databases

mysql5 -u root
create database crabgrass_test;
create database crabgrass_development;
flush privileges;

If your mysql root user has a password, don’t leave the password field blank. Alternately, you can create a crabgrass user in mysql.

For installing on a production server, most everything is the same
as a development setup except for these differences.

For development work, there is not much need to create a database user for
crabgrass. For deployment, however, this is a typical permissions setup:

Edit config/database.yml accordingly.

To create the production database is the same as for development, except
that we don’t want to load the test fixture data:

cd ~/development/crabgrass
rake db:schema:load RAILS_ENV=production
#rake cg:load_default_data RAILS_ENV=production # this should not be necessary

create your sites with
rake cg:site:create NAME=weltladen RAILS_ENV=production

Copy template database.yml:

cp config/database.yml.example config/database.yml

Edit database.yml so that it looks like this:
codetitle. database.yml

development:
  encoding: utf8
  adapter: mysql
  database: crabgrass_development
  username: root
  password: 
  host: localhost
  socket: /opt/local/var/run/mysql5/mysqld.sock

test:
  encoding: utf8
  adapter: mysql
  database: crabgrass_test
  username: root
  password: 
  host: localhost
  socket: /opt/local/var/run/mysql5/mysqld.sock

production:
  encoding: utf8
  adapter: mysql
  database: crabgrass
  username: root
  password: 
  host: localhost
  socket: /opt/local/var/run/mysql5/mysqld.sock

running background tasks

There are many tasks which crabgrass needs to run regularly in the background,
including cleaning out cache files and recreating the sphinx index.

These tasks will be run if you have backgroundrb running. You can configure the
frequency of these tasks by editing config/backgroundrb.yml.

First, install the backgroundrb requirements:

sudo gem install chronic packet --no-ri --no-rdoc

Start backgroundrb:
script/backgroundrb start

h2. running sphinx

Sphinx must be running when crabgrass is started for it to be used. If sphinx
searchd daemon is not detected, then crabgrass will not use fulltext searching.

First make sure that you have an up to date sphinx database:

rake ts:index RAILS_ENV=production

Then to start sphinx, run this:
rake ts:start RAILS_ENV=production

h2. other tips

You can run analysis on the logs using pl_analyze if the ‘SyslogLogger’
gem is installed.

There is an example capistrano deploy.rb in the config directory.

TROUBLESHOOTING

Troubleshooting
Mysql DB Problem: http://www.bluestatic.org/blog/2007/12/04/mysql-in-leopard/

If you get:

extconf.rb:11:in `require': no such file to load -- mkmf (LoadError)

…then you need also to install ruby1.8-dev.

ADMINISTRATION

Via the console

One goal in Crabgrass system design is to avoid creating different levels of
privilege for users. Shall this be an egalitarian social network, or shall we
build another anarchist bureaucracy? But what about when people need a new
password, etc?

Example: RESETING A PASSWORD

$ script/console production
>> u = User.find_for_forget("user's email")
>> u.password = u.password_confirmation = "new password"
>> u.save

h2. Via super_admin mod

There is a mod that is disabled by default that gives certain users
a super admin interface.

(1) Edit config/sites.yml to add which users should be super admins
(2) Edit config/mods_enabled.list to enable super_admin module
(3) Edit config/routes.rb and uncomment the super_admin routes
(4) restart rails, login, and browse to /admin

 

gem install mongrel

lets you output to the console when running lightppd

 
 

See also crabgrass-install-on-debian-lenny

 
 

i just installed it in ubuntu 7.04 (i hate those names)

– i compiled and installed imagemagick from the source, because the repository only had version 6.2.4 and minimal requirement is 6.3. i got it from here www.imagemagick.org/script/install-sour...
– in order to run rake i had to edit /etc/ld.so.conf to include a new line with /usr/local/lib, and run ldconfig afterwards.

then it ran smoothly!

 
 

i’m using hardy heron beta—still a little buggy, but at least my ati graphics card is working now.

 
 

apt-get gs-esp (The Ghostscript PostScript interpreter – ESP version) for pdf previews

 
 

on debian lenny it kicked an error when running gem install rmagick:

checking for Magick-config... no
Can't install RMagick 2.8.0. Can't find Magick-config in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin

*** extconf.rb failed ***

solution:

apt-get install libmagick9-dev
 
 

I still can’t get my lenny install to work. It kicks this error:

$ script/backgroundrb 
/var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/buffered_logger.rb:47:in `initialize': Permission denied - /usr/local/src/crabgrass/log/production.log (Errno::EACCES)
	from /var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/buffered_logger.rb:47:in `open'
	from /var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/buffered_logger.rb:47:in `initialize'
	from /usr/local/src/crabgrass/config/environments/production.rb:51:in `new'
	from /usr/local/src/crabgrass/config/environments/production.rb:51:in `load_environment'
	from /var/lib/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:300:in `load_environment'
	from /var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
	from /var/lib/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:293:in `load_environment'
	from /var/lib/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:117:in `process'
	from /var/lib/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:93:in `send'
	from /var/lib/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:93:in `run'
	from /usr/local/src/crabgrass/config/environment.rb:41
	from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
	from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
	from /var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
	from /var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
	from /var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
	from script/backgroundrb:25

Ideas?

 
 

if ubuntu is giving you an error about openssl, try this:

sudo apt-get install libopenssl-ruby

 
 

This is on lenny. I installed that package, same error. Then I ran script/backgroundrb as superuser. Now it kicks this error:

/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- haml (MissingSou        rceFile)
        from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
        from /var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
        from /var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in        '
        from /var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
        from /usr/local/src/crabgrass/vendor/plugins/haml/init.rb:4:in `evaluate_init_rb'
        from /var/lib/gems/1.8/gems/rails-2.1.0/lib/rails/plugin.rb:95:in `evaluate_init_rb'
        from /var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/kernel/reporting.rb:11:in `sile        nce_warnings'
        from /var/lib/gems/1.8/gems/rails-2.1.0/lib/rails/plugin.rb:91:in `evaluate_init_rb'
        from /var/lib/gems/1.8/gems/rails-2.1.0/lib/rails/plugin.rb:44:in `load'
        from /usr/local/src/crabgrass/config/../vendor/plugins/engines/lib/engines/plugin.rb:77:in `load'
        from /var/lib/gems/1.8/gems/rails-2.1.0/lib/rails/plugin/loader.rb:33:in `load_plugins'
        from /var/lib/gems/1.8/gems/rails-2.1.0/lib/rails/plugin/loader.rb:32:in `each'
        from /var/lib/gems/1.8/gems/rails-2.1.0/lib/rails/plugin/loader.rb:32:in `load_plugins'
        from /var/lib/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:283:in `load_plugins'
        from /var/lib/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:138:in `process'
        from /var/lib/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:93:in `send'
        from /var/lib/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:93:in `run'
        from /usr/local/src/crabgrass/config/environment.rb:41
        from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
        from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
        from /var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
        from /var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in        '
        from /var/lib/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
        from script/backgroundrb:25
 
 

the gem ‘haml’ is now reguired. i updated the README but forgot to update this wiki page.

 
   

For the rising stars and vigils for the new means of transportation, an element has been filed for the masterfully available paper. cookie clicker