This repository has been archived by the owner. It is now read-only.
No description, website, or topics provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
bin
scripts
src
tests
var
web
.editorconfig
.gitignore
.travis.yml
CONTRIBUTORS.md
LICENSE
README.md
codeception.yml
composer.json
composer.lock
phpunit.xml.dist

README.md

foodsharing-api

Build Status

This is a foodsharing API backend. It is meant to operate on the same database as the legacy foodsharing.de software, so to keep it simple, it must not modify the schema.

This software is build on symfony 3 with some bundles to simplify providing a json API.

Installing

Requirements

  • PHP (>=5.6, >=7.1 for development)
  • composer
  • MySQL
  • PDO MySQL module
  • PHP modules to satisfy symfony

Install

To install, just clone the repository and run composer install.

Database

This application is not able to run without having a properly initialized database. While the structure for a test setup can be build with bin/console doctrine:schema:update, the necessary data is not (yet) included and cannot be generated by the application itself (e.g. user registration). It should still be easy for you to manually create some users etc. A pull request with some test data is highly appreciated.

So far, running in parallel to the legacy foodsharing.de software is suggested. That is available including a development setup after requesting access to https://gitlab.com/foodsharing-dev. Configure the database access accordingly:

Option Value
User root
Passwort root
Host 127.0.0.1
Port 13306
Database foodsharing

Testing

There is codeception for testing in place. It uses a test database that has credentials in app/config/parameters.yml. You can define them as you wish for your local setup, an example configuration would be:

Option Value
User fstest
Passwort fstest
Host 127.0.0.1
Port 3306
Database foodsharing_test

Once you have defined the credentials you can create the test database and import the schema with:

./bin/console --env=test doctrine:database:create
./bin/console --env=test doctrine:schema:update --force

Then run the tests with:

/vendor/bin/codecept run

Running

Fire up a symfony dev server by running bin/console server:run.

Deploying

Currently, just check it out on the production server and configure it like stated above. Follow symfony setup instructions for webserver configuration and make sure to setup necessary proxy paths as well (depending on frontend):

  • Access to websocket
  • Access to static data
  • Access to desktop version API

Run scripts/update.sh to pull changes from git and reinitiate the cache.