Helper scripts

There are a number of helper scripts available. Most of them obey the FS_INT env var. Default is dev, you can also set it to test.

Script overview

./scripts/cleanRemove anything added by start/test commands
./scripts/composerRun php composer
./scripts/devRun webpack dev server for doing js dev (obsolete, included in ./scripts/start)
./scripts/docker-composeDocker-compose with the correct options set for the environment
./scripts/dropdbDrop the database
./scripts/fixruns all fixing - code stuff (php)
./scripts/fix-codestyle-localfix php code style, see php Code style
./scripts/inc.shdefines functions needed in other scripts
./scripts/initdbCreate the database and run migrations
./scripts/lintruns all lintings scripts lint-...
./scripts/lint-jslints javascript and vue files: prints errors etc.
./scripts/lint-markdown [files|directories|globs]lints markdown files: prints errors etc. NOTE: Custom args must originate from client/ directory (e.g. ../ for root file)
./scripts/lint-phplints php files: prints errors etc.
./scripts/mkdirsCreate directories that need to be present (called by other scripts)
./scripts/mysqlRun mysql command in correct context: ./scripts/mysql foodsharing "select * from fs_foodsaver"
./scripts/mysqldumpRun mysqldump command in correct context
./scripts/rmShut down and clean up all containers
./scripts/seedRun seed scripts in scripts/seeds/*.sql
./scripts/startStart everything, initializing anything if needed, see Setting things up
./scripts/stopStop everything, but leave it configured see Setting things up
./scripts/testRun tests
./scripts/test-chatRun test for the chat
./scripts/test-jsRun test for the client (JS)
./scripts/test-rerunRun tests without recreating db (faster that test)
./scripts/watch-assetsBuilds the static assets on change

Nightly maintenance

Using the docker-compose you can run various php-scripts, e.g.

./scripts/docker-compose run --rm --no-deps app php -f run.php Maintenance daily
./scripts/docker-compose run --rm --no-deps app php -f run.php Stats foodsaver
./scripts/docker-compose run --rm --no-deps app php -f run.php Stats betriebe
./scripts/docker-compose run --rm --no-deps app php -f run.php Stats bezirke

This runs the maintenance and statistics scripts that are run nightly on the production server. More generally you can run a public php function using:

./scripts/docker-compose run --rm --no-deps app php -f run.php <Module> <public_function>

This can be necessary to test code concerning statistics since they are usually never run locally. --rm removes the containers afterwards, --no-deps lets docker not worry about any dependendent containers. This is often useful since they are often running already.