0

I have the above error in my API. I am using Laravel version 8 and I deployed the API on the Google Cloud App Engine.

I followed the directions of this tutorial. I am trying to store a generated file in the /tmp folder and upload it to Google Cloud Storage. Following the tutorial to Set up Stackdriver Logging and Error Reporting but I got

There is no existing directory at ".../storage/logs" and it could not be created: Read-only file system

Please I have very little DevOps knowledge and I appreciate any help you can offer.

This is my app.yaml file

runtime: php73

env_variables:
  ## Put production environment variables here.
  LOG_CHANNEL: stackdriver
  APP_KEY: my_app_key
  APP_STORAGE: /tmp
  VIEW_COMPILED_PATH: /tmp
  SESSION_DRIVER: cookie

In my filesystems.php file I set the symbolic link to the /tmp folder

'links' => [
        public_path('storage') => storage_path('/tmp'),
],

and this is my composer.json file

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.3|^8.0",
        "ext-json": "*",
        "barryvdh/laravel-dompdf": "^0.9.0",
        "dompdf/dompdf": "^1.0",
        "fideloper/proxy": "^4.4",
        "fruitcake/laravel-cors": "^2.0",
        "google/cloud-error-reporting": "^0.18.3",
        "google/cloud-logging": "^1.21",
        "google/cloud-storage": "^1.23",
        "guzzlehttp/guzzle": "^7.0.1",
        "laravel/framework": "^8.12",
        "laravel/tinker": "^2.5"
    },
    "require-dev": {
        "facade/ignition": "^2.5",
        "fakerphp/faker": "^1.9.1",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.2",
        "nunomaduro/collision": "^5.0",
        "phpunit/phpunit": "^9.3.3"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ],
        "post-install-cmd": [
            "composer dump-autoload",
            "@php artisan config:clear",
            "@php artisan config:cache"
        ]
    }
}

aghwotu
  • 402
  • 6
  • 12
  • 1
    it seems similar to this [question](https://stackoverflow.com/q/59511828/8753991) – JM Gelilio Apr 20 '21 at 20:08
  • Yes, @JohnMichaelGelilio you are right, but, I could not find a solution there. I have tried changing the permission in the ```composer.json``` file. The tutorial referenced ```laravel version 5.4``` and I am seeking someone who has deployed it with a later version. I have very little cloud knowledge. – aghwotu Apr 20 '21 at 20:43

1 Answers1

0

GAE doesn't have access to the local files/storage in Standard environment and would usually give an error of Read-only file system in such situations.

Since you are following an official Google Tutorial which is for GAE Standard, confirm that the path $app->useStoragePath(env('APP_STORAGE', base_path() . '/storage')); (from the tutorial) in your code, actually points to a path on google cloud env and not your local file structure.

NoCommandLine
  • 5,044
  • 2
  • 4
  • 15