Skip to content
David Cook edited this page Jul 15, 2024 · 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

Then, add your server group to the ofn_servers group.

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 information.
  • 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)
  • 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 system administrators that will have access to the server through SSH

Add host_vars

For your staging and production servers copy the _example.com 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

Rename secrets.example.yml to secrets.yml file in the same location and add your credentials to it. This file will be automatically excluded from git, don't lose it.

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.

Multilingual

To enable the multilingual functionality you will need to ensure you have the following line in your .env file, specifying the language files you want to include. This example will enable default English (which is Australian English) and French:

AVAILABLE_LOCALES=en,fr

You'll also need to ensure that the language files you are using contain a first line like:

language_name: "English" # Localised name of this language

This will indicate how the language option is displayed to the user. Best practice is to state the name of the language natively eg don't use 'French', use 'français'.

Next: Provisioning the server

Clone this wiki locally