Development
This page is for people who work on PriceBuddy itself. You do not need it to install or use the app.
PriceBuddy is built with Laravel and Filament.
Local development
Local development uses Lando. From the project root:
cp .env.example-dev .env
lando start
lando artisan key:generate
lando restart
Use .env.example-dev, not .env.example. The plain example has no database settings, so Laravel connects to 127.0.0.1 instead of the Lando database service. Lando loads .env only when it starts, so restart Lando after you change it.
Useful Lando commands
| Command | What it does |
|---|---|
lando artisan <command> | Run an artisan command. |
lando build | Install npm packages and build the frontend. |
lando watch | Start the Vite dev server on port 3000. |
lando clear | Clear the Laravel caches and the compiled config. |
lando xdebug-on / lando xdebug-off | Turn Xdebug on or off. |
Run lando with no arguments to see all commands.
Coding standards and tests
PriceBuddy uses pun to format, lint and analyse the code. Its config is pun.toml. Pun replaces Pint and PHPStan, so do not run those tools.
Fix formatting and lint errors after you edit PHP files:
lando pun check --fix
Check the code before you commit. The check must pass without errors:
lando pun check
pun check --fix does not fix static analysis errors. Fix those in the code.
Run the test suite in parallel:
lando artisan test --parallel
CI runs the same checks and the test suite on each pull request.
Documentation site
This site is built with VuePress from the docs directory. To preview your changes:
cd docs
npm install
npm run docs:dev
To add a page, create a Markdown file in docs/docs and add it to the sidebar list in docs/docs/.vuepress/config.js.
Docker images
PriceBuddy uses three Docker images:
| Image | Dockerfile | Built by |
|---|---|---|
jez500/pricebuddy-base-8.4 | docker/base.dockerfile | Hand |
jez500/pricebuddy-tests-8.4 | docker/tests.dockerfile | Hand |
jez500/pricebuddy | docker/php.dockerfile | CI, when a v* tag is pushed |
The tests image starts from the base image, and the app image starts from both. Rebuild the base image and then the tests image when the PHP version changes.
Build the base and tests images
Build each image for linux/amd64 and linux/arm64. Use the native buildx builder. It has a separate node for each architecture, so no image is built through QEMU emulation:
docker buildx build --builder native --platform linux/amd64,linux/arm64 --pull \
-f docker/base.dockerfile -t jez500/pricebuddy-base-8.4:latest --push docker
docker buildx build --builder native --platform linux/amd64,linux/arm64 --pull \
-f docker/tests.dockerfile -t jez500/pricebuddy-tests-8.4:latest --push docker
If you do not have a native builder, use --builder multiplatform instead. That builder uses QEMU for the architecture that your machine does not have, so the build is slower.
To create your own native builder, add one node for each architecture. Replace user@arm64-host with an arm64 machine that you can reach over SSH:
docker buildx create --name native --node amd64 --platform linux/amd64 unix:///var/run/docker.sock
docker buildx create --name native --append --node arm64 --platform linux/arm64 ssh://user@arm64-host
Release the app image
The app image build stops if the base image has a PHP version below the minimum in docker/php.dockerfile. Rebuild the base image before you tag a release.
To release, tag main with the next version and push the tag. Replace v1.0.N with that version:
git tag v1.0.N
git push origin v1.0.N
CI then builds the app image for linux/amd64 and linux/arm64. It publishes the image as jez500/pricebuddy:<tag> and jez500/pricebuddy:latest.