docker compose up --detach
docker compose exec phpfpm composer install
# Run migrations without encryption.
# Reverse patch from composer.json
(cd vendor/doctrine/dbal && patch --strip=1 --reverse < ../../../core/patches/doctrine/dbal/encrypted-table.patch)
# Remove encryption from migrations
sed -i'' 's/ENCRYPTED = YES//g' migrations/Version*.php
docker compose exec phpfpm bin/console doctrine:migrations:migrate --no-interaction
# Undo changes to migrations.
git checkout migrations/
# Apply patch from composer.json
(cd vendor/doctrine/dbal && patch --strip=1 < ../../../core/patches/doctrine/dbal/encrypted-table.patch)
docker compose exec phpfpm bin/console doctrine:fixtures:load
docker compose exec phpfpm bin/console kontrolgruppen:user:login [email protected]
The docker compose
setup uses a custom image hosted on GitHub, and you have to
sign in to download this image.
Go to https://github.com/settings/tokens/new and create a new personal access
token with read:packages
checked. Save the token in a file, e.g.
~/github-docker-read-token.txt
.
Run this command to sign in using your token before pulling docker images
(replace USERNAME
with your actual GitHub username):
cat ~/github-docker-read-token.txt | docker login https://docker.pkg.github.com -u USERNAME --password-stdin
to sign in (cf. https://docs.github.com/en/packages/guides/configuring-docker-for-use-with-github-packages#authenticating-with-a-personal-access-token).
docker compose pull
docker compose up -d
Open the site in your default browser:
open http://$(docker compose port nginx 80)
# Install dependencies.
composer install
# Migrate database.
# If using docker these bin/console commands should be run from inside the phpfpm container.
docker compose exec phpfpm /app/bin/console doctrine:migrations:migrate
# Create super admin user.
docker compose exec phpfpm /app/bin/console fos:user:create --super-admin
You can load fixtures by running the command
docker compose exec phpfpm bin/console doctrine:fixtures:load
and then use
docker compose exec phpfpm bin/console kontrolgruppen:user:login [email protected]
to get a one-time sign in url.
# Make sure that the database is created
docker compose exec borgerdata node createdb.js
# Migrate database
docker compose exec borgerdata yarn knex migrate:latest
# Seed the database
docker compose exec borgerdata yarn knex seed:run
To use MakerBundle in Kontrolgruppen\CoreBundle, use the following environment variable:
MAKER_NAMESPACE=Kontrolgruppen\\CoreBundle php bin/console make:entity
This will place the files in the correct location.
Watch for changes in js and css files and build development version:
docker compose run --rm node yarn watch
Check Symfony coding standards using PHP Coding Standards Fixer and PHP_CodeSniffer:
composer check-coding-standards
Apply Symfony coding standards:
composer apply-coding-standards
Check Twig templates using Twigcs:
composer check-coding-standards/twigcs
Check JavaScript files using eslint:
docker compose run --rm node yarn check-coding-standards-js
Apply coding standards:
docker compose run --rm node yarn apply-coding-standards-js
Check SCSS files using stylelint:
docker compose run --rm node yarn check-coding-standards-scss
Apply coding standards:
docker compose run --rm node yarn apply-coding-standards-scss
We use PHPStan and Psalm for static code analysis.
composer code-analysis/phpstan
composer code-analysis/psalm
composer code-analysis # Run both tools
All code checks mentioned above are automatically run by GitHub Actions when a pull request is created.
To run the actions locally, install act and run
act -P ubuntu-latest=shivammathur/node:focal pull_request
Use act -P ubuntu-latest=shivammathur/node:focal pull_request --list
to see
individual workflow jobs that can be run, e.g.
act -P ubuntu-latest=shivammathur/node:focal pull_request --job phpcsfixer