This platform was developed to be an open access resource, connecting indicator data about smallholder coffee farmers as part of a pilot stemming from a partnership between Heifer International, Lutheran World Relief, the Agroecology and Livelihoods Collaborative at the University of Vermont and Stats4SD.
https://coffeesmallholder.org/
This platform is built using Laravel/PHP. The front-end is written in VueJS and the admin panel uses Backpack for Laravel.
- Clone repo:
git@github.com:stats4sd/coffee_platform.git - Copy
.env.exampleas a new file and call it.env - Update variables in
.envfile to match your local environment:- Check APP_URL is correct
- Update DB_DATABASE (name of the local MySQL database to use), DB_USERNAME (local MySQL username) and DB_PASSWORD (local MySQL password)
- Create a local MySQL database with the same name used in the
.envfile - Run the following setup commands in the root project folder:
composer install
php artisan key:generate
php artisan backpack:install
php artisan telescope:publish
php artisan updatesql
npm install
npm run dev
cd scripts/Rscript && Rscript -e "renv::restore()"
- Migrate the database:
php aritsan migrate:fresh --seed(This might take a while! The seeder is not well optimised and it also automatically indexes all the IndicatorValues for Tntsearch...) or copy from the staging site
If you got "Cannot find module 'webpack-cli/package.json' error" when running command npm install,
it can be resolved by executing below commands:
- Install webpack-cli globally
npm install -g webpack-cli
- Install the latest versions of each dependancy
npm update
If you encounter errors when running the migration, that may indicate errors with the migrations, model factories or database seeder. If you encounter errors when running the renv::restore(), that may indicate an issue with renv in the RStudio project.
The platform is linked to translation.io to manage the translations. There are also custom commands that enable translation of Vue component strings and DB entries via the service. To sync to translation.io:
- Run the meta command
php artisan translation:all. This will do the following:- Run
php artisan translation:dbto search the database for translatable strings agethow get the back into the databasend add them to the set of strings that get sent to translation.io - Run
php artisan translation:vueto search the Vue components from strings and add them. - Run
php artisan translation:syncto sync the platform with the strings on the translation.io project - Run
php artisan translation:extract-jsonto extract the translated strings to a JSON file (Vue is setup to read translations from JSON)
- Run