Laravel项目gcloud应用程序部署失败 [英] Laravel project gcloud app deploy failed

查看:214
本文介绍了Laravel项目gcloud应用程序部署失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在将第一个幼虫项目部署到Google Cloud时遇到问题.

I have problem in deploying my first larval project to Google Cloud.

如果我的问题很愚蠢,请发表温柔的评论.我不是PHP开发人员,甚至不是Web开发人员.我只是想对其进行测试并在此问题上停留超过1天.

我创建了一个幼虫项目,其中包含小型数据库和少量CRUD宁静的api.我在本地对Postman进行了测试,并且工作正常. 因此,我想上传到服务器,然后选择带有App Engine的Google云端存储. 我点击了此链接- https://cloud.google.com /community/tutorials/run-laravel-on-appengine-flexible

I created one larval project with small database and few CRUD restful api. I tested with Postman in local and it is working fine. So I would like to upload to server and I choose Google Cloud Storage with App Engine. I followed this link - https://cloud.google.com/community/tutorials/run-laravel-on-appengine-flexible

我可以通过调用 http://MY_PROJECT_ID.appspot.com

我通过调用我的get api http://MY_PROJECT_ID.appspot.com/users

I got error by calling my get api, http://MY_PROJECT_ID.appspot.com/users

所以我认为我需要设置数据库.我遵循上面提到的链接中的说明设置数据库会话" .

So I thought I need to setup database. I follow instruction "Setup Database Session" from above link that I mentioned.

此后,我打电话给 gcloud app deploy --project [MY_PROJECT_ID]
然后出现以下错误:

After that I called gcloud app deploy --project [MY_PROJECT_ID]
Then I got this following error:

[06-Mar-2018 03:36:44 UTC] [2018-03-06 03:36:44] production.ERROR: SQLSTATE[HY000] [2002] No such file or directory {"exception":"[object] (Doctrine\\DBAL\\Driver\\PDOException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory at /app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:47, PDOException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory at /app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43)"} []
Step #1: [06-Mar-2018 03:36:44 UTC] [2018-03-06 03:36:44] production.ERROR: SQLSTATE[HY000] [2002] No such file or directory (SQL: delete from `cache`) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory (SQL: delete from `cache`) at /app/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664, Doctrine\\DBAL\\Driver\\PDOException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory at /app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:47, PDOException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory at /app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43)"} []
Step #1: 
Step #1: In Connection.php line 664:
Step #1:                                                                                
Step #1:   SQLSTATE[HY000] [2002] No such file or directory (SQL: delete from `cache`)  
Step #1:                                                                                
Step #1: 
Step #1: In PDOConnection.php line 47:
Step #1:                                                     
Step #1:   SQLSTATE[HY000] [2002] No such file or directory  
Step #1:                                                     
Step #1: 
Step #1: In PDOConnection.php line 43:
Step #1:                                                     
Step #1:   SQLSTATE[HY000] [2002] No such file or directory  
Step #1:                                                     
Step #1: 
Step #1: Script php artisan cache:clear handling the post-install-cmd event returned with error code 1
Step #1: The command '/bin/sh -c /build-scripts/composer.sh' returned a non-zero code: 1
Finished Step #1
ERROR
ERROR: build step 1 "gcr.io/cloud-builders/docker@sha256:5ebcd6cbf6e0a0279e25f8a1c73ae87f7d601fbb86f29a34a82110bd81249722" failed: exit status 1

我什至不知道哪一步错了.错误日志显示错误在脚本 php artisan cache:clear 中,因此我单独调用此命令,它运行良好.我可以感觉到有些或很多事情是错误的. 我希望有人可以向我指出出了什么问题.

I even don't know which step was wrong. Error log shows error is in script php artisan cache:clear, so I call this command individually and it is working well. I can feel some or many things are wrong. I was hoping that someone can point it out to me what was wrong.

推荐答案

我解决了这个问题,在app.yaml文件中将CACHE_DRIVER的值从数据库"更改为文件".

I solved this problem changing in the app.yaml file the value of CACHE_DRIVER from "database" to "file".

当值设置为数据库"并且gcloud应用程序部署功能运行php artisan cache:clear(在composer.json中表示为post-install-cmd)时,它将执行查询以删除缓存"表上. 但就我而言,我想在您的情况下,我们使用缓存文件而不是数据库表.

When the value is set to "database" and the gcloud app deploy function run the php artisan cache:clear (indicated as post-install-cmd in composer.json) this will exec a query to delete the cache in a "cache" table on the database. But in my case and i guess also in yours we use a cache file and not a database table.

相同的问题和相同的解决方案对于将SESSION_DRIVER值更改为文件"的会话也有效.

The same problem and the same solution works for session changing SESSION_DRIVER value to "file".

这篇关于Laravel项目gcloud应用程序部署失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆