2013-10-29 15:27:26 +01:00
|
|
|
Getting foodsoft running for development
|
|
|
|
========================================
|
|
|
|
|
|
|
|
Gratulations, if you read this file locally, 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.
|
|
|
|
|
|
|
|
**System requirements**:
|
2014-03-17 15:51:09 +01:00
|
|
|
[RVM](https://rvm.io/rvm/install) (recommended),
|
|
|
|
[Ruby 2.0](https://www.ruby-lang.org/en/downloads/) and
|
2013-10-29 15:27:26 +01:00
|
|
|
[Bundler](http://bundler.io/).
|
|
|
|
|
|
|
|
Getting started
|
|
|
|
---------------
|
|
|
|
|
|
|
|
0. Clone the repository from GitHub:
|
2014-06-01 00:46:43 +02:00
|
|
|
|
|
|
|
git clone https://github.com/foodcoops/foodsoft.git
|
|
|
|
|
2013-12-16 18:13:30 +01:00
|
|
|
This brings up the bleeding-edge development version, which might contain some
|
|
|
|
unfinished parts. If you want to be safe, choose the last release:
|
|
|
|
`git checkout $(git tag -l | grep ^v | sort -rn | head -n1)`
|
2013-10-29 15:27:26 +01:00
|
|
|
|
2014-05-31 14:20:45 +02:00
|
|
|
1. Install RVM and Ruby 2 (if you have not done so before):
|
2014-06-01 00:46:43 +02:00
|
|
|
|
|
|
|
\curl -L https://get.rvm.io | bash
|
|
|
|
source ~/.rvm/scripts/rvm
|
|
|
|
rvm install 2.0
|
2013-10-29 15:27:26 +01:00
|
|
|
|
2014-03-17 15:51:09 +01:00
|
|
|
We try to keep foodsoft compatible with Ruby 1.9.3 as well as any later versions,
|
2014-05-31 14:20:45 +02:00
|
|
|
so if you use this and don't want to use RVM, that might actually work.
|
2014-03-17 15:51:09 +01:00
|
|
|
|
2013-10-29 15:27:26 +01:00
|
|
|
2. Install Ruby dependencies:
|
2014-06-01 00:46:43 +02:00
|
|
|
|
|
|
|
bundle install
|
2013-10-29 15:27:26 +01:00
|
|
|
|
|
|
|
3. Setup your development environment:
|
2014-06-01 00:46:43 +02:00
|
|
|
|
|
|
|
rake foodsoft:setup_development
|
|
|
|
|
2013-10-29 15:27:26 +01:00
|
|
|
This will interactively prompt with several questions relating to your
|
|
|
|
required environment.
|
|
|
|
|
|
|
|
4. Start rails by running:
|
2014-06-01 00:46:43 +02:00
|
|
|
|
|
|
|
bundle exec rails s
|
2013-10-29 15:27:26 +01:00
|
|
|
|
|
|
|
5. Open your favorite browser and open the web application at:
|
2014-06-01 00:46:43 +02:00
|
|
|
|
|
|
|
http://localhost:3000/
|
|
|
|
|
2013-10-29 15:27:26 +01:00
|
|
|
You might want to watch a
|
|
|
|
[kitten video](https://www.youtube.com/watch?v=9Iq5yCoHp4o)
|
|
|
|
while it's loading.
|
|
|
|
|
|
|
|
6. Login using the default credentials: `admin/secret`
|
|
|
|
|
|
|
|
7. Change the admin password, just in case.
|
|
|
|
|
|
|
|
8. Have phun!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Manual configuration
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
The rake task `foodsoft:setup_development` helps you to setup foodsoft.
|
|
|
|
If you want to have more control, you can do these steps manually as
|
|
|
|
explained here.
|
|
|
|
|
|
|
|
|
2013-11-07 20:22:56 +01:00
|
|
|
1. **Configure database**
|
2013-10-29 15:27:26 +01:00
|
|
|
|
|
|
|
Create the database configuration from the default:
|
2014-06-01 00:46:43 +02:00
|
|
|
|
|
|
|
cp config/database.yml.SQLite_SAMPLE config/database.yml
|
|
|
|
|
2013-10-29 15:27:26 +01:00
|
|
|
If you are fine with using a file-based sqlite database you are all set.
|
2014-06-01 00:46:43 +02:00
|
|
|
The sqlite files (`development/test/production`) will reside in the `db`
|
2013-10-29 15:27:26 +01:00
|
|
|
directory. Otherwise you would want to copy one of the other
|
2014-06-01 00:46:43 +02:00
|
|
|
`database.yml.*_SAMPLE` files and edit `database.yml` to suit your needs.
|
2013-10-29 15:27:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
2. **Configure development environment**
|
|
|
|
|
|
|
|
Again, you need to create your own copy of the default configuration:
|
2014-06-01 00:46:43 +02:00
|
|
|
|
|
|
|
cp config/environments/development.rb.SAMPLE config/environments/development.rb
|
2013-10-29 15:27:26 +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.
|
|
|
|
|
|
|
|
|
|
|
|
3. **Foodsoft settings**
|
|
|
|
|
|
|
|
You need to create your own copy of the foodsoft configuration settings:
|
2014-06-01 00:46:43 +02:00
|
|
|
|
|
|
|
cp config/app_config.yml.SAMPLE config/app_config.yml
|
|
|
|
|
|
|
|
Edit `app_config.yml` to suit your needs or just keep the defaults for now.
|
2013-10-29 15:27:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
4. **Secret token**
|
|
|
|
|
|
|
|
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
|
2014-06-01 00:46:43 +02:00
|
|
|
|
|
|
|
cp config/initializers/secret_token.rb.SAMPLE config/initializers/secret_token.rb
|
|
|
|
|
2013-10-29 15:27:26 +01:00
|
|
|
and modify the token!! You can run `bundle exec rake secret`
|
|
|
|
|
|
|
|
|
|
|
|
5. **Create database (schema) and load defaults**
|
2014-06-01 00:46:43 +02:00
|
|
|
|
|
|
|
rake db:setup
|
|
|
|
|
2013-10-29 15:27:26 +01:00
|
|
|
With this, you also get a ready to go user with username 'admin' and
|
|
|
|
password 'secret'.
|
|
|
|
|
|
|
|
|
|
|
|
6. (optional) Get **background jobs** done
|
2014-06-01 00:46:43 +02:00
|
|
|
|
2014-05-31 14:20:45 +02:00
|
|
|
Time intensive tasks may block the web request. To run these in a separate
|
|
|
|
task, you can install Redis and enable Resque:
|
2014-06-01 00:46:43 +02:00
|
|
|
|
2014-05-31 14:20:45 +02:00
|
|
|
* Comment `Resque.inline = true` in `config/environments/development.rb`
|
|
|
|
* Install [Redis](http://redis.io/) (Ubuntu package `redis-server`)
|
|
|
|
* Run the worker: `rake resque:work QUEUE=foodsoft_notifier`
|
2014-06-01 00:46:43 +02:00
|
|
|
|
2014-05-31 14:20:45 +02:00
|
|
|
To have look on the current queue, failed jobs etc start the resque server with
|
|
|
|
`resque-web`.
|
2013-10-29 15:27:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
7. (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
|
2014-06-01 00:46:43 +02:00
|
|
|
|
|
|
|
mailcatcher
|
|
|
|
|
2013-10-29 15:27:26 +01:00
|
|
|
From now on you have a smtp server listening on 1025. To see the emails go to
|
2014-06-01 00:46:43 +02:00
|
|
|
|
|
|
|
http://localhost:1080
|
|
|
|
|