Remove unused $user variables, add cron container for dev
- Remove 11 unused $user assignments from requireEventOwnership calls - Add cron container to docker-compose-dev.yml with scheduled tasks: expire-pending orders (5min), messenger monitor (hourly), meilisearch consistency (daily 3am) - Cron logs show registered tasks at startup and timestamps per execution Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
22
docker/cron/Dockerfile
Normal file
22
docker/cron/Dockerfile
Normal file
@@ -0,0 +1,22 @@
|
||||
FROM php:8.4-fpm
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libpq-dev \
|
||||
libzip-dev \
|
||||
libicu-dev \
|
||||
cron \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& docker-php-ext-install pdo_pgsql intl \
|
||||
&& pecl install redis \
|
||||
&& docker-php-ext-enable redis \
|
||||
&& groupadd -g 1000 appuser && useradd -u 1000 -g appuser -m appuser
|
||||
|
||||
COPY crontab /etc/cron.d/app-crontab
|
||||
RUN chmod 0644 /etc/cron.d/app-crontab && crontab -u appuser /etc/cron.d/app-crontab
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
CMD ["/entrypoint.sh"]
|
||||
3
docker/cron/crontab
Normal file
3
docker/cron/crontab
Normal file
@@ -0,0 +1,3 @@
|
||||
*/5 * * * * echo "[$(date '+\%Y-\%m-\%d \%H:\%M:\%S')] START app:orders:expire-pending" >> /proc/1/fd/1 && php /app/bin/console app:orders:expire-pending --env=dev >> /proc/1/fd/1 2>&1 && echo "[$(date '+\%Y-\%m-\%d \%H:\%M:\%S')] END app:orders:expire-pending" >> /proc/1/fd/1
|
||||
0 * * * * echo "[$(date '+\%Y-\%m-\%d \%H:\%M:\%S')] START app:monitor:messenger" >> /proc/1/fd/1 && php /app/bin/console app:monitor:messenger --env=dev >> /proc/1/fd/1 2>&1 && echo "[$(date '+\%Y-\%m-\%d \%H:\%M:\%S')] END app:monitor:messenger" >> /proc/1/fd/1
|
||||
0 3 * * * echo "[$(date '+\%Y-\%m-\%d \%H:\%M:\%S')] START app:meilisearch:check-consistency" >> /proc/1/fd/1 && php /app/bin/console app:meilisearch:check-consistency --fix --env=dev >> /proc/1/fd/1 2>&1 && echo "[$(date '+\%Y-\%m-\%d \%H:\%M:\%S')] END app:meilisearch:check-consistency" >> /proc/1/fd/1
|
||||
8
docker/cron/entrypoint.sh
Normal file
8
docker/cron/entrypoint.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
echo "=== E-Ticket Cron ==="
|
||||
echo "Registered tasks:"
|
||||
echo " - */5 * * * * app:orders:expire-pending"
|
||||
echo " - 0 * * * * app:monitor:messenger"
|
||||
echo " - 0 3 * * * app:meilisearch:check-consistency --fix"
|
||||
echo "===================="
|
||||
exec cron -f
|
||||
Reference in New Issue
Block a user