我的Laravel 6.0应用在Google App Engine上运行良好,直到我将数据库与Cloud SQL集成。
我对app.yaml
文件进行了一些更改,设置了第二代MySQL实例并部署了相同的应用程序。但是,我现在面临500 Internal Server Error。日志没有解释发生了什么。我在这里想念什么?
这是用于部署应用程序的最终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
答案 0 :(得分:0)
如果您查看Cloud SQL文档中的Connecting from App Engine页,将会看到需要在app.yaml
中添加以下内容
beta_settings:
cloud_sql_instances: <INSTANCE_CONNECTION_NAME>
这就是使您能够使用/cloudsql/INSTANCE_CONNECTION_NAME
Unix域套接字的原因。