chore: update staging branch with current changes
This commit is contained in:
78
deployment/ansible/playbooks/check-php-files-and-workers.yml
Normal file
78
deployment/ansible/playbooks/check-php-files-and-workers.yml
Normal file
@@ -0,0 +1,78 @@
|
||||
---
|
||||
- name: Check PHP Files and PHP-FPM Workers
|
||||
hosts: production
|
||||
gather_facts: yes
|
||||
become: no
|
||||
|
||||
tasks:
|
||||
- name: Check if public/index.php exists
|
||||
shell: |
|
||||
cd ~/deployment/stacks/staging
|
||||
echo "=== Check public/index.php ==="
|
||||
docker compose exec -T staging-app ls -la /var/www/html/public/index.php 2>&1 || echo "index.php not found"
|
||||
echo ""
|
||||
echo "=== Check public directory ==="
|
||||
docker compose exec -T staging-app ls -la /var/www/html/public/ 2>&1 | head -20 || echo "public directory not found"
|
||||
echo ""
|
||||
echo "=== Check if code directory exists ==="
|
||||
docker compose exec -T staging-app ls -la /var/www/html/ 2>&1 | head -20 || echo "Code directory not found"
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: file_check
|
||||
ignore_errors: yes
|
||||
failed_when: false
|
||||
|
||||
- name: Display file check results
|
||||
debug:
|
||||
msg: "{{ file_check.stdout_lines }}"
|
||||
|
||||
- name: Check PHP-FPM worker processes in detail
|
||||
shell: |
|
||||
cd ~/deployment/stacks/staging
|
||||
echo "=== All processes in staging-app ==="
|
||||
docker compose exec -T staging-app ps aux 2>&1 || echo "Could not get processes"
|
||||
echo ""
|
||||
echo "=== Check PHP-FPM master and worker processes ==="
|
||||
docker compose exec -T staging-app sh -c "ps aux | grep -E '[p]hp|[f]pm' || echo 'No PHP-FPM processes found'" || echo "Process check failed"
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: process_check
|
||||
ignore_errors: yes
|
||||
failed_when: false
|
||||
|
||||
- name: Display process check results
|
||||
debug:
|
||||
msg: "{{ process_check.stdout_lines }}"
|
||||
|
||||
- name: Test PHP execution directly
|
||||
shell: |
|
||||
cd ~/deployment/stacks/staging
|
||||
echo "=== Test PHP CLI ==="
|
||||
docker compose exec -T staging-app php -v 2>&1 || echo "PHP CLI failed"
|
||||
echo ""
|
||||
echo "=== Test if we can include index.php ==="
|
||||
docker compose exec -T staging-app php -r "if(file_exists('/var/www/html/public/index.php')) { echo 'index.php exists\n'; } else { echo 'index.php NOT FOUND\n'; }" 2>&1 || echo "PHP test failed"
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: php_test
|
||||
ignore_errors: yes
|
||||
failed_when: false
|
||||
|
||||
- name: Display PHP test results
|
||||
debug:
|
||||
msg: "{{ php_test.stdout_lines }}"
|
||||
|
||||
- name: Check PHP-FPM pool status using status page
|
||||
shell: |
|
||||
cd ~/deployment/stacks/staging
|
||||
echo "=== Try to get PHP-FPM status ==="
|
||||
docker compose exec -T staging-app sh -c "SCRIPT_NAME=/status SCRIPT_FILENAME=/status REQUEST_METHOD=GET timeout 2 php -r \"\\\$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); if (socket_connect(\\\$socket, '127.0.0.1', 9000)) { socket_write(\\\$socket, 'GET /status HTTP/1.0\\r\\nHost: localhost\\r\\n\\r\\n'); \\\$response = socket_read(\\\$socket, 1024); echo \\\$response; socket_close(\\\$socket); } else { echo 'Could not connect to PHP-FPM'; }\" 2>&1" || echo "Status check failed"
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: fpm_status
|
||||
ignore_errors: yes
|
||||
failed_when: false
|
||||
|
||||
- name: Display PHP-FPM status
|
||||
debug:
|
||||
msg: "{{ fpm_status.stdout_lines }}"
|
||||
Reference in New Issue
Block a user