色々エラーが出たのでやり方をメモっておく
https://cloud.google.com/community/tutorials/run-laravel-on-appengine-standard
プロジェクト作成
# 5.8を指定してlaravelプロジェクト作成
$ composer create-project laravel/laravel projectName --prefer-dist "5.8.*"
$ cd projectName
app.yaml
instanceを指定せず、デフォルトのF1のままだと展開は出来てもメモリ不足?でエラーが出るのでF4を指定している
app.yaml
runtime: php72
instance_class: F4
env_variables:
APP_LOG: errorlog
APP_KEY: YOUR_APP_KEY
APP_STORAGE: /tmp
SESSION_DRIVER: cookie
.gcloudignore
.gcloudignore
# This file specifies files that are *not* uploaded to Google Cloud Platform
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
# $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files
# from your .gitignore file, remove the corresponding line
# below:
.git
.gitignore
# PHP Composer dependencies:
/vendor/
コード追加/編集
config/view.php
// compiledの部分を修正
'compiled' => storage_path(),
bootstrap/app.php
// 追加
$app->useStoragePath(env('APP_STORAGE', base_path() . '/storage'));
composer.json修正
gcp-buildを入れないとdevパッケージが入ってしまう
composer.json
"scripts": {
"post-install-cmd": [
"chmod -R 755 bootstrap\/cache",
"php artisan cache:clear"
],
"gcp-build": [
"composer install --no-dev"
]
}
YOUR_APP_KEY変換
$ sed -i '' "s#YOUR_APP_KEY#$(php artisan key:generate --show --no-ansi)#" app.yaml
展開
$ gcloud app deploy -q