Dry Run Setup


#1

Hey, I just came across this software yesterday. Im looking at running it for a local food gathering/coop.

So i spent the day yesterday wrestling with it and eventually got it running on a Digial Ocean server before finding these helpful pages.

Im going to go through a deployment run again today and highlight some issues you have that aren’t addressed in the wiki.

It is recommended that this install is run on Ubuntu Ubuntu 12.04 (64 bit). This seems to fail at numerous junctions:

From here: https://github.com/openfoodfoundation/ofn_deployment/wiki/Installation

Installation of Ansible fails as another command is need in Ubuntu 12 to allow the addition of the repository.

sudo apt-get install software-properties-common python-software-properties

After this you can add the repository, otherwise the Ansible commands fail.

Next from this page, its a dead end.

Trying this command:

ansible-playbook provision.yml

gives an error:

[WARNING]: provided hosts list is empty, only localhost is available

Next - setup a default user.

Im on a digital ocean server, there is no default user ubuntu.

Its says - You specify the user name and password user in your vars.yml file. There is no format for the password, I have tried using

user: ubuntu
password : password

Next I try running this:

ansible-playbook user.yml -i staging

and again get

[WARNING]: provided hosts list is empty, only localhost is available

So for a simple install, these scripts are missing something for the average user. Im not sure what it is, and I couldn’t figure it out. Any help would be appreciated.

At this point, I switched to using the commanda for ubuntu systems. I had similar problems with this setup but eventually got it working, I will go through these in another post.

I think this software is brilliant, and its not too hard to deploy. I would like to set it up for my country and co-op and I sure as more people hear about it they would probably like to do the same. The easier its made to do so, the more scope it will have.

Thanks for your help.


#2

Ok, Im now trying an install with the ubuntu commands from here:

or here:

The basic commands are:

git clone https://github.com/openfoodfoundation/openfoodnetwork.git
cd openfoodnetwork/
sudo apt-get install postgresql
sudo apt-get install postgresql-contrib
sudo apt-get install pgadmin3
sudo -u postgres psql postgres
postgres=# \password postgres
postgres=# \q

Now the next command fails:

sudo -u postgres createuser –superuser ofn_user

createuser: too many command-line arguments (first is “ofn_user”)
Try “createuser --help” for more information

So Im trying:

sudo -u postgres createuser

and it works:

Enter name of role to add: ofn_user
Shall the new role be a superuser? (y/n) y

Next we need to enter postgres again:

sudo -u postgres psql postgres

then

\password ofn_user

Set the password

then quit:

postgres=# \q

sudo -u postgres createdb ofn_db

then

bundle install

The program ‘bundle’ is currently not installed. You can install it by typing:
apt-get install ruby-bundler

this fails, so I try:

apt-get install ruby-bundler

This is installed but still fails:

bundle install
/usr/lib/ruby/vendor_ruby/bundler/rubygems_ext.rb:8:in require': no such file to load -- rubygems (LoadError)** ** from /usr/lib/ruby/vendor_ruby/bundler/rubygems_ext.rb:8** ** from /usr/lib/ruby/vendor_ruby/bundler.rb:11:inrequire’
** from /usr/lib/ruby/vendor_ruby/bundler.rb:11**
** from /usr/bin/bundle:4:in `require’**
** from /usr/bin/bundle:4**

So this install falls over here now too. not sure where to go next.


#3

Ok, to get pas this stage, we need ruby 2.1.5 on the server so the easiest way to get this Ive found is to install rvm (ruby version manager) and then install ruby 2.1.5 so its:

\curl -sSL https://get.rvm.io | bash

and then:

rvm install 2.1.5

after this the bundle install command should work.

It doesn’t, next error I get is:

An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that gem install pg -v '0.18.4' succeeds before bundling.

while bundler is running. Will post more later if I find a fix


#4

And on we go, the fix for this error is to install:

sudo apt-get install libpq-dev

trying the bundle install again…

and it works great. Next is:

sudo -u postgres createdb ofn_test
sudo -u postgres createdb ofn_dev
sudo -u postgres createdb ofn_prod
vim config/database.yml

Edit this as per the other page (put in user name and password set above

then

cp config/application.yml.example config/application.yml
rake db:schema:load db:seed
rake openfoodnetwork:dev:load_sample_data

and finally

rails server

Hopefully these error fixes can help others, Ill tighten up this post into something else soon.


#5

This is still failing, no with these errors:

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
Exiting
/usr/local/rvm/gems/ruby-2.1.5@openfoodnetwork/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_specification.rb:39:in resolve_string_connection': development database is not configured (ActiveRecord::AdapterNotSpecified) from /usr/local/rvm/gems/ruby-2.1.5@openfoodnetwork/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_specification.rb:25:inspec’
from /usr/local/rvm/gems/ruby-2.1.5@openfoodnetwork/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_specification.rb:130:in `establish_connection’

Not sure where to go from here.


#6

Hi @openfoodireland, good to have you here :slight_smile:

Am wondering whether @pmackay can help you out with this, he looks after the OFN UK local instance and may be able to offer some advice. Or perhaps @RohanM?

Dave, it’s probably also worth joining in on Slack, lots of conversation goes on there around deployment issues and the such through that channel. I sent through an invite on the email address you used for the OFN community profile.


#7

Thanks will join up. I have an instance running now, will post a details of the issues a (beginner) user might run into. Thanks for the help


#8

Hi @openfoodireland, could I ask a bit more about how you used ofn_deployment? Did you create a staging file with the info about your server in it?

Also on that provisioning wiki page it doesnt say to run ansible-playbook provision.yml, so am puzzled why you tried this?

Would really appreciate feedback on the ansible based install, because every country running OFN and doing all the manual steps you’ve documented doesnt scale very well at all.


#9

Hey pmackay, thanks for the help.

I was wanting to test the software, Im guessing the playbooks aren’t for this, they are for setting up a staging of live enviroment. Is this correct? So I’d need to purchase the domain first.

The manual setup works if you want to setup a testing enviroment but misses some of the things necessary to run it. Problems with the mailserver setup etc. as some of the supporting software isnt installed.

Trying to run the ansible-playbook provision.yml command was taken from here:

The playbooks take information from the vars.yml file. You must create your own copy of the file and edit it to put in information that is specific to your OFN installation.
Afterwards, you can use the following playbooks:

So I was just trying to get it to work. I assumed they migh run independantly.

So if I want to setup a testing server, i can’t do this with these playbooks, am I correct in this?

I had created a staging file with my servers IP in it, but as I said above, I havent purchased a domain yet so i was just putting in the IP like this:

# file: staging

[ofn_servers]
199.21.31.41 ansible_ssh_host=199.21.31.41


#10

Also, from here:

_Provisioning is the process of configuring a server with the software required to run Open Food Network. _

The provision.yml playbook installs packages such as curl and git, then installs:

rbenvRubyPostgresqlNginxUnicorn

How is this supposed to be run?


#11

Like a fool, I missed one simple instruction which has caused me all this grief:

You need Ansible on your computer to run the playbooks. You don’t need to install Ansible on your server.

Everything seems to be running much better now. Will report back on running my staging enviroment. Will go about setting up locales later today if this is successful.

Thanks for all the help OFN people.