Skip to content
Enrico Stano edited this page Oct 29, 2017 · 15 revisions

This describes how to update ofn-install for a new OFN configuration.

Ansible is configured using YAML. If you're not familiar with YAML, read the Ansible docs about how it uses YAML. You can validate the syntax of your vars file with the Online YAML Parser.

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. Below is extra info on how to configure the variables.

  • checkout_zone: See the Spree User Guide for more.
  • country_code: See the list of 2-letter country codes
  • currency: See the list of currency codes
  • locale: See the list of locales supported by Spree.
  • language: Use the locale and add .UTF8. Locale should be formatted as en_GB.
  • language_packages:
  • l10n_repo: Create a l10n_xx localization project (see Seed data below)
  • timezone: Run bundle exec rake time:zones:all to find an appropriate timezone value.
  • developer_email: Used for the Let's Encrypt email settings (SSL certificate)
  • users_sysadmin: List of usernames of people that will have access to the server through SSH

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.

System administrators

To get access to the server, system administrators must add their SSH public keys as separated files in files/keys/username.pub. Add the usernames used for the name of the files to the users_sysadmin list in your instance's group_vars.

File storage and backups

S3 is recommended. See File storage for more information and how to setup S3. These settings should then be defined in the host secrets.yml file:

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

Note: Bucket names should be lowercase and dashes only.

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.

Next: Provisioning the server