Ошибка сервера gcloud 500 с Laravel & Cloud SQL - PullRequest
0 голосов
/ 29 сентября 2019

Мое приложение Laravel 6.0 работало в Google App Engine до тех пор, пока я не включил интеграцию базы данных с Cloud SQL.

Я внес некоторые изменения в файл app.yaml, настроил экземпляр MySQL 2-го поколения и развернулто же самое приложениеТем не менее, теперь я столкнулся с 500 внутренних ошибок сервера.Логи не объясняли, что случилось.Что мне здесь не хватает?

Вот последний app.yaml файл, используемый для развертывания приложения.

#app.yaml

runtime: php
env: flex

runtime_config:
  document_root: public

env_variables:
  # Put production environment variables here.
  APP_LOG: errorlog
  APP_KEY: base64:HRJlC5LuMqjl7p98Lb2udzV6jKOnGFohu8dG3COBtmc=
  APP_STORAGE: /tmp
  VIEW_COMPILED_PATH: /tmp
  CACHE_DRIVER: database
  SESSION_DRIVER: database
  ## Set these environment variables according to your CloudSQL configuration.
  DB_DATABASE: cbt-sql
  DB_USERNAME: root
  DB_PASSWORD: secret
  DB_SOCKET: "/cloudsql/theta-byte-123456:asia-southeast1:cbt-sql"

Журналы ниже приведены для экземпляра, развернутого в GAE.

#gcloud Logs Viewer

A 2019-09-29T08:58:36Z 2019-09-29 08:58:36,646 CRIT Supervisor running as root (no user in config file)

A 2019-09-29T08:58:36Z 2019-09-29 08:58:36,653 WARN No file matches via include "/etc/supervisor/conf.d/*.conf"

A 2019-09-29T08:58:36Z 2019-09-29 08:58:36,668 INFO supervisord started with pid 1

A 2019-09-29T08:58:37Z 2019-09-29 08:58:37,678 INFO spawned: 'php-fpm' with pid 8

A 2019-09-29T08:58:37Z 2019-09-29 08:58:37,688 INFO spawned: 'nginx' with pid 9

A 2019-09-29T08:58:38Z 2019-09-29 08:58:38,302 CRIT Supervisor running as root (no user in config file)

A 2019-09-29T08:58:38Z 2019-09-29 08:58:38,303 WARN No file matches via include "/etc/supervisor/conf.d/*.conf"

A 2019-09-29T08:58:38Z 2019-09-29 08:58:38,340 INFO supervisord started with pid 1

A 2019-09-29T08:58:38Z 2019/09/29 08:58:37 [notice] 9#9: using the "epoll" event method

A 2019-09-29T08:58:38Z 2019/09/29 08:58:37 [notice] 9#9: nginx/1.10.3 (Ubuntu)

A 2019-09-29T08:58:38Z 2019/09/29 08:58:37 [notice] 9#9: OS: Linux 4.14.137+

A 2019-09-29T08:58:38Z 2019/09/29 08:58:37 [notice] 9#9: getrlimit(RLIMIT_NOFILE): 1048576:1048576

A 2019-09-29T08:58:38Z 2019/09/29 08:58:37 [notice] 9#9: start worker processes

A 2019-09-29T08:58:38Z 2019/09/29 08:58:37 [notice] 9#9: start worker process 10

A 2019-09-29T08:58:38Z [29-Sep-2019 08:58:38] NOTICE: fpm is running, pid 8

A 2019-09-29T08:58:38Z [29-Sep-2019 08:58:38] NOTICE: ready to handle connections

A 2019-09-29T08:58:39Z 2019-09-29 08:58:39,343 INFO spawned: 'php-fpm' with pid 8

A 2019-09-29T08:58:39Z 2019-09-29 08:58:39,346 INFO spawned: 'nginx' with pid 9

A 2019-09-29T08:58:39Z 2019-09-29 08:58:39,156 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

A 2019-09-29T08:58:39Z 2019-09-29 08:58:39,157 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

A 2019-09-29T08:58:40Z 2019/09/29 08:58:39 [notice] 9#9: using the "epoll" event method

A 2019-09-29T08:58:40Z 2019/09/29 08:58:39 [notice] 9#9: nginx/1.10.3 (Ubuntu)

A 2019-09-29T08:58:40Z 2019/09/29 08:58:39 [notice] 9#9: OS: Linux 4.14.137+

A 2019-09-29T08:58:40Z 2019/09/29 08:58:39 [notice] 9#9: getrlimit(RLIMIT_NOFILE): 1048576:1048576

A 2019-09-29T08:58:40Z 2019/09/29 08:58:39 [notice] 9#9: start worker processes

A 2019-09-29T08:58:40Z 2019/09/29 08:58:39 [notice] 9#9: start worker process 10

A 2019-09-29T08:58:40Z 2019-09-29 08:58:40,361 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

A 2019-09-29T08:58:40Z 2019-09-29 08:58:40,362 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

A 2019-09-29T08:58:40Z [29-Sep-2019 08:58:40] NOTICE: fpm is running, pid 8

A 2019-09-29T08:58:40Z [29-Sep-2019 08:58:40] NOTICE: ready to handle connections

A 2019-09-29T09:00:25Z 2019-09-29 09:00:25,054 CRIT Supervisor running as root (no user in config file)

A 2019-09-29T09:00:25Z 2019-09-29 09:00:25,056 WARN No file matches via include "/etc/supervisor/conf.d/*.conf"

A 2019-09-29T09:00:25Z 2019-09-29 09:00:25,082 INFO supervisord started with pid 1

A 2019-09-29T09:00:26Z 2019-09-29 09:00:26,088 INFO spawned: 'php-fpm' with pid 8

A 2019-09-29T09:00:26Z 2019-09-29 09:00:26,094 INFO spawned: 'nginx' with pid 9

A 2019-09-29T09:00:26Z 2019/09/29 09:00:26 [notice] 9#9: using the "epoll" event method

A 2019-09-29T09:00:26Z 2019/09/29 09:00:26 [notice] 9#9: nginx/1.10.3 (Ubuntu)

A 2019-09-29T09:00:26Z 2019/09/29 09:00:26 [notice] 9#9: OS: Linux 4.14.137+

A 2019-09-29T09:00:26Z 2019/09/29 09:00:26 [notice] 9#9: getrlimit(RLIMIT_NOFILE): 1048576:1048576

A 2019-09-29T09:00:26Z 2019/09/29 09:00:26 [notice] 9#9: start worker processes

A 2019-09-29T09:00:26Z 2019/09/29 09:00:26 [notice] 9#9: start worker process 10

A 2019-09-29T09:00:26Z [29-Sep-2019 09:00:26] NOTICE: fpm is running, pid 8

A 2019-09-29T09:00:26Z [29-Sep-2019 09:00:26] NOTICE: ready to handle connections

A 2019-09-29T09:00:27Z 2019-09-29 09:00:27,419 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

A 2019-09-29T09:00:27Z 2019-09-29 09:00:27,419 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

A 2019-09-29T09:00:36Z 2019-09-29 09:00:36,718 CRIT Supervisor running as root (no user in config file)

A 2019-09-29T09:00:36Z 2019-09-29 09:00:36,718 WARN No file matches via include "/etc/supervisor/conf.d/*.conf"

A 2019-09-29T09:00:36Z 2019-09-29 09:00:36,728 INFO supervisord started with pid 1

A 2019-09-29T09:00:37Z 2019-09-29 09:00:37,730 INFO spawned: 'php-fpm' with pid 8

A 2019-09-29T09:00:37Z 2019-09-29 09:00:37,734 INFO spawned: 'nginx' with pid 9

A 2019-09-29T09:00:37Z 2019/09/29 09:00:37 [notice] 9#9: using the "epoll" event method

A 2019-09-29T09:00:37Z 2019/09/29 09:00:37 [notice] 9#9: nginx/1.10.3 (Ubuntu)

A 2019-09-29T09:00:37Z 2019/09/29 09:00:37 [notice] 9#9: OS: Linux 4.14.137+

A 2019-09-29T09:00:37Z 2019/09/29 09:00:37 [notice] 9#9: getrlimit(RLIMIT_NOFILE): 1048576:1048576

A 2019-09-29T09:00:37Z 2019/09/29 09:00:37 [notice] 9#9: start worker processes

A 2019-09-29T09:00:37Z 2019/09/29 09:00:37 [notice] 9#9: start worker process 10

A 2019-09-29T09:00:38Z [29-Sep-2019 09:00:38] NOTICE: fpm is running, pid 8

A 2019-09-29T09:00:38Z [29-Sep-2019 09:00:38] NOTICE: ready to handle connections

A 2019-09-29T09:00:39Z 2019-09-29 09:00:39,076 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

A 2019-09-29T09:00:39Z 2019-09-29 09:00:39,076 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

A 2019-09-29T09:12:00Z 2019-09-29 09:11:59,763 WARN received SIGTERM indicating exit request

A 2019-09-29T09:12:00Z 2019-09-29 09:12:00,056 INFO waiting for nginx, php-fpm to die

A 2019-09-29T09:12:00Z 2019/09/29 09:12:00 [notice] 9#9: signal 15 (SIGTERM) received, exiting

A 2019-09-29T09:12:00Z 2019/09/29 09:12:00 [notice] 10#10: exiting

A 2019-09-29T09:12:00Z 2019/09/29 09:12:00 [notice] 9#9: signal 14 (SIGALRM) received

A 2019-09-29T09:12:00Z 2019/09/29 09:12:00 [notice] 9#9: signal 14 (SIGALRM) received

A 2019-09-29T09:12:00Z 2019/09/29 09:12:00 [notice] 9#9: signal 14 (SIGALRM) received

A 2019-09-29T09:12:00Z 2019/09/29 09:12:00 [notice] 10#10: exit

A 2019-09-29T09:12:00Z 2019/09/29 09:12:00 [notice] 9#9: signal 14 (SIGALRM) received

A 2019-09-29T09:12:00Z 2019/09/29 09:12:00 [notice] 9#9: signal 17 (SIGCHLD) received

A 2019-09-29T09:12:00Z 2019/09/29 09:12:00 [notice] 9#9: worker process 10 exited with code 0

A 2019-09-29T09:12:01Z 2019/09/29 09:12:00 [notice] 9#9: exit

A 2019-09-29T09:12:01Z 2019-09-29 09:12:01,152 INFO stopped: nginx (exit status 0)

A 2019-09-29T09:12:01Z [29-Sep-2019 09:12:01] NOTICE: Terminating ...

A 2019-09-29T09:12:01Z [29-Sep-2019 09:12:01] NOTICE: exiting, bye-bye!

A 2019-09-29T09:12:01Z 2019-09-29 09:12:01,739 INFO stopped: php-fpm (exit status 0)

A 2019-09-29T09:13:18Z 2019-09-29 09:13:18,511 WARN received SIGTERM indicating exit request

A 2019-09-29T09:13:18Z 2019-09-29 09:13:18,770 INFO waiting for nginx, php-fpm to die

A 2019-09-29T09:13:18Z 2019/09/29 09:13:18 [notice] 9#9: signal 15 (SIGTERM) received, exiting

A 2019-09-29T09:13:18Z 2019/09/29 09:13:18 [notice] 10#10: exiting

A 2019-09-29T09:13:18Z 2019/09/29 09:13:18 [notice] 9#9: signal 14 (SIGALRM) received

A 2019-09-29T09:13:18Z 2019/09/29 09:13:18 [notice] 9#9: signal 14 (SIGALRM) received

A 2019-09-29T09:13:19Z 2019/09/29 09:13:18 [notice] 10#10: exit

A 2019-09-29T09:13:19Z 2019/09/29 09:13:19 [notice] 9#9: signal 14 (SIGALRM) received

A 2019-09-29T09:13:19Z 2019/09/29 09:13:19 [notice] 9#9: signal 14 (SIGALRM) received

A 2019-09-29T09:13:19Z 2019/09/29 09:13:19 [notice] 9#9: signal 17 (SIGCHLD) received

A 2019-09-29T09:13:19Z 2019/09/29 09:13:19 [notice] 9#9: worker process 10 exited with code 0

A 2019-09-29T09:13:19Z 2019/09/29 09:13:19 [notice] 9#9: exit

A 2019-09-29T09:13:19Z 2019-09-29 09:13:19,738 INFO stopped: nginx (exit status 0)

A 2019-09-29T09:13:19Z [29-Sep-2019 09:13:19] NOTICE: Terminating ...

A 2019-09-29T09:13:19Z [29-Sep-2019 09:13:19] NOTICE: exiting, bye-bye!

A 2019-09-29T09:13:20Z 2019-09-29 09:13:20,565 INFO stopped: php-fpm (exit status 0)

A 2019-09-29T09:42:28Z 172.17.0.5 - - [29/Sep/2019:09:42:28 +0000] "GET / HTTP/1.1" 500 1570 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"

A 2019-09-29T09:42:28.759Z GET 500 1.53 KiB 2.8 s Chrome 77 / GET 500 1.53 KiB 2.8 s Chrome 77 
A 2019-09-29T09:42:29.002621440Z GET 200 0 B 0 ms Chrome 77 /favicon.ico GET 200 0 B 0 ms Chrome 77 
A 2019-09-29T09:43:29Z 2019/09/29 09:43:29 [info] 10#10: *1 client 172.17.0.5 closed keepalive connection


1 Ответ

0 голосов
/ 30 сентября 2019

Если вы посмотрите страницу Connecting из App Engine в облачной документации SQL, вы увидите, что вам необходимо добавить следующее в app.yaml

beta_settings:
  cloud_sql_instances: <INSTANCE_CONNECTION_NAME>
* 1006.* Это то, что позволит вам использовать /cloudsql/INSTANCE_CONNECTION_NAME сокет домена Unix.
...