From 3b21412f77d9e51375768795048e6138e20bce05 Mon Sep 17 00:00:00 2001 From: Ondrej Vlach Date: Sun, 4 Aug 2024 12:01:51 +0200 Subject: [PATCH] build: add README --- README.md | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..11c3af6 --- /dev/null +++ b/README.md @@ -0,0 +1,64 @@ +How to start with development +=== +* Run: +```bash +bin/develop.sh +``` +* Enjoy your coffee ;-) +* Symfony will serve web at [http://localhost:8000] +* Requirements: Docker, Docker Compose v2, Bash + +How to import posts: +--- +```bash +docker compose exec -it php-fpm bin/console brilo:refresh-database +``` + +How to develop static content: +--- +```bash +docker compose run -it php-fpm /var/www/html/node_modules/.bin/encore dev +``` + +Tests +--- +```bash +docker compose exec --env OTEL_PHP_DISABLED_INSTRUMENTATIONS=all php-fpm bin/phpunit +``` + +phpstan & cs +```bash +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](http://localhost:3000/explore?panes=%7B%22oAA%22:%7B%22datasource%22:%22loki%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bjob%3D%5C%22__root__%5C%22%7D%20%7C%3D%20%60%60%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22loki%22%7D,%22editorMode%22:%22builder%22%7D%5D,%22range%22:%7B%22from%22:%22now-6h%22,%22to%22:%22now%22%7D%7D%7D&schemaVersion=1&orgId=1) + +Traces: +--- +* Traces are saved into Tempo and are available via Grafana at [http://localhost:3000](http://localhost:3000/explore?panes=%7B%22rOh%22:%7B%22datasource%22:%22tempo%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22datasource%22:%7B%22type%22:%22tempo%22,%22uid%22:%22tempo%22%7D,%22queryType%22:%22traceqlSearch%22,%22limit%22:20,%22filters%22:%5B%7B%22id%22:%22e056584d%22,%22operator%22:%22%3D%22,%22scope%22:%22span%22%7D%5D%7D%5D,%22range%22:%7B%22from%22:%22now-6h%22,%22to%22:%22now%22%7D%7D%7D&schemaVersion=1&orgId=1) + +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