feat(Deployment): Integrate Ansible deployment via PHP deployment pipeline
- Create AnsibleDeployStage using framework's Process module for secure command execution - Integrate AnsibleDeployStage into DeploymentPipelineCommands for production deployments - Add force_deploy flag support in Ansible playbook to override stale locks - Use PHP deployment module as orchestrator (php console.php deploy:production) - Fix ErrorAggregationInitializer to use Environment class instead of $_ENV superglobal Architecture: - BuildStage → AnsibleDeployStage → HealthCheckStage for production - Process module provides timeout, error handling, and output capture - Ansible playbook supports rollback via rollback-git-based.yml - Zero-downtime deployments with health checks
This commit is contained in:
@@ -69,6 +69,9 @@ RUN composer install --no-scripts --no-autoloader --ignore-platform-reqs || \
|
||||
COPY docker/php/php.common.ini /usr/local/etc/php/php.common.ini
|
||||
COPY docker/php/php.${ENV}.ini /usr/local/etc/php/php.ini
|
||||
|
||||
# Kopiere PHP-FPM Pool-Konfiguration
|
||||
COPY docker/php/zz-docker.conf /usr/local/etc/php-fpm.d/zz-docker.conf
|
||||
|
||||
# Xdebug-Konfiguration nur wenn dev
|
||||
RUN if [ "$ENV" = "dev" ] && [ -f docker/php/xdebug.ini ]; then \
|
||||
cp docker/php/xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
|
||||
@@ -84,22 +87,22 @@ RUN composer dump-autoload --optimize
|
||||
COPY docker/php/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
RUN mkdir -p /var/www/html/cache \
|
||||
/var/www/html/storage \
|
||||
/var/www/html/storage/logs \
|
||||
/var/www/html/storage/cache \
|
||||
/var/www/html/storage/analytics \
|
||||
/var/www/html/var \
|
||||
/var/www/html/var/cache \
|
||||
/var/www/html/var/logs
|
||||
# Remove entire storage directory tree copied from COPY . .
|
||||
# But we MUST create the empty parent directory so Docker can mount subdirectories
|
||||
RUN rm -rf /var/www/html/storage && mkdir -p /var/www/html/storage
|
||||
|
||||
# Erstelle uploads-Verzeichnis
|
||||
RUN mkdir -p /var/www/html/storage/uploads
|
||||
# CRITICAL: The storage directory must exist as an empty directory in the image
|
||||
# This allows Docker to mount Named Volumes to subdirectories (storage/cache, storage/logs, etc.)
|
||||
# without needing to create the parent directory at runtime (which fails due to read-only overlay)
|
||||
|
||||
# Danach erst den Nutzer wechseln!
|
||||
# Create appuser but DON'T switch yet - let entrypoint handle volumes first
|
||||
RUN groupadd -g 1000 appuser && useradd -u 1000 -g appuser -m appuser
|
||||
RUN chown -R appuser:appuser /var/www/html
|
||||
USER appuser
|
||||
|
||||
# Install gosu for secure user switching in entrypoint (Debian alternative to su-exec)
|
||||
RUN apt-get update && apt-get install -y gosu && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Note: USER switch happens in entrypoint AFTER volumes are mounted
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
CMD ["php-fpm"]
|
||||
|
||||
Reference in New Issue
Block a user