You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Tom Bloor e495f744d9
Merge pull request #127 from Pear-Trading/master
3 years ago
.idea Hopefully fix speed issue on external data 3 years ago
doc Payroll sumission API improved and test added 5 years ago
etc/code-point-open Added codepoint open data to etc. dir with LICENCE file 5 years ago
images fixes 6 years ago
lib flash fixes on import 3 years ago
log Added log folder and gitignore config 6 years ago
public Word wrap feedback in admin console 5 years ago
script added new relations 4 years ago
share added ability to import sheets with extra data 3 years ago
t Possible fix for test failure 4 years ago
templates flash fixes on import 3 years ago
.gitignore Hopefully fix speed issue on external data 3 years ago
.travis.yml Update perl version in Travis CI 3 years ago
CHANGELOG.md Update changelog 3 years ago
README.md added search on supplier listings 3 years ago
cpanfile Hopefully fix speed issue on external data 3 years ago
make_leaderboards Fixed rank sending and added leaderboard creation script 6 years ago
pear-local_loop.conf Merge remote-tracking branch 'origin/TBSliver/Minion-Tasks' into finn/minionimport 4 years ago
pear-local_loop.development.conf Fix various bits for import 4 years ago
pear-local_loop.testing.conf Update config and tests so deployment and testing use separate databases. 6 years ago

README.md

Pear LocalLoop Server

Current Status

Master: Build Status

Development: Build Status

Testing

To run the main test framework, first install all the dependencies, then run the tests:

cpanm --installdeps .
prove -lr

To run the main framework against a PostgreSQL backend, assuming you have postgres installed, you will need some extra dependencies first:

cpanm --installdeps . --with-feature postgres
PEAR_TEST_PG=1 prove -lr

Minion

to set up minion support, you will need to create a database and user for minion to connect to. In production his should be a PostgreSQL database, however an SQLite db can be used in testing.

To use the SQLite version, run the following commands:

cpanm --installdeps --with-feature sqlite .

And then add the following to your configuration file:

  minion => {
    SQLite => 'sqlite:minion.db',
  },

This will then use an SQLite db for the minion backend, using minion.db as the database file. To start the minion itself, run:

./script/pear-local_loop minion worker

Importing Ward Data

To import ward data, get the ward data csv and then run the following command:

./script/pear-local_loop minion job \
  --enqueue 'csv_postcode_import' \
  --args '[ "/path/to/ward/csv" ]'

Setting up Entity Postcodes

Assuming you have imported codepoint open, then to properly assign all postcodes:

./script/pear-local_loop minion job \
  --enqueue entity_postcode_lookup

Example PostgreSQL setup

# Example commands - probably not the best ones
# TODO come back and improve these with proper ownership and DDL rights
sudo -u postgres createuser minion
sudo -u postgres createdb localloop_minion
sudo -u postgres psql
psql=# alter user minion with encrypted password 'abc123';
psql=# grant all privileges on database localloop_minion to minion;

Development

There are a couple of setup steps to getting a development environment ready. Use the corresponding instructions depending on what state your current setup is in.

First Time Setup

First, decide if you're using SQLite or PostgreSQL locally. Development supports both, however production uses PostgreSQL. For this example we will use SQLite. As the default config is set up for this, no configuration changes are needed initially. So, first off, install dependencies:

cpanm --installdeps . --with-feature=sqlite

Then install the database:

./script/deploy_db install -c 'dbi:SQLite:dbname=foodloop.db'

Then set up the development users:

./script/pear-local_loop dev_data --force

Note: do NOT run that script on production.

Then you can start the application:

morbo script/pear-local_loop -l http://*:3000

You can modify the host and port for listening as needed.

Old Docs

Local test database

To install a local DB:

./script/deploy_db install -c 'dbi:SQLite:dbname=foodloop.db'

To do an upgrade of it after making DB changes to commit:

./script/deploy_db write_ddl -c 'dbi:SQLite:dbname=foodloop.db'
./script/deploy_db upgrade -c 'dbi:SQLite:dbname=foodloop.db'

To redo leaderboards:

./script/pear-local_loop recalc_leaderboards

To serve a test version locally of the server:

morbo script/pear-local_loop