Copied from old community site page created by GreenEcosystem 20 May 2015
Following steps will help to install this software and get it running on ubuntu Linux ( You can customise it by changing as per your server )
$ git clone https://github.com/openfoodfoundation/openfoodnetwork.git
Cloning into ‘openfoodnetwork’…
remote: Counting objects: 57388, done.
remote: Compressing objects: 100% (857/857), done.
remote: Total 57388 (delta 530), reused 0 (delta 0), pack-reused 56530
Receiving objects: 100% (57388/57388), 19.46 MiB | 235.00 KiB/s, done.
Resolving deltas: 100% (38262/38262), done.
Checking connectivity… done.
$ cd openfoodnetwork/
$ ls
app config.ru doc Gemfile.lock lib log public README.markdown spec vendor
config db Gemfile Guardfile LICENCE.txt Procfile Rakefile script test zeus.json
$ sudo apt-get install postgresql
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be upgraded:
postgresql
1 upgraded, 0 newly installed, 0 to remove and 983 not upgraded.
Need to get 5,038 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main postgresql all 9.3+154ubuntu1 [5,038 B]
Fetched 5,038 B in 0s (5,508 B/s)
(Reading database … 523780 files and directories currently installed.)
Preparing to unpack …/postgresql_9.3+154ubuntu1_all.deb …
Unpacking postgresql (9.3+154ubuntu1) over (9.3+154) …
Setting up postgresql (9.3+154ubuntu1) …
$ sudo apt-get install postgresql-contrib
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be upgraded:
postgresql-contrib
1 upgraded, 0 newly installed, 0 to remove and 982 not upgraded.
Need to get 5,058 B of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main postgresql-contrib all 9.3+154ubuntu1 [5,058 B]
Fetched 5,058 B in 0s (5,461 B/s)
(Reading database … 523780 files and directories currently installed.)
Preparing to unpack …/postgresql-contrib_9.3+154ubuntu1_all.deb …
Unpacking postgresql-contrib (9.3+154ubuntu1) over (9.3+154) …
Setting up postgresql-contrib (9.3+154ubuntu1) …
$ sudo apt-get install pgadmin3
pgadmin3 is already the newest version.
To start off, we need to change the PostgreSQL postgres user password; we will not be able to access the server otherwise. As the “postgres” Linux user, we will execute the psql command.
$ sudo -u postgres psql postgres
psql (9.3.4, server 9.1.11)
Type “help” for help.
postgres=#
Set a password for the “postgres” database role using the command:
postgres=# \password postgres
Enter new password:
Enter it again:
and give your password when prompted. ( we set password to “ofn”, you can use any ) The password text will be hidden from the console for security purposes.
Type Control+D to exit the posgreSQL prompt.
postgres=# \q
create yourself a database account (which is in this case also a database superuser) with the some name ( in our case its “ofn_user” is username, ou can replace with any name below ) and then create a password for the user:
$ sudo -u postgres createuser –superuser ofn_user
$ sudo -u postgres psql
psql (9.3.4, server 9.1.11)
Type “help” for help.
postgres=#
postgres=# \password ofn_user
Enter new password:
Enter it again:
( note: ou can user any password, in our case, we set to “ofn )
Type Control+D to exit the posgreSQL prompt.
postgres=# \q
use your new superuser privileges granted above to create a database ( in our base database name is set to ofn_db )
$ sudo -u postgres createdb ofn_db
$ bundle install
You may need to type “sudo” password during above install.
Create databases
$ sudo -u postgres createdb ofn_test
$ sudo -u postgres createdb ofn_dev
$ sudo -u postgres createdb ofn_prod
$ vim config/database.yml
Modify, database.yml as show below, ( matching to names you assigned )
======== database.yml ============
development:
adapter: postgresql
encoding: unicode
database: ofn_dev
pool: 5
host: localhost
username: ofn_user
password: ofn
test:
adapter: postgresql
encoding: unicode
database: ofn_test
pool: 5
host: localhost
username: ofn_user
password: ofn
#not used with heroku
production:
adapter: postgresql
encoding: unicode
database: ofn_db
pool: 5
username: ofn_user
password: ofn
staging:
adapter: postgresql
encoding: unicode
database: ofn_prod
pool: 5
username: ofn_user
password: ofn
==================================
$ cp config/application.yml.example config/application.yml
[ If you want to, you can change above file with Timezone ]
$ rake db:schema:load db:seed
Create the admin user (press enter for defaults).
Email [spree@example.com]: openagriculture@gmail.com
Password [spree123]:
[ Mote: In our case, password set to ofn123 , you can use anything more than 5 characters ]
Load some default data for your environment:
$ rake openfoodnetwork:dev:load_sample_data
[openfoodnetwork:dev:load_sample_data] Seeding shipping / payment information
[openfoodnetwork:dev:load_sample_data] Seeding taxonomies
[openfoodnetwork:dev:load_sample_data] Seeding addresses
[openfoodnetwork:dev:load_sample_data] Seeding enterprises
[openfoodnetwork:dev:load_sample_data] Seeding products
$ rails server
=> Booting Unicorn
=> Rails 3.2.21 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server