ogsoft-example/README.md

68 lines
2.1 KiB
Markdown
Raw Permalink Normal View History

2024-08-07 11:09:21 +00:00
How to start with development
===
* Run:
```bash
2024-08-07 12:54:08 +00:00
develop.sh
2024-08-07 11:09:21 +00:00
```
* Enjoy your coffee ;-)
* Laravel will serve web at [http://localhost:8000] (which redirect to API documentation)
* Requirements: Docker, Docker Compose v2, Bash
How to try API
===
* for example, via swagger ([http://localhost:8000/api/documentation])
How to create Czech public holidays:
---
```bash
docker compose exec -it php-fpm /var/www/html/artisan app:create-holidays CZ 2024
```
Tests
---
```bash
docker compose exec --env OTEL_PHP_DISABLED_INSTRUMENTATIONS=all php-fpm vendor/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 --memory-limit=2G
```
Swagger:
---
regenerate swagger:
```bash
docker compose exec -it php-fpm /var/www/html/artisan l5-swagger:generate
```
Logs:
---
* Logs in storage/logs/laravel.log file
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
* mysql -> Database
* grafana, tempo, loki, promtail, prometheus -> Monitoring stack
TODO:
---
* [ ] Logs into loki
* [ ] Better traces in Tempo (currently very basic)
* [ ] Monitor the result of refresh-database via Prometheus
* [ ] Monitor 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