Expand terminal filesystem, add mainframe hint cron, redirect PHP logs
- Game1 terminal: flesh out the virtual filesystem with a realistic spread of Linux directories/files (~70 dirs, ~140 files) so it no longer reads as an obviously small puzzle set, without touching any win-condition or rapport files. - Add app:hints:check command + a php-cron container (BusyBox crond) that nudges players who haven't contacted every teammate 5 minutes into a session, via a new 'hint' Mercure message type. - Log the cron command's output to var/log/cron/cron.log and rotate it (25MB / 90 days) via logrotate, run daily from the same crontab. - Redirect PHP's error_log and Symfony's prod app/deprecation logs from stderr-only into var/log/php/*.log (kept alongside stderr), with the same rotation policy. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -66,6 +66,39 @@ services:
|
||||
# ipv4_address: 172.23.0.11
|
||||
restart: unless-stopped
|
||||
|
||||
php-cron:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/php/Dockerfile
|
||||
args:
|
||||
USER_ID: ${USER_ID}
|
||||
GROUP_ID: ${GROUP_ID}
|
||||
container_name: escapepage-php-cron
|
||||
volumes:
|
||||
- ../:/var/www/html:delegated
|
||||
- /etc/hosts:/etc/hosts:ro
|
||||
environment:
|
||||
APP_ENV: ${APP_ENV}
|
||||
SITE_BASE_URL: ${SITE_BASE_URL}
|
||||
MAILER_DSN: ${MAILER_DSN}
|
||||
MAILER_FROM: ${MAILER_FROM}
|
||||
DATABASE_URL: ${DATABASE_URL}
|
||||
MERCURE_URL: ${MERCURE_URL}
|
||||
MERCURE_PUBLIC_URL: ${MERCURE_PUBLIC_URL}
|
||||
MERCURE_JWT_SECRET: ${MERCURE_JWT_SECRET}
|
||||
MERCURE_CORS_ALLOWED_ORIGINS: ${MERCURE_CORS_ALLOWED_ORIGINS}
|
||||
MERCURE_TOPIC_BASE: ${MERCURE_TOPIC_BASE}
|
||||
RECAPTCHA3_KEY: ${RECAPTCHA3_KEY}
|
||||
RECAPTCHA3_SECRET: ${RECAPTCHA3_SECRET}
|
||||
depends_on:
|
||||
- database
|
||||
- mercure
|
||||
command: ["crond", "-f", "-l", "2"]
|
||||
# networks:
|
||||
# backend:
|
||||
# ipv4_address: 172.23.0.16
|
||||
restart: unless-stopped
|
||||
|
||||
nginx:
|
||||
image: nginx:1.29.4-alpine
|
||||
container_name: escapepage-nginx
|
||||
|
||||
+12
-2
@@ -12,7 +12,8 @@ RUN apk add --no-cache \
|
||||
make \
|
||||
nodejs \
|
||||
npm \
|
||||
shadow
|
||||
shadow \
|
||||
logrotate
|
||||
|
||||
# Install PHP extension installer
|
||||
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
||||
@@ -41,6 +42,15 @@ COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
||||
# Configure PHP
|
||||
COPY docker/php/php.ini $PHP_INI_DIR/conf.d/zz-custom.ini
|
||||
|
||||
# Cron daemon (BusyBox's built-in crond) for the php-cron container.
|
||||
# Harmless for the php/php-worker containers too, since they never invoke crond.
|
||||
COPY docker/php/crontab /etc/crontabs/root
|
||||
RUN chmod 0600 /etc/crontabs/root
|
||||
|
||||
# Log rotation for the cron hint-check and PHP error logs: 25MB per file, kept for 3 months.
|
||||
COPY docker/php/logrotate/cron-hints.conf /etc/logrotate.d/cron-hints
|
||||
COPY docker/php/logrotate/php-logs.conf /etc/logrotate.d/php-logs
|
||||
|
||||
# Adjust www-data UID/GID to match host user (default 1000)
|
||||
ARG USER_ID=1000
|
||||
ARG GROUP_ID=1000
|
||||
@@ -56,7 +66,7 @@ RUN if [ ${USER_ID:-0} -ne 0 ] && [ ${GROUP_ID:-0} -ne 0 ]; then \
|
||||
WORKDIR /var/www/html
|
||||
|
||||
# Set permissions for Symfony directories
|
||||
RUN mkdir -p var/cache var/log var/sessions && \
|
||||
RUN mkdir -p var/cache var/log/cron var/log/php var/sessions && \
|
||||
chown -R www-data:www-data var
|
||||
|
||||
# Default command
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
* * * * * php /var/www/html/bin/console app:hints:check >> /var/www/html/var/log/cron/cron.log 2>&1
|
||||
5 3 * * * logrotate -s /var/www/html/var/log/.logrotate.state /etc/logrotate.d/cron-hints /etc/logrotate.d/php-logs
|
||||
@@ -0,0 +1,11 @@
|
||||
/var/www/html/var/log/cron/cron.log {
|
||||
size 25M
|
||||
rotate 100
|
||||
maxage 90
|
||||
missingok
|
||||
notifempty
|
||||
compress
|
||||
delaycompress
|
||||
dateext
|
||||
dateformat -%Y%m%d-%s
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/var/www/html/var/log/php/*.log {
|
||||
size 25M
|
||||
rotate 100
|
||||
maxage 90
|
||||
missingok
|
||||
notifempty
|
||||
compress
|
||||
delaycompress
|
||||
dateext
|
||||
dateformat -%Y%m%d-%s
|
||||
}
|
||||
+1
-1
@@ -9,6 +9,6 @@ opcache.validate_timestamps=1
|
||||
opcache.revalidate_freq=0
|
||||
|
||||
log_errors=On
|
||||
error_log=/var/www/html/var/log/errorlog_php.log
|
||||
error_log=/var/www/html/var/log/php/error.log
|
||||
session.gc_maxlifetime=1440
|
||||
session.cookie_lifetime=0
|
||||
|
||||
Executable → Regular
+2
-2
@@ -12,7 +12,7 @@ echo "Stopping and removing containers..."
|
||||
docker network rm escapepage_network || true
|
||||
docker network rm $(docker network ls -q --filter name=escapepage) || true
|
||||
docker network prune -f || true
|
||||
docker rm -f escapepage-db escapepage-php escapepage-nginx escapepage-mercure escapepage-mailer escapepage-php-worker || true
|
||||
docker rm -f escapepage-db escapepage-php escapepage-nginx escapepage-mercure escapepage-mailer escapepage-php-worker escapepage-php-cron || true
|
||||
docker system prune -f || true
|
||||
|
||||
echo "Clearing Docker build cache..."
|
||||
@@ -21,7 +21,7 @@ docker builder prune -af
|
||||
echo "Setting permissions for var/volumes/db and var directories..."
|
||||
sudo chown -R 1000:1000 "$ROOT_DIR/var/volumes/db" || true
|
||||
sudo chmod -R 777 "$ROOT_DIR/var/volumes/db" || true
|
||||
sudo mkdir -p "$ROOT_DIR/var/cache" "$ROOT_DIR/var/log" "$ROOT_DIR/var/sessions"
|
||||
sudo mkdir -p "$ROOT_DIR/var/cache" "$ROOT_DIR/var/log/cron" "$ROOT_DIR/var/log/php" "$ROOT_DIR/var/sessions"
|
||||
sudo chown -R 1000:1000 "$ROOT_DIR/var" || true
|
||||
sudo chmod -R 777 "$ROOT_DIR/var" || true
|
||||
|
||||
|
||||
Executable → Regular
+4
@@ -143,6 +143,10 @@ Common commands:
|
||||
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE logs -f nginx)
|
||||
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE logs -f php)
|
||||
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE logs -f php-worker)
|
||||
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE logs -f php-cron) # crond scheduler activity
|
||||
tail -f "$ROOT_DIR/var/log/cron/cron.log" # hint-check command output
|
||||
tail -f "$ROOT_DIR/var/log/php/error.log" # raw PHP errors
|
||||
tail -f "$ROOT_DIR/var/log/php/prod.log" # Symfony app errors (prod only)
|
||||
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE exec php bash)
|
||||
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE exec php npm run watch)
|
||||
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE down)
|
||||
|
||||
Reference in New Issue
Block a user