Utkarsh
Utkarsh

Reputation: 60

ERROR: (gcloud.app.deploy) Your application does not satisfy all of the requirements for a runtime of type [php74]

I am trying to deploy a laravel application using the gcloud shell, I have completed the setup,

In the app.yaml the content is as below

runtime: php74
env: flex

runtime_config:
    document_root: ./public/

handlers:
    - url: /
      static_dir: public

env_variables:
   APP_KEY: ***APP_KEY***
   APP_DEBUG: true
   APP_STORAGE: /tmp
   VIEW_COMPILED_PATH: /tmp
   SESSION_DRIVER: cookie
   CACHE_DRIVER: file
   DB_CONNECTION: mysql
   DB_PORT: 3306
   DB_DATABASE: *********
   DB_USERNAME: *********
   DB_PASSWORD: ***********
   DB_SOCKET: "*****************"

My Composer.json is as follows:

{
    "name": "lavalite/cms",
    "description": "The Lavalite - CMS based on laravel.",
    "keywords": ["framework", "laravel", "lavalite", "cms"],
    "license": "MIT",
    "type": "cms",
    "require": {
        "php": "^7.2",
        "fideloper/proxy": "^4.0",
        "laravel/framework": "^6.0",
        "laravel/helpers": "^1.1",
        "laravel/tinker": "^1.0",
        "lavalite/framework": "^5.1",
        "litecms/admin": "^5.1",
        "litecms/block": "4.2.*",
        "litecms/blog": "^2.0",
        "litecms/client": "^5.1",
        "litecms/contact": "4.2.*",
        "litecms/page": "4.2.*",
        "litecms/public": "^5.1",
        "twilio/sdk": "^5.0"
    },
    "require-dev": {
        "facade/ignition": "^1.4",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^3.0",
        "phpunit/phpunit": "^8.0"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "composer/installers": true
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
                "anahkiasen/former",
                "fideloper/proxy",
                "intervention/image",
                "laravel/socialite",
                "laravel/tinker",
                "mcamara/laravel-localization",
                "nunomaduro/collision",
                "prettus/l5-repository",
                "spatie/laravel-activitylog",
                "spatie/laravel-backup"
            ]
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Buyesrfolio\\Claim\\": "packages/buyesrfolio/claim/src",
            "Buyesrfolio\\Reviews\\": "packages/buyesrfolio/reviews/src",
            "Buyesrfolio\\Leads\\": "packages/buyesrfolio/leads/src"

        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "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"
        ]
    }
}

Also I have developed the application in laravel 6 and php7.4 on my local system. While deploying I am getting an error: ERROR: (gcloud.app.deploy) Your application does not satisfy all of the requirements for a runtime of type [php74]

Any help will be appreciated .

Upvotes: 1

Views: 931

Answers (2)

Wouter Doornbos
Wouter Doornbos

Reputation: 124

Got it to work! You need to create a new project (in another data center). Try deploying from your console with the command gcloud deploy.

Change your config.yaml to:

runtime: php
env: flex

runtime_config:
    document_root: public

automatic_scaling:
  min_num_instances: 1
  max_num_instances: 2
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10

And make sure to have in your composer.json:

"require": {
    "php": "^7.3|^8.0"
}

Upvotes: 2

Andres Fiesco Casasola
Andres Fiesco Casasola

Reputation: 801

Your app.yaml needs to have the following structure according to this Google document:

runtime: php
env: flex

runtime_config:
  document_root: web

# This sample incurs costs to run on the App Engine flexible environment.
# The settings below are to reduce costs during testing and are not appropriate.
# For production use and more information, see:
# https://cloud.google.com/appengine/docs/flexible/php/configuring-your-app-with-app-yaml
manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10

Here, app.yaml specifies the runtime used by the app, and sets env: flex, specifying that the app uses the flexible environment.

By default, the PHP runtime uses PHP 7.3, but you have to explicitly declare your PHP version in the composer.json file to prevent your application from being automatically upgraded when a new version of PHP becomes available. The PHP version 7.2.* is also supported.

{
    "require": {
        "php": "7.3.*"
    }
}

in your app.yamlfile, just use runtime: php:

runtime: php
env: flex

Upvotes: 0

Related Questions