Example for https://www.brilo.team/
assets | ||
bin | ||
config | ||
docker | ||
migrations | ||
public | ||
src | ||
templates | ||
tests | ||
translations | ||
.env | ||
.env.test | ||
.gitignore | ||
composer.json | ||
composer.lock | ||
docker-compose.yml | ||
Dockerfile.fpm | ||
Dockerfile.nginx | ||
Dockerfile.static | ||
package-lock.json | ||
package.json | ||
phpcs.xml.dist | ||
phpstan.dist.neon | ||
phpunit.xml.dist | ||
README.md | ||
symfony.lock | ||
webpack.config.js |
How to start with development
- Run:
bin/develop.sh
- Enjoy your coffee ;-)
- Symfony will serve web at [http://localhost:8000]
- Requirements: Docker, Docker Compose v2, Bash
How to import posts:
docker compose exec -it php-fpm bin/console brilo:refresh-database
How to develop static content:
docker compose run -it php-fpm /var/www/html/node_modules/.bin/encore dev
Tests
docker compose exec --env OTEL_PHP_DISABLED_INSTRUMENTATIONS=all php-fpm bin/phpunit
phpstan & cs
docker compose exec --env OTEL_PHP_DISABLED_INSTRUMENTATIONS=all php-fpm vendor/bin/phpcs
docker compose exec --env OTEL_PHP_DISABLED_INSTRUMENTATIONS=all php-fpm vendor/bin/phpstan
Logs:
- Logs are saved into Loki and are available via Grafana at http://localhost:3000
Traces:
- Traces are saved into Tempo and are available via Grafana at http://localhost:3000
Containers:
- php-fpm -> FPM and tooling
- nginx -> Serving static content, proxy to FPM
- postgres -> Database
- grafana, tempo, loki, promtail, prometheus -> Monitoring stack
TODO:
- Add some validations, parsing of remote entities & use better db types than text (but there is no documentation of API...)
- Custom error pages
- Better traces in Tempo (currently very basic)
- Monitor the result of refresh-database via Prometheus
- Monitor 500/200 status codes via Prometheus
- Sentry integration
- Deployment to dev/test and prod, production settings, production Docker images
- CI/CD
Notes
In real "production" code, the monitoring stack will be available from the dev/test environment. It doesn't make sense to have it on the local dev stack, but for this example, I thought it was good