fix: Use application code directory for docker-compose files
Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Successful in 53s
Security Vulnerability Scan / Check for Dependency Changes (push) Successful in 25s
🚀 Build & Deploy Image / Build Runtime Base Image (push) Successful in 12s
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
Security Vulnerability Scan / Composer Security Audit (push) Has been skipped
🚀 Build & Deploy Image / Build Docker Image (push) Successful in 15s
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Failing after 1m20s
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped

- Change from stacks path to application code directory (/home/deploy/michaelschiemer/current)
- docker-compose files are in the application root, not in deployment/stacks
- Fixes 'no such file or directory' error for docker-compose.base.yml
This commit is contained in:
2025-11-08 15:26:42 +01:00
parent dd072ded3c
commit f0a412a221

View File

@@ -5,15 +5,8 @@
become: no become: no
vars: vars:
# Base path for deployment stacks (default value) # Application code directory (where docker-compose files are located)
stacks_base_path_default: "/home/deploy/deployment/stacks" application_code_dest: "/home/deploy/michaelschiemer/current"
# Determine stack path based on environment
application_stack_dest: >-
{%- if deployment_environment == 'staging' -%}
{{ staging_stack_path | default((stacks_base_path | default(stacks_base_path_default)) + '/staging') }}
{%- else -%}
{{ app_stack_path | default((stacks_base_path | default(stacks_base_path_default)) + '/production') }}
{%- endif -%}
application_compose_suffix: >- application_compose_suffix: >-
{%- if deployment_environment == 'staging' -%} {%- if deployment_environment == 'staging' -%}
staging.yml staging.yml
@@ -44,14 +37,16 @@
- name: Install composer dependencies in PHP container - name: Install composer dependencies in PHP container
shell: | shell: |
docker compose -f {{ application_stack_dest }}/docker-compose.base.yml -f {{ application_stack_dest }}/docker-compose.{{ application_compose_suffix }} exec -T {{ php_service_name }} composer install --no-dev --optimize-autoloader --no-interaction cd {{ application_code_dest }}
docker compose -f docker-compose.base.yml -f docker-compose.{{ application_compose_suffix }} exec -T {{ php_service_name }} composer install --no-dev --optimize-autoloader --no-interaction
register: composer_install register: composer_install
changed_when: true changed_when: true
failed_when: composer_install.rc != 0 failed_when: composer_install.rc != 0
- name: Restart queue-worker and scheduler to pick up vendor directory (production only) - name: Restart queue-worker and scheduler to pick up vendor directory (production only)
shell: | shell: |
docker compose -f {{ application_stack_dest }}/docker-compose.base.yml -f {{ application_stack_dest }}/docker-compose.{{ application_compose_suffix }} restart queue-worker scheduler cd {{ application_code_dest }}
docker compose -f docker-compose.base.yml -f docker-compose.{{ application_compose_suffix }} restart queue-worker scheduler
register: restart_workers register: restart_workers
changed_when: true changed_when: true
failed_when: false failed_when: false
@@ -65,7 +60,8 @@
- name: Verify vendor/autoload.php exists - name: Verify vendor/autoload.php exists
shell: | shell: |
docker compose -f {{ application_stack_dest }}/docker-compose.base.yml -f {{ application_stack_dest }}/docker-compose.{{ application_compose_suffix }} exec -T {{ php_service_name }} test -f /var/www/html/vendor/autoload.php && echo "EXISTS" || echo "MISSING" cd {{ application_code_dest }}
docker compose -f docker-compose.base.yml -f docker-compose.{{ application_compose_suffix }} exec -T {{ php_service_name }} test -f /var/www/html/vendor/autoload.php && echo "EXISTS" || echo "MISSING"
register: autoload_check register: autoload_check
changed_when: false changed_when: false