1

When does command setup:upgrade run after the code is deployed to production environment Is there any option to enable this configuration, and schedule when to run this command or it will run automatically when my code is deployed

1

Im afraid you cant do that on cloud. The deployment is automatic by ece-tools package . [Cloud Info]

enter image description here ece-tools package

The ece-tools package is a scalable deployment tool that simplifies the Cloud upgrade process. In 2018, we deprecated the magento-cloud-configuration and ece-patches packages in favor of providing a single package. We encourage all customers to upgrade to use ece-tools as soon as possible to benefit from the package features, such as commands to create a backup of the database, apply custom patches, and verify environment configuration.

More info for ece-tools Link

If you do some findings in your repo . Open .magento.app.yaml and you will see this

hooks:
    # We run build hooks before your application has been packaged.
    build: |
        php ./vendor/bin/ece-tools build
    # We run deploy hook after your application has been deployed and started.
    deploy: |
        php ./vendor/bin/ece-tools deploy
    # We run post deploy hook to clean and warm the cache. Available with ECE-Tools 2002.0.10.
    post_deploy: |
        php ./vendor/bin/ece-tools post-deploy

The execution function of setup upgrade is in this path :

vendor/magento/ece-tools/src/Process/Deploy/InstallUpdate/Update/Setup.php
public function execute()
    {
        $this->flagManager->delete(FlagManager::FLAG_REGENERATE);

        try {
            $verbosityLevel = $this->stageConfig->get(DeployInterface::VAR_VERBOSE_COMMANDS);

            $this->logger->info('Running setup upgrade.');

            $this->shell->execute(sprintf(
                '/bin/bash -c "set -o pipefail; %s | tee -a %s"',
                'php ./bin/magento setup:upgrade --keep-generated --ansi --no-interaction ' . $verbosityLevel,
                $this->fileList->getInstallUpgradeLog()
            ));
        } catch (\RuntimeException $e) {
            //Rollback required by database
            throw new \RuntimeException($e->getMessage(), 6);
        }

        $this->flagManager->delete(FlagManager::FLAG_REGENERATE);
    }
  • So is it the default behaviour or do I need to configure something in magento.app.yml manually – summu Feb 7 at 15:17
  • It is the default behaviour :( , not sure talking with their support if they can arrange smth about you, – Ylgen Guxholli Feb 7 at 15:31
0

No, commands never run automatically.

Only crons run automatically and repeated if configured correctly.

setup:upgrade should not be a cron!!!!

You have to call it manually within your deployment.

  • Its in cloud, magento2 cloud – summu Feb 7 at 10:10
0

In Magento Cloud its run automatically like Yigen said, but sometimes is delay after deploy.

So if you want to update database now just run this command on server. Its same like in: vendor/magento/ece-tools/src/Process/Deploy/InstallUpdate/Update/Setup.php

php ./bin/magento setup:upgrade --keep-generated --ansi --no-interaction

Files are read only but this command in not regenerating any files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.