build: add README

This commit is contained in:
Ondrej Vlach 2024-08-04 12:01:51 +02:00
parent 3a5c727e3e
commit 3b21412f77
No known key found for this signature in database
GPG Key ID: 7F141CDACEDEE2DE

64
README.md Normal file
View File

@ -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