You just found the Drop App (first version of Boxtribute - an web-app, which makes it easy for organisations to source, store and distribute donated goods to people in need in a fair and dignified way). This is currently in the process of being replaced by Boxtribute 2.0.
Dropapp was initially developed for Drop In The Ocean - a Norwegian NGO who is working in three refugee camps throughout Greece. Other users include Samos Volunteers, Europe Cares, Hermine, The Free Shop Lebanon, Intereuropean Human Aid Association (IHA) and Movement on the Ground.
We have evolved the app to now be centrally hosted so we can offer the product to many more organisations, and are working constantly to improve the system and connect donor and distributor organisations with each other.
If you are interested in being part of this project, write us at [email protected]! You can also check out our website for more details about the kind of help we need on this project.
Install Docker
Install PHP 8.2 or later.
Ensure you have the mbstring
, curl
, mysql
and xdebug
PHP extensions installed. On Ubuntu:
apt install php-curl php-mbstring php-mysql php-xdebug
Clone this repo. If you're running Ubuntu, you may need to set write permissions to the templates folder for Docker.
git clone https://github.com/boxwise/dropapp
chmod -R 777 dropapp/templates (not generally recommended - ToDo Fix bug for Ubuntu users)
You first need to install 'composer' (we suggest making it available globally)
curl -s https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
You can install the required dependencies then using
composer install
To configure the app, copy /library/config.php.default
and remove the .default
in the filename. Then fill the Auth0 credentials from the Auth0 client. Please check docs/auth0.md for further information regarding Auth0.
To run the application, we assume you have Docker installed. You can then run:
docker-compose up
Alternatively, you can run using the PHP development server
php -S localhost:8000 gcloud-entry.php
To initialize the database for the first time, you should run this command to create the schema:
vendor/bin/phinx migrate -e development
The database seed db/init.sql
is generated in v2 and copied from there.
If you want to additionally want to connect the users from the seed to auth0 and populate the db table cms_usergroups_roles then open a browser and request http://localhost:8100/cron/reseed-auth0.php
Once the docker containers are running the app is accessible at http://localhost:8100/
After this you should be able to login to the app using the password Browser_tests and one of the following emails:
BoxAid (all have access to one base called Lesvos):
BoxCare (there are 3 bases associated - Thessaloniki, Samos, Athens):
Most of us use VSCode as a code editor and MySQL workbench for database access.
So we don't have to think/argue over code conventions, we're using the php-cs-fixer automatic code formatter.
CircleCI will fail your Pull-Request if there is any code requiring linting fixes.
If you're using VSCode, the vscode-php-cs-fixer
extension will be suggested automatically and apply
auto format on save.
Alternatively, you can run
php vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix . --rules @PhpCsFixer
in the root manually.
We have enabled XDebug remote debugging in the default Docker configuration, so you can step through your code. Please run docker-compose up --build
next time you start up your server to update your docker image.
If you're using VS Code, if you install the PHP Debug extension and start the 'Listen for XDebug' configuration, you can then set breakpoints in your code.
Please be aware that only breakpoints are caught which sit in a line with executable code.
Docker containers running on linux cannot resolve the address host.docker.internal
to an ip-address. To use Xdebug on linux you have to specify the internal ip-address of the docker container in docker-compose.yaml
.
To find out your internal docker address run
docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}'
Enter the address in docker-compose.yaml
here:
environment:
XDEBUG_CONFIG: remote_host=172.19.0.1
If you want to connect to the MySQL server from your host machine, you can do this using
docker exec -it mysql -u root -p
The mysql server in your docker container is also reachable on port 9906 of your localhost
mysql --host=127.0.0.1 --port=9906 -u root -p
The password for the root-user for the db dropapp_dev
is dropapp_root
.
Most of use use workbench to access the MySQL database. To establish a connection you need to enter your localhost
-address, e.g. 127.0.0.1
, for 'Hostname' and 9906
for 'Port'.
We're using Phinx to run database migrations.
To migrate to the current database version run
vendor/bin/phinx migrate
To create an migration run
vendor/bin/phinx create
It creates an file in db/migrations
. Please use this file to write your db migration.
We use Cypress for Browser-test. To run Cypress tests on your local environment, please
baseURL
to your local address, e.g. localhost:8100
in cypress.json.auth0Domain
to the development Auth0 tenant,
e.g. boxtribute-dev.eu.auth0.com
in cypress.json.If the tests 2.4 and 2.9 fail, check
All tests in cypress/integrations
should be found and can be directly executed. When writing tests, try to follow these guidelines if possible:
cypress/support
files - then they're available globally. Find the matching one by name or create a new one. In latter case, don't forget to import it in cypress/integrations/index.js
. Avoid creating miscellaneous file names as it tends to lead to chaos.clickNewUserButton()
is better than clickElementByTypeAndTestId('button','new-user-button')
.We experienced before that tests can fail in CircleCI, but not in the local environment. The main reason for it is that Cypress is usually executing the commands slower in a local dev environment. Therefore, a few additional guidelines when writing test:
cy.url().should('include', 'people_deactivated')
. Due to this assertion cypress will definitely wait until the redirect is executed.cy.visit()
you can be sure that the cypress test wait until a page is fully loaded. Therefore, try to navigate as much as possible with cy.visit()
.If you are setting up a new Auth0 tenant, we require access to the Auth0 Management API. In order to do this
You gotta be awesome and kind. For everything else, please see our contribution guidelines
Drop us an email to [email protected]!
See the LICENSE file for license rights and limitations (Apache 2.0).