Skip to content

OFN DevEnv Quick Start

Saimon Moore edited this page Jul 6, 2017 · 1 revision

OFN DevEnv

Quick start

This document will guide you through creating an lxc container which you start/stop to develop ofn, provision it with everything you need to develop ofn and provide you with easy commands to get up and running with ofn as quickly and as painlessly as possible.

Who is this document for?

Anyone, wishing to contribute to the Open Food Foundation project and is using linux and can run lxc on their host machine.

Step 1 - Checkout code and configure ansible

Checkout the following two repos in the same folder:

git clone [email protected]:coopdevs/ofn-install.git
git clone [email protected]:openfoodfoundation/openfoodnetwork.git

Copy ofn-install/inventory/host_vars/local.ofn.org/secrets.example.yml to ``ofn-admin/inventory/host_vars/local.ofn.org/secrets.yml`

# Keep this password as is (same as that in database.yml in openfoodnetwork app)!!
db_password: f00d
admin_password: f00d

# Secret Token
# This is required to verify session. It must be at least 30 characters and
# random.
# Generate one with a bash command like: openssl rand -hex 128
secret_token: 'xxxxxx'

Add your ssh key, so that you can run ansible:

cp ~/.ssh/id_rsa.pub ofn-install/files/keys/mykey.pub

and add yourself to the list of users here ofn-install/playbooks/development.yml:

- users_sysadmin:
  - mykey

Step 2 - Create lxc container

cd ofn-install
./scripts/create-container.sh

If this has worked correctly, you shouldn't have any trouble doing both of the following:

It should not require passwords, because your ssh key should already be copied to the container.

Step 3 - Provision lxc container

Ensure you have the lastest (>=2.3) ansible package installed:

sudo apt-add-repository ppa:ansible/ansible
sudo apt update
sudo apt install ansible

Then you can provision the lxc container:

./scripts/provisioning-dev.sh

Note: The first SUDO password it asks for is your host users password.