Skip to content

Latest commit

 

History

History
161 lines (120 loc) · 7.08 KB

8. Troubleshooting.md

File metadata and controls

161 lines (120 loc) · 7.08 KB

Troubleshooting

8.1 Demonstrate ability to locate and use logs

Locate the Magento application logs

var/log/

Pro projects have a three-node structure and each node contains logs with specific information for that node.

Logs in var/log on Staging and Production: separate log for every node

Logs in the var/log/ directory are not shared between nodes of the enterprise server cluster; each server has its own log. We recommend checking logs on every node for complete reporting.

Locate system services logs on integration and Starter environments

Log locations (directories) for Starter plan

  • Build log => var/log/cloud.log
  • Debug log => var/log/debug.log
  • Exception log => var/log/exception.log
  • Report logs (reports) => var/reports
  • Support report log => var/log/support_report.log
  • Deployment log => /var/log/deploy.log
  • Cron log => /var/log/cron.log
  • Nginx access log => /var/log/access.log
  • Nginx error log => /var/log/error.log
  • PHP access log => /var/log/php.access.log
  • PHP FPM log => /var/log/app.log
  • Redis log => No access
  • Elasticseach log => No access
  • Mail log => No access
  • MySQL error log => No access
  • MySQL slow log => No access
  • RabbitMQ log => No access
  • Solr log => No access
  • Syslog => No access
Locate system services logs on Pro environments

Log locations (directories) for Pro plan: Integration, Staging, Production

Integration => Staging => Production

  • Build log => var/log/cloud.log
  • Debug log => var/log/debug.log
  • Exception log => var/log/exception.log
  • Report logs (reports) => var/reports
  • Support report log => var/log/support_report.log
  • Deployment log => /var/log/deploy.log => /var/log/platform/{project_id}_stg/deploy.log => /var/log/platform/{project_id}/deploy.log
  • Cron log => /var/log/cron.log => /var/log/platform/{project_id}_stg/cron.log => var/log/platform/{project_id}/cron.log
  • Nginx access log => /var/log/access.log => /var/log/platform/{project_id}_stg/access.log => /var/log/platform/{project_id}/access.log
  • Nginx error log => /var/log/error.log => /var/log/platform/{project_id}_stg/error.log => /var/log/platform/{project_id}/error.log
  • PHP access log => /var/log/php.access.log => /var/log/platform/{project_id}_stg/php.access.log => /var/log/platform/{project_id}/php.access.log
  • PHP FPM log => /var/log/app.log => /var/log/platform/{project_id}_stg/php5-fpm.log => /var/log/platform/{project_id}/php5-fpm.log
  • Redis log => No access => /var/log/platform/{project_id}_stg/redis-server-{project_id}_stg.log => /var/log/platform/{project_id}/redis-server-{project_id}.log
  • Elasticseach log => No access => /var/log/elasticsearch/elasticsearch.log
  • Mail log => No access => /var/log/mail.log
  • MySQL error log => No access => /var/log/mysql/mysql-error.log
  • MySQL slow log => No access => /var/log/mysql/mysql-slow.log
  • RabbitMQ log => No access => /var/log/rabbitmq/[email protected]
  • Solr log => No access => /var/log/platform/solr.log
  • Syslog => No access

8.2 Demonstrate ability to create snapshots and backups

8.3 Demonstrate ability to debug

How to use XDebug on Cloud
  • Add xdebug extension

For Pro Staging and Production, you need to update this file and enter a Support ticket to have it enabled

#.magento.app.yaml
runtime:
    extensions:
   - mcrypt
   - redis
   - xsl
   - json
   - xdebug
  • Optionally, modify the timeout. A default timeout of 300 seconds (5 minutes)
web:
     commands:
         start: |
             cat /etc/php/7.0/fpm/php-fpm.conf | sed -e 's/request_terminate_timeout.*//g' > /tmp/php-fpm.conf
             /usr/sbin/php-fpm7.0 -y /tmp/php-fpm.conf
  • Configure PhpStorm

  • Set up port forwarding ssh -R 9000:localhost:9000 <ssh url>

Configure Xdebug

Pro staging and production

Set up the tunnels, this will connect to localhost on port 9000

Three tunnels are needed because we never know which host the request will hit. The rm commands are necessary to clean up from past sessions.

ssh [email protected] 'rm /run/platform/USERNAME/xdebug.sock'
ssh -R /run/platform/USERNAME/xdebug.sock:localhost:9000 -N [email protected]&

ssh [email protected] 'rm /run/platform/USERNAME/xdebug.sock'
ssh -R /run/platform/USERNAME/xdebug.sock:localhost:9000 -N [email protected]&

ssh [email protected] 'rm /run/platform/USERNAME/xdebug.sock'
ssh -R /run/platform/USERNAME/xdebug.sock:localhost:9000 -N [email protected]&

Next to enable remote debugging, visit the site in the browser, add ?XDEBUG_SESSION_START=KEY to the url, where KEY is the key set in the yaml file. This will set the cookie causing browser requests to trigger xdebug. ?XDEBUG_SESSION_STOP=KEY can be used to remove the cookie, stopping the session.

XDEBUG_SESSION_START passed via POST requests is not supported, the cookie must first be set either manually or via a GET request.

CLI ssh 1.ent-{project_id}@ssh.eu.magentosite.cloud

lean up from past sessions.

rm /run/platform/{project_id}_stg/xdebug.sock

ssh -R /run/platform/{project_id}_stg/xdebug.sock:localhost:9000 -N 1.ent-{project_id}@ssh.eu.magentosite.cloud

export XDEBUG_CONFIG='PHPSTORM' export PHP_IDE_CONFIG="serverName=magento-cloud-staging"

php -c /etc/platform/{project_id}_stg/php.xdebug.ini ./bin/magento

8.4 Demonstrate ability to apply Magento fixes in patches

Sometimes we provide a custom patch to address a specific issue. Also, third-party extension developers can provide a custom patch. Copy the custom patch to the m2-hotfixes/ directory and test it on your local workstation.

Apply custom patches

php ./vendor/bin/ece-tools build:generate will apply custom patches during build phase

8.5 Describe branch synchronization

Describe branch synchronization and merge

Documentation: