How to Start with Development === * **Requirements:** * bash * Docker with Docker Compose (v2) command * **Run:** ```bash bin/develop.sh ``` * Enjoy your coffee ;-) * Symfony will serve the web at [http://localhost:8000] (API documentation) * The API endpoint is located at `/api/v1/forecast/{cityName}` * **To Try the API:** * Use tools like Swagger at [http://localhost:8000/]. * **Refresh Datastore:** ```bash docker compose exec php-fpm bin/console nano:fetch-forecast-data -vvv ``` * In the dev/production environment, refreshing will be handled automatically by `batch/v1/CronJob` kube-resource or a cron daemon if k8s is unavailable. Monitoring is performed using Prometheus/Sentry (see TODO). --- Tests --- Run the following command to execute the tests: ```bash docker compose exec php-fpm vendor/bin/phpunit ``` --- PHPStan & CodeSniffer --- * Run PHP CodeSniffer: ```bash docker compose exec php-fpm vendor/bin/phpcs ``` * Run PHPStan with an increased memory limit: ```bash docker compose exec php-fpm vendor/bin/phpstan --memory-limit=2G ``` --- Containers --- * `php-fpm` - FPM and additional tooling * `nginx` - Serves static content and proxies requests to FPM * `redis` - Redis for caching and data storage --- Troubleshooting --- * `/var/www/html/vendor` does not exist and could not be created: - See UID/GID problems. * UID/GID problems -> Try mapping the UID/GID of containers to your local user. Create `docker-compose.override.yaml` in the root of the project with: ```yaml services: nginx: build: args: - UID= - GID= php-fpm: build: args: - UID= - GID= ``` ... or you can change `x-mapped-user-container` in `docker-compose.yaml`. --- TODO --- * [ ] Clean Redis data. * [ ] Add a monitoring stack (Prometheus, Otel, Loki, Grafana, etc.). * [ ] Integrate Sentry. * [ ] Add monitoring (Sentry Cron or Prometheus) into `App\Command::execute` (which wraps Commands). * [ ] Establish deployment pipelines for dev/test and production environments. Configure production settings and Docker images. * [ ] Integrate CI. --- Notes --- * Rate-limiting is managed at the NGINX layer (per IP). Therefore, there is no need to send "banned" traffic to `php-fpm` and occupy workers.