Example for https://www.ogsoft.cz/ based on Laravel
Go to file
2024-08-07 14:54:08 +02:00
app refactor(controllers): extract validation of created data into separate method 2024-08-07 14:52:09 +02:00
bootstrap feat(controllers): add api endpoints 2024-08-07 14:52:08 +02:00
config docs: add swagger 2024-08-07 13:16:06 +02:00
database feat(models): add Country and NonWorkingDays models 2024-08-07 13:16:06 +02:00
docker build(docker): add docker containers 2024-08-07 12:29:53 +02:00
public Initial commit 2024-08-04 19:20:32 +02:00
resources docs: add swagger 2024-08-07 13:16:06 +02:00
routes feat(controllers): add api endpoints 2024-08-07 14:52:08 +02:00
storage docs: add swagger 2024-08-07 13:16:06 +02:00
tests fix(tests): phpstan 2024-08-07 14:52:09 +02:00
.editorconfig Initial commit 2024-08-04 19:20:32 +02:00
.env.example build(develop): fix missing env file 2024-08-07 14:52:09 +02:00
.gitattributes Initial commit 2024-08-04 19:20:32 +02:00
.gitignore ci(git): add gitignore for tempo and cache 2024-08-07 12:35:02 +02:00
artisan Initial commit 2024-08-04 19:20:32 +02:00
composer.json build: composer.lock - required libraries 2024-08-07 12:36:03 +02:00
composer.lock build: composer.lock - required libraries 2024-08-07 12:36:03 +02:00
develop.sh build(develop): fix chown and chmod 2024-08-07 14:52:09 +02:00
docker-compose.yml fix: session driver is file (for root request) 2024-08-07 14:52:10 +02:00
Dockerfile.fpm build(docker): add docker containers 2024-08-07 12:29:53 +02:00
Dockerfile.nginx build(docker): add docker containers 2024-08-07 12:29:53 +02:00
Dockerfile.static build(docker): add docker containers 2024-08-07 12:29:53 +02:00
package.json Initial commit 2024-08-04 19:20:32 +02:00
phpcs.xml.dist build(cs): add cs/stan configs 2024-08-07 12:31:57 +02:00
phpstan.neon.dist build(cs): add cs/stan configs 2024-08-07 12:31:57 +02:00
phpunit.xml Initial commit 2024-08-04 19:20:32 +02:00
README.md docs: fix typo 2024-08-07 14:54:08 +02:00
vite.config.js Initial commit 2024-08-04 19:20:32 +02:00

How to start with development

  • Run:
develop.sh
  • 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

How to create Czech public holidays:

docker compose exec -it php-fpm /var/www/html/artisan app:create-holidays CZ 2024

Tests

docker compose exec --env OTEL_PHP_DISABLED_INSTRUMENTATIONS=all php-fpm vendor/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 --memory-limit=2G

Swagger:

regenerate swagger:

docker compose exec -it php-fpm /var/www/html/artisan l5-swagger:generate

Logs:

  • Logs in storage/logs/laravel.log file

Traces:

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