Find writable folder to restore files to (trash hack)
[pizzaboxroom.git] / INSTALL
blob7df2a9ce16af877b46fccd99c67bc6d56319a22f
1 Doxroom is a ruby on rails application (www.rubyonrails.org) that works under linux and probably other *nix (Mac, BSD). Users can access doxroom from any web browser, under windows too. If you run into installation problems, refer to rails documentation.
3 It has been tested with postgresql and mysql database, ships configured for sqlite3 to simplify installation and backup of small sites.
5 -- Quickstart: test installation under deb-based distros (debian, ubuntu, mepis, gnewsense...)
7 as root (or using sudo) do: 
9 # aptitude install ruby ruby1.8 ruby1.8-dev rake rubygems libsqlite3-0 libsqlite3-dev sqlite3 imagemagick xpdf
11 Two other dependencies are the usually already installed diff and zip.
13 # gem install -y rails
15 # gem install sqlite3-ruby 
16 rubygems will prompt:
17 Select which gem to install for your platform (****)
18  1. sqlite3-ruby 1.2.2 (mswin32)
19  2. sqlite3-ruby 1.2.2 (ruby)
20  3. sqlite3-ruby 1.2.1 (mswin32)
21  4. sqlite3-ruby 1.2.1 (ruby)
22  5. Skip this gem
23  6. Cancel installation
25 (select the higher numbered ruby version, in this example 2)
27 # gem install ferret 
28 (same as above)
30 Then, as an unprivileged user, enter the downloaded doxroom app folder, e.g.
32 $ cd doxroom
34 And prepare the database
36 $ rake globalize:setup
37 $ rake db:migrate
38 $ rake tmp:create
40 optionally edit config/environment.rb to to configure the app according to what helpers you have available and your taste.
42 Finally start the server
43 $ script/server start
44 and point your web browser to http://localhost:3000
48 Deployment notes.
50 If you deploy the app on a server whose version of rails you can't control, you can always "freeze" your rails app, that is copy the chosen version of rails framework into the app. First "comment out" the gem version in environment.rb, e.g.:
51   # RAILS_GEM_VERSION = '2.0.2' unless defined? RAILS_GEM_VERSION
52 then:
53   rake rails:freeze:edge TAG=rel_2-0-2
55 If mini magick has problems, there's a more popular but RAM-consuming option instead of minimagick: select rmagick, which must be installed together with imagemagick e.g. with .deb based distros:
57   sudo aptitude install librmagick-ruby
59 Ferret with acts as ferret is the search engine for doxroom models.
60 Ferret seems not actively developed anymore, and is said to be troublesome in production, other options are currently growing up. I have run into troubles only on shared hosts, reindexing might be needed: see rake --tasks and look for ferret ones. Remember to set the correct environment and be nice on shared hosting.
61 e.g. 
63 $ RAILS_ENV=production nice rake ferret:rebuild
64 $ RAILS_ENV=production nice rake ferret:reindex_myfiles
66 If a rails app is configured to run on multiple processes, ferret server (a separate process) ought to be used, for more info see acts as ferret doc, ferret server. Ferret should work without a server if ferret_server.yml is not found. Ferret server must be running when the app is configured for it, else a DRb::DRbConnError is thrown.  Remember to check permission for the server to write and read indexes or "errnoaccess" will be thrown. For example, I run it as www-data user along with the webserver.
67 Start Ferret server: rename config/ferret_server-disabled.yml to config/ferret_server.yml, cd into this application folder (REQUIRED or the script fails, also make sure the script is executable). Example, for development environment:
68   ./script/ferret_server -e development start
69 To disable ferret server, move the config file out of the way, e.g.
70   mv config/ferret_server.yml{,-disabled}
72 If you choose STATIC_DOWNLOAD= :http_rand, you have to remove the generated hard links so they can't be abused and don't clutter your filesystem. Put in crontab something like
73   5-55/6 * * * * /[full rails application path]/script/cleanup_dl_links
74 Make sure the script searches for the downloads directory configured in environment.rb and has write permission to it.
76 Install on debian derived distros with postgresql (this procedure is not yet tested):
77 # aptitude install postgresql-8.3 postgresql-server-dev-8.3
78 # gem install pg
79 then edit config/database.yml, e.g.
80  development:
81   adapter: postgresql
82   port: 5432
83   database: doxroom
84   host: localhost
85   username: (the db user)
86   password: (the db user pass)