I am trying to deploy my Laravel 7.29.3 app to Google App Engine Standard environment. I have followed the guided located here https://cloud.google.com/community/tutorials/run-laravel-on-appengine-standard. However, I get a View[Welcome] not found error when I view my deployment. My app.yaml file looks like below:
runtime: php72 env_variables: ## Put production environment variables here. APP_KEY: YOUR_APP_KEY APP_STORAGE: /tmp VIEW_COMPILED_PATH: /tmp SESSION_DRIVER: cookie
Its a very simple yaml file as I am only using the welcome view and a route to a contact page. Please note that I am not using any database in this version. Please see my routing below:
<?php use IlluminateSupportFacadesRoute; /* |-------------------------------------------------------------------------- | Web Routes |-------------------------------------------------------------------------- | | Here is where you can register web routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | contains the "web" middleware group. Now create something great! | */ Route::get('/', function () { return view('welcome'); }); Route::post('contact', 'ContactFormController@ContactForm');
I also reviewed this question here: View [welcome] not found but I am still getting the same error. From my understanding of @sllopis comment, I need to put my welcome.blade.php file in a layouts folder. I have done that, and still get the same error. Any assistance would be appreciated.
Thanks
Advertisement
Answer
I have found the solution. First you can add handlers to your app.yaml file. It should look like below:
runtime: php72 handlers: - url: /(.*.(gif|png|jpg|css|js))$ static_files: public/1 upload: public/.*.(gif|png|jpg|css|js)$ - url: /.* secure: always redirect_http_response_code: 301 script: auto env_variables: ## Put production environment variables here. APP_KEY: YOUR_APP_KEY APP_STORAGE: /tmp VIEW_COMPILED_PATH: /tmp SESSION_DRIVER: cookie
Source: https://stackoverflow.com/a/57822141/2251229
Then you can update your config/filesystems.php file. You can add a new file system as per the sample provided below.
'gcs' => [ 'driver' => 'gcs', 'project_id' => env('GOOGLE_CLOUD_PROJECT_ID', 'your-project-id'), 'key_file' => env('GOOGLE_CLOUD_KEY_FILE', null), // optional: /path/to/service-account.json 'bucket' => env('GOOGLE_CLOUD_STORAGE_BUCKET', 'your-bucket'), 'path_prefix' => env('GOOGLE_CLOUD_STORAGE_PATH_PREFIX', null), // optional: /default/path/to/apply/in/bucket 'storage_api_uri' => env('GOOGLE_CLOUD_STORAGE_API_URI', null), // see: Public URLs below 'visibility' => 'public', // optional: public|private ],
And then update your default file system like so:
'default' => env('FILESYSTEM_DRIVER', 'gcs'),
Install the Laravel Google Cloud Storage package using the below command:
composer require superbalist/laravel-google-cloud-storage
Source: https://stackoverflow.com/a/57177913/2251229
From here you can do your gcloud app deploy
, and gcloud app browse
. If you get further errors, do php artisan config:clear
. This should clear any cached configurations.