6
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Laravel5.8をGAE Standard環境にデプロイする

Last updated at Posted at 2019-03-23

色々エラーが出たのでやり方をメモっておく
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
6
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?