Skip to content
Paul Mackay edited this page May 30, 2016 · 20 revisions

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:

Setup an Ubuntu Precise 64 box

You will need to set up an instance of Ubuntu "Precise Pangolin" x64 server (a.k.a. an Ubuntu Precise 64 box), though this may work on other Debian based systems too. See current Server Specifications to get an idea of what you need.

The DigitalOcean Ubuntu precise 64 image is solidly tested, and Amazon Ubuntu precise 64 images have also worked.

If you are going through this process the first time, you probably want to test it on your local machine first. Jump to Using Vagrant to create a local virtual machine and run the provisioning on that. You will have a real installation of the Open Food Network app on that virtual machine and will be able to test everything first.

Define a new OFN instance configuration

Update the inventory

Edit the inventory/hosts file to add new production and staging servers, e.g.:

[au-prod]
www.openfoodnetwork.org.au

[au-staging]
staging1.openfoodnetwork.com.au

[au:children]
au-prod
au-staging

This is not needed for Vagrant.

Add group_vars

Copy and rename inventory/group_vars/_example.yml and add the configuration for your country.

Add host_vars

For your staging and production servers copy the _example directory and rename it to match the domain. Edit the config.yml file inside it, e.g.:

---

domain: www.openfoodnetwork.org.au
rails_env: production

Create a secrets.yml file in the same location. This is excluded from git.

Backups

The default is to use AWS S3. To do this, add this to your host_vars/<host>/secrets.yml file:

s3_backups_bucket: {{ app }}-{{ rails_env }}-backups

Commit changes

The ofn-install project stores all configuration for OFN instances. We recommend committing the config that can be public and creating a pull request to push it to the openfoodfoundation/ofn-install project.

Running Ansible playbooks

Add -vvvv for greater debug output.

Default user

Ansible needs at least one user created on the system so that it can run and install software as that user. An ofn-admin user account is now created at the start of the provisioning playbook.

Run the site install playbook

Run the provisioning and deploy plays with the site.yml playbook:

ansible-playbook -i inventory/hosts --limit=au-staging site.yml

Or on Vagrant:

ansible-playbook -i inventory/dev --e user=vagrant site.yml

This step can take a long time. And you might need to tweak your SSH configuration to prevent timeouts.

Next: Administration of your application server