Giter Site home page Giter Site logo

vardot / varbase-updater Goto Github PK

View Code? Open in Web Editor NEW
6.0 7.0 4.0 171 KB

Varbase Updater: A set of scripts and tools that will help you to update to the newer versions of Varbase.

Home Page: https://docs.varbase.vardot.com/updating-varbase

License: GNU General Public License v3.0

PHP 81.23% Shell 18.77%
varbase drupal8 drupal update automation auto-updater auto-upgrade upgrade composer

varbase-updater's Introduction

Varbase Updater: Making Varbase Updates Easier

A set of scripts and tools that will help you to update to the newer versions of Varbase.

Install with Composer

If you're using Varbase 8.6.2 or older, install varbase-updater through Composer.

composer require vardot/varbase-updater

If you're using Varbase 8.6.3 or newer, skip this step; varbase-updater comes pre-installed with your Varbase project.

Run the Updater

Updating Varbase is best done through Composer. We will assume that you have installed Varbase the recommended way through the Composer-based project template varbase-project.

This will create the Varbase project directory that will look like this: /path/to/YOUR_PROJECT with the Drupal 8 codebase installed via Varbase installation profile in /path/to/YOUR_PROJECT/docroot.

Follow the these commands to run the updater after you have installed it:

  1. From a command prompt window, navigate to your project: cd /path/to/YOUR_PROJECT

  2. Run the Varbase update tool. ./bin/update-varbase.sh

  3. Follow the wizard.

Lear more on this Varbase documentation site: https://docs.varbase.vardot.com/updating-varbase#option-1-automated-process-using-varbase-updater

varbase-updater's People

Contributors

das-peter avatar giloliveira avatar moerazem avatar natshah avatar waleedq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

varbase-updater's Issues

Add a new step to updater config from 8.4.28 to 8.6.3

I suggest adding a new step to updater config json file when updating from 8.4.28 to 8.6.3.
I faced many problems with media entity and varbase media dependencies.

So, we can add the below:

"8.4.28": {
    "from": "8.4.28",
    "to": "8.6.3",
    "packages": {
      "crucial": {
        "drupal/varbase_media": "6.2",
        "drupal/media_entity": "2.0-beta3",
        "vardot/entity_browser_generic_embed": "8.1.x-dev"
      }
    .
    .
    .
    .
    .
    .

Fix update-vabase.sh still invokes drush entup

drush entup still used in updated

drush entup is deprecated a while now. Yesterday I updated Varbase and noticed that the command is still in update-varbase.sh This command should be removed or at least commented out to make sure there is no error message anymore when updating Varbase the correct way.

varbase-updater.sh runs

$DRUSH  entity-updates --yes;

several times

it should be enough to just comment it out by replacing the line with

#$DRUSH  entity-updates --yes;
'``
so the error will not be shown anymore and the code is still persitent

Fix issue with Composer ~2.0 on 2 abstract methods and must therefore be declared abstract or implement the remaining methods


PHP Fatal error:  Class vardot\Composer\Plugin\VarbaseUpdater contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Composer\Plugin\PluginInterface::deactivate, Composer\Plugin\PluginInterface::uninstall) in /var/www/html/dev/varbase9c2/vendor/vardot/varbase-updater/src/Plugin/VarbaseUpdater.php on line 32

Fatal error: Class vardot\Composer\Plugin\VarbaseUpdater contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Composer\Plugin\PluginInterface::deactivate, Composer\Plugin\PluginInterface::uninstall) in /var/www/html/dev/varbase9c2/vendor/vardot/varbase-updater/src/Plugin/VarbaseUpdater.php on line 32


Explicitly call out the fact that the script deletes ScriptHandler.php

In the cleanup() function, the ScriptHandler.php file is removed. Our original composer.json came from drupal-composer, which still uses this file. Having it present in the composer file, like below, causes the updater to fail.

"autoload": {
  "classmap": [
    "scripts/composer/ScriptHandler.php"
  ],
}

I suggest adding this to the documentation. Just a few sentences letting the developer know about the issue and preventing the updater from proceeding until it's resolved.

I didn't look very far into it, but I'm assuming that classmaps are handled now. From what I saw, drupal-composer is a bit behind the curve on that particular feature.

Update the Varbase Updater ( Auto updater ) to auto update Varbase 8.8.11 sites to Varbase 9.0.1

Varbase 9.0.0 stable was released 29 Jun 2021 at 13:28 EEST
https://www.drupal.org/project/varbase/releases/9.0.0

To automate more of the manual work on updates

For example to update the composer.json file from 8.8.11 to 9.0.0

https://github.com/Vardot/varbase-project/blob/8.8.11/composer.json

https://github.com/Vardot/varbase-project/blob/9.0.0/composer.json

  • Manage removed modules
  • Manage new added and enabled modules

Change the logic for composer project json url and use latest if it was listed in the update rule config

Use "to" as for the source for the target composer

{
  "profile": "varbase",
  "package": "vardot/varbase",
  "8.4.*": {
    "from": "8.4.*",
    "to": "8.4.28"
  },
  "8.4.28": {
    "from": "8.4.28",
    "to": "8.6.3",
    "packages": {
      "crucial": {
        "drupal/varbase_carousels": "6.0",
        "drupal/entity_browser": "2.0",
        "drupal/video_embed_field": "2.0",
        "drupal/varbase_media": "6.2",
        "drupal/media_entity": "2.0-beta3",
        "vardot/entity_browser_generic_embed": "8.1.x-dev",
        "drupal/panelizer": "4.1"
      }
    },
    "skip":[
      "media_entity_document",
      "media_entity_image"
    ],
    "enable-after-update":[
      "entity_browser_generic_embed"
    ]
  },
  "8.5.*": {
    "from": "8.5.*",
    "to": "8.5.5"
  },
  "8.5.5": {
    "from": "8.5.5",
    "to": "8.6.3",
    "packages": {
      "crucial": {
        "drupal/varbase_carousels": "6.0",
        "drupal/entity_browser": "2.0",
        "drupal/video_embed_field": "2.0",
        "drupal/varbase_media": "6.2",
        "drupal/media_entity": "2.0-beta3",
        "vardot/entity_browser_generic_embed": "8.1.x-dev",
        "drupal/panelizer": "4.1"
      }
    },
    "skip":[
      "media_entity_document",
      "media_entity_image"
    ],
    "enable-after-update":[
      "entity_browser_generic_embed"
    ]
  },
  "8.6.*": {
    "from": "8.6.*",
    "to": "8.6.12"
  },
  "8.6.12": {
    "from": "8.6.12",
    "to": "8.7.0",
    "skip":[
      "media_entity_googledocs"
    ]
  },
  "8.7.*": {
    "from": "8.7.*",
    "to": "8.7.*",
    "composer-project-json-url": "latest"
  }
}

Add drush entity update to updater wizard

I think we should add
drush entup before running update database (drush updb) to clear up any mismatched entity and/or field definitions and to fix changes were detected in the entity type and field definitions.

Detect tput support

I'm running the varbase updater through docker, which isn't explicitly requiring the tput app.

I looking into this and it seems this was a drush issue years ago, they sovled it by adding
detection to the script.

https://www.drupal.org/project/drush/issues/1840712

Sample output:


 __   __  _______  ______    __   __  _______
|  | |  ||   _   ||    _ |  |  | |  ||       |
|  |_|  ||  |_|  ||   | ||  |  | |  ||    _  |
|       ||       ||   |_||_ |  |_|  ||   |_| |
|       ||       ||    __  ||       ||    ___|
 |     | |   _   ||   |  | ||       ||   |
  |___|  |__| |__||___|  |_||_______||___|
/var/www/html/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 24: tput: command not found
/var/www/html/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 24: tput: command not found
Varbase Updater

/var/www/html/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 27: tput: command not found
/var/www/html/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 27: tput: command not found
Please choose your Drupal installation folder. Type the folder name or hit enter to choose the default one: (web): 

/var/www/html/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 177: tput: command not found

You are on the latest vardot/varbase version. No updates are required.
/var/www/html/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 179: tput: command not found

/var/www/html/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 180: tput: command not found
/var/www/html/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 180: tput: command not found
This command will guide you to update your Varbase project.

/var/www/html/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 182: tput: command not found
/var/www/html/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 182: tput: command not found
/var/www/html/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 182: tput: command not found
The update process will go through several tasks to update your Drupal core and modules. Please run this script on a development environment.
/var/www/html/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 183: tput: command not found
/var/www/html/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 183: tput: command not found
 	
/var/www/html/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 184: tput: command not found
/var/www/html/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 184: tput: command not found
The command will go through the following steps:
/var/www/html/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 185: tput: command not found
/var/www/html/vendor/vardot/varbase-updater/scripts/update/varbase-updater.sh: line 185: tput: command not found
 	 1. Backup your current installation (code and database)

[Suggestion] Detect and Handle Drupal Paranoia

The updater will work, but it needs to detect the app dir. I'm sure there is a better way, but I just added an extra if, doing a regex match on the composer.json file would be better, matching against the config directives to get things rolling.

Composer:

{
  "require": {
    "drupal-composer/drupal-paranoia": "^1",
  },
  "extra": {
    "drupal-paranoia": {
      "app-dir": "app",
      "web-dir": "web",
      "excludes": []
    },
  }
}

varbase-updater.sh: (line 12)

COMPOSERJSON="$(< inputfile)"
[[ "$COMPOSERJSON" =~ drupal-paranoia ]] && PARANOIA=1 || PARANOIA=0
if [$PARANOIA == 1 && -d "${BASEDIR}/app"]; then
  DRUPALPATH='app';
fi

Issue in Ubuntu Linux /.update-error-log and /update_backups Permission denied

Please choose your Drupal installation folder. Type the folder name or hit enter to choose the default one: (docroot):
web

Please install composer-patches package from Vardot's repository to catch and handle errors when applying patches.
Updating vardot/varbase (8.4.21) to vardot/varbase (8.4.28)

This command will guide you to update your Varbase project.

The update process will go through several tasks to update your Drupal core and modules. Please run this script on a development environment.

The command will go through the following steps:

  1. Backup your current installation (code and database)
  2. Cleanup and update your composer.json to prepare for Varbase updates
  3. Update Varbase using (composer update)
  4. Enable some required modules before running Drupal database updates
  5. Update Drupal database for latest changes (drush updatedb)
  6. Write log files and perform some cleanups

The update process will go through several tasks to update your Drupal core and modules. Please run this script on a development environment.
Do you want to start the update process? (yes):
yes
touch: cannot touch '/.update-error-log': Permission denied
./bin/update-varbase.sh: line 209: /.update-error-log: Permission denied
Do you want to create a backup snapshot before starting the update process? (yes):

Preparing a backup snapshot before performing updates...
mkdir: cannot create directory ‘/update_backups’: Permission denied

Add Final Target version to prepare for the next Update step

In update-config.json

  "8.8.10": {
    "from": "8.8.10",
    "to": "8.8.11",
    "final_target_version": "~8.0",
    "composer-project-json-url": "8.8.11"
  },
  "8.8.11": {
    "from": "8.8.11",
    "to": "9.0.1",
    "final_target_version": "~9.0",
    "composer-project-json-url": "9.0.1",
    "packages": {
      "crucial": {
        "drupal/varbase_layout_builder": "~9.0"
      }
    },
    "skip":[
      "vartheme",
      "vartheme_admin",
      "adminimal_admin_toolbar",
      "libraries",
      "libraries_ui",
      "smtp",
      "media_library_theme_reset",
      "color_field",
      "features",
      "l10n_client",
      "tour_builder",
      "webform_analysis",
      "mail_edit"
    ]
  },
  "9.0.0": {
    "from": "9.0.0",
    "to": "9.0.1",
    "final_target_version": "~9.0",
    "composer-project-json-url": "9.0.1"
  },
  "9.0.1": {
    "from": "9.0.1",
    "to": "9.0.1",
    "final_target_version": "~9.0",
    "composer-project-json-url": "9.0.1"
  }

So that at the Final Target version in the composer can be

    "require": {
 ....
        "vardot/varbase": "~9.0",
  .....

    },

Not

"vardot/varbase": "~9.0.1",

Add git config --global --add safe.directory for vendor/drupal/coder not to let Git 2.35 block the automated update process

Git security vulnerability announced
https://github.blog/2022-04-12-git-security-vulnerability-announced/
for Git 2.35

Git 2.36

Stricter repository ownership checks
https://github.blog/2022-04-18-highlights-from-git-2-36/#stricter-repository-ownership-checks

Latest source Release
Git 2.37.1 went out too - Release Notes (2022-07-04)

safe.directory
These config entries specify Git-tracked directories that are considered safe even if they are owned by someone other than the current user. By default, Git will refuse to even parse a Git config of a repository owned by someone else, let alone run its hooks, and this config setting allows users to specify exceptions, e.g. for intentionally shared repositories (see the --shared option in git-init[1]).

A system with the latest version of git may face a blocker issue on update
If the maintainer of the project did not yet add the drupal coder to the safe directory list
Listing ~/.gitconfig

[user]
        name = Rajab Natshah
        email = [email protected]
[http]
        version = HTTP/2
[safe]
        directory = /var/www/html/products/project_browser
        directory = /var/www/html/products/varbase
        directory = /var/www/html/products/varbase_core
        directory = /var/www/html/products/varbase_api
        directory = /var/www/html/products/vartheme_bs4
        directory = /var/www/html/products/vartheme_bs5
        directory = /var/www/html/products/varbase_layout_builder
        directory = /var/www/html/test/varbase906t1/vendor/drupal/coder

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.