2009-01-06 11:49:19 +01:00
|
|
|
README for DEVELopment Project Setup
|
|
|
|
====================================
|
|
|
|
|
2009-01-26 23:30:42 +01:00
|
|
|
Gratulations, you have successfully cloned the foodsoft project
|
|
|
|
from the git repository. Now you are only a few steps away from
|
|
|
|
trying it out and then jumping into development. (This manual presumes
|
|
|
|
you have ruby and rails setup.)
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2009-01-26 23:30:42 +01:00
|
|
|
(1) Configure datebase
|
|
|
|
----------------------
|
|
|
|
Create the database configuration from the default:
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2009-01-26 23:30:42 +01:00
|
|
|
cp config/database.yml.SAMPLE config/database.yml
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2009-01-26 23:30:42 +01:00
|
|
|
If you are fine with using a file-based sqlite database you are all set.
|
|
|
|
The sqlite files (development/test/production) will reside in the "db" directory.
|
|
|
|
Otherwise you would want to edit database.yml to suit your needs (MySQL whatever).
|
2013-10-28 15:49:59 +01:00
|
|
|
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2009-01-26 23:30:42 +01:00
|
|
|
(2) Configure development environment
|
|
|
|
-------------------------------------
|
|
|
|
Again, you need to create your own copy of the default configuration:
|
2009-01-06 11:49:19 +01:00
|
|
|
|
|
|
|
cp config/environments/development.rb.SAMPLE config/environments/development.rb
|
|
|
|
|
2009-01-26 23:30:42 +01:00
|
|
|
Edit development.rb to specify your settings (at least the ActionMailer SMTP settings).
|
|
|
|
If you just leave the file as is, emails will not work but everything else should be okay.
|
2009-01-06 11:49:19 +01:00
|
|
|
|
|
|
|
|
2009-01-26 23:30:42 +01:00
|
|
|
(3) Foodsoft settings
|
|
|
|
---------------------
|
2009-01-06 11:49:19 +01:00
|
|
|
You need to create your own copy of the foodsoft configuration settings:
|
|
|
|
|
2009-01-20 15:59:06 +01:00
|
|
|
cp config/app_config.yml.SAMPLE config/app_config.yml
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2009-01-26 23:30:42 +01:00
|
|
|
Edit app_config.yml to suit your needs or just keep the defaults for now.
|
2009-01-06 11:49:19 +01:00
|
|
|
|
|
|
|
|
2012-08-24 15:20:33 +02:00
|
|
|
(4) Secret Token
|
2009-01-26 23:30:42 +01:00
|
|
|
-------------------
|
2012-08-24 15:20:33 +02:00
|
|
|
The user session are stored in cookies. Do avoid misusing the cookies and its sensitive information, rails
|
|
|
|
will encrypt it with a token. So copy the config file
|
|
|
|
|
|
|
|
cp config/initializers/secret_token.rb.SAMPLE config/initializers/secret_token.rb
|
|
|
|
|
|
|
|
and modify the token!!
|
|
|
|
|
|
|
|
|
|
|
|
(5) Required ruby and gems
|
|
|
|
-------------------
|
2013-05-25 15:44:01 +02:00
|
|
|
We recommend to use rvm (https://rvm.beginrescueend.com/). Install rvm and get the latest ruby (>= 1.9.3).
|
2011-05-06 20:38:39 +02:00
|
|
|
If installed you only need to install the gem bundler:
|
|
|
|
|
|
|
|
gem install bundler
|
2009-01-26 23:30:42 +01:00
|
|
|
|
2011-05-06 20:38:39 +02:00
|
|
|
After that you get the other gems easily with (from project root):
|
2009-01-26 23:30:42 +01:00
|
|
|
|
2011-05-06 20:38:39 +02:00
|
|
|
bundle install
|
2009-01-26 23:30:42 +01:00
|
|
|
|
2011-05-06 20:38:39 +02:00
|
|
|
|
2012-08-24 15:20:33 +02:00
|
|
|
(6) Create database (schema) and load defaults
|
2009-01-26 23:30:42 +01:00
|
|
|
--------------------------
|
2012-08-24 15:10:15 +02:00
|
|
|
rake db:setup
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2011-05-06 20:38:39 +02:00
|
|
|
With this, you also get a ready to go user with username 'admin' and password 'secret'.
|
2009-01-06 11:49:19 +01:00
|
|
|
|
|
|
|
|
2012-08-24 15:20:33 +02:00
|
|
|
(7) Try it out!
|
2013-10-28 15:49:59 +01:00
|
|
|
---------------
|
2009-01-06 11:49:19 +01:00
|
|
|
Start the WEBrick server to try it out:
|
2012-12-14 18:10:46 +01:00
|
|
|
|
2012-08-25 12:24:57 +02:00
|
|
|
bundle exec rails s
|
2012-08-24 15:10:15 +02:00
|
|
|
|
|
|
|
|
2012-08-24 15:20:33 +02:00
|
|
|
(8) (optional) Get background jobs done
|
2012-08-24 15:10:15 +02:00
|
|
|
---------------------------------------
|
2012-12-23 17:38:04 +01:00
|
|
|
We use for time intensive tasks a background job queue, at the moment resque with redis as key/value store.
|
|
|
|
Install redis (in ubuntu the package redis-server works out of the box) and start the resque worker with:
|
2012-08-24 15:10:15 +02:00
|
|
|
|
2012-12-23 17:38:04 +01:00
|
|
|
rake resque:work QUEUE=foodsoft_notifier
|
2012-08-24 15:10:15 +02:00
|
|
|
|
2012-12-23 17:38:04 +01:00
|
|
|
To have look on the current queue, failed jobs etc start the resque server with
|
2012-08-24 15:10:15 +02:00
|
|
|
|
2012-12-23 17:38:04 +01:00
|
|
|
resque-web
|
|
|
|
|
|
|
|
|
|
|
|
(9) (optional) View mails in browser instead in your logs
|
|
|
|
---------------------------------------------------------
|
|
|
|
We use mailcatcher in development mode to view all delivered mails in a browser interface.
|
|
|
|
Just install mailcatcher with gem install mailcatcher and start the service with
|
|
|
|
|
|
|
|
mailcatcher
|
|
|
|
|
|
|
|
From now on you have a smpt server listening on 1025. To see the emails go to
|
|
|
|
|
2013-10-28 15:49:59 +01:00
|
|
|
http://localhost:1080
|