Skip to content

Latest commit

 

History

History
391 lines (322 loc) · 25.4 KB

UPGRADE.md

File metadata and controls

391 lines (322 loc) · 25.4 KB

UPGRADING

There is a list of all the repositories maintained by monorepo, changes in log below are ordered as this list:

  • #494 Microservices webserver using nginx + php-fpm
    • execute docker-compose pull to pull new microservice images and docker-compose up -d to start newly pulled microservices
    • url addresses to microservices have changed, you need to upgrade url address provided in app/config/parameters.yml
      • update parameter microservice_product_search_url from microservice-product-search:8000 to microservice-product-search
      • update parameter microservice_product_search_export_url, from microservice-product-search-export:8000 to microservice-product-search-export
  • #502 - fixed acceptance tests (loading DB dump)
    • when you upgrade codeception/codeception to version 2.5.0, you have to change parameter populate to true in tests/ShopBundle/Acceptance/acceptance.suite.yml
  • #468 - Setting for docker on mac are now more optimized
    • if you use the Shopsys Framework with docker on the platform Mac, modify your docker-compose.yml and docker-sync.yml according to the new templates
    • next restart docker-compose and docker-sync
  • #483 - updated info about Docker on Mac
    • if you use Docker for Mac and experience issues with composer install resulting in Killed status, try increasing the allowed memory
    • we recommend to set 2 GB RAM, 1 CPU and 2 GB Swap in Docker -> Preferences… -> Advanced
  • check for usages of TransportEditFormType - it was removed and all it's attributes were moved to TransportFormType so use this form instead
  • check for usages of PaymentEditFormType - it was removed and all it's attributes were moved to PaymentFormType so use this form instead
  • check for usages of ProductEditFormType - it was removed and all it's attributes were moved to ProductFormType so use this form instead
  • pay attention to javascripts bound to your forms as well as the elements' names and ids has changed (e.g. from #product_edit_form_productData to #product_form)
  • PHP-FPM and microservice containers now expect a GitHub OAuth token set via a build argument, so it is not necessary to provide it every time those containers are rebuilt
  • as there were changes in the Dockerfiles, rebuilding images is needed (docker-compose up -d --build)
  • #438 - Attribute telephone moved from a billing address to the personal data of a user
    • this change can affect your extended forms and entities, reflect this change into your project
  • Microservice Product Search Export was added and it needs to be installed and run
    • check changes in the docker-compose.yml template you used and replicate them, there is a new container microservice-product-search-export
    • parameters.yml.dist contains new parameter microservice_product_search_export_url which need to be filled in your parameters.yml (executing composer install should be enough)
  • instead of building the Docker images of the microservices yourself, you can use pre-built images on Docker Hub (see the docker-compose.yml template you used)
  • #438 - Attribute telephone moved from a billing address to the personal data of a user
    • edit ShopBundle/Form/Front/Customer/BillingAddressFormType - remove telephone
    • edit ShopBundle/Form/Front/Customer/UserFormType - add telephone
    • edit twig templates and tests in such a way as to reflect the movement of telephone attribute according to the pull request
  • to use custom postgres configuration check changes in the docker-compose.yml templates and replicate them, there is a new volume for postgres container
    • PR Improve Postgres configuration to improve performance
    • Stop running containers docker-compose down
    • Move data from project-base/var/postgres-data into project-base/var/postgres-data/pgdata. The directory must have correct permission depending on your OS. To provide you with a better image of what exactly needs to be done, there are instructions for Ubuntu:
      • sudo su
      • cd project-base/var/postgres-data/
      • trick to create directory pgdata with correct permissions
        • cp -rp base/ pgdata
        • rm -fr pgdata/*
      • shopt -s extglob dotglob
      • mv !(pgdata) pgdata
      • shopt -u dotglob
      • exit
    • Start containers docker-compose up -d
  • configuration files (config.yml, config_dev.yml, config_test.yml, security.yml and wysiwyg.yml) has been split into packages config files (see app/config/packages folder)
    • update appropriate package configs in case you had some custom configuration set in those files
  • when upgrading your installed monorepo, you'll have to change the build context for the images of the microservices in docker-compose.yml
    • build.context should be the root of the microservice (eg. microservices/product-search-export)
    • build.dockerfile should be docker/Dockerfile
    • execute docker-compose up -d --build, microservices should be up and running
  • for product search via Elasticsearch, you'll have to:
    • check changes in the docker-compose.yml template you used and replicate them, there is a new container with Elasticsearch
    • run docker-compose up -d
    • update composer dependencies composer update
    • create Elasticsearch indexes by running php phing elasticsearch-indexes-create
    • export products into Elasticsearch by php phing elasticsearch-products-export
  • since the fully installed and ready Microservice Product Search is a necessary condition for the Shopsys Framework to run, the installation procedure of this microservice is a part of Shopsys Framework installation guide

PostgreSQL upgrade:

We decided to move onto a newer version of PostgreSQL.

These steps are for migrating your data onto newer version of postgres and are inspired by official documentation:

If you are running your project natively then just follow official instructions, if you are using docker infrastructure you can follow steps written below.

  1. create a backup of your database by executing::

    docker exec -it shopsys-framework-postgres pg_dumpall > backupfile

  2. copy new version of docker-compose.:

    cp docker/conf/docker-compose.yml.dist -f docker-compose.yml

    Note: select correct docker-compose according to your operating system

  3. update version of database_server_version from 9.5 to 10.5 in your parameters.yml

  4. stop containers and delete old data:

    docker-compose down

    rm -rf <project-root-path>/var/postgres-data/*

  5. start new docker-compose stack with newer version of postgres by just recreating your containers:

    docker-compose up -d --force-recreate

  6. copy backup into postgres container root folder

    docker cp backupfile shopsys-framework-postgres:/

  7. restore you data:

    docker exec -it shopsys-framework-postgres psql -d postgres -f backupfile

  8. delete backup file:

    docker exec -it shopsys-framework-postgres rm backupfile

  • added Microservice Product Search
    • check changes in the docker-compose.yml template you used and replicate them, there is a new container microservice-product-search
    • parameters.yml.dist contains new parameter microservice_product_search_url
    • modify a configuration in services.yml for:
      • Shopsys\FrameworkBundle\Model\Product\Search\ProductSearchRepository
      • shopsys.microservice_client.product_search
    • remove a configuration in services.yml for:
      • Shopsys\FrameworkBundle\Model\Product\Search\ElasticsearchSearchClient
      • Shopsys\FrameworkBundle\Model\Product\Search\CachedSearchClient
      • Shopsys\FrameworkBundle\Model\Product\Search\SearchClient
  • standardize indentation in your yaml files
    • you can find yaml files with wrong indentation with regexp ^( {4})* {1,3}[^ ]
  • move creation of data objects into factories
  • already existing data object factories changed their signatures
  • to change the last item in admin breadcrumb, use BreadcrumbOverrider:overrideLastItem(string $label) instead of Breadcrumb::overrideLastItem(MenuItem $item)
  • if you've customized the admin menu by using your own admin_menu.yml, implement event listeners instead
  • move creation of data objects into factories
  • already existing data object factories changed their signatures
  • move creation of data objects into factories
  • already existing data object factories changed their signatures
  • move creation of data objects into factories
  • already existing data object factories changed their signatures
  • classes in src/Components were revised, refactored and some of them were moved to model, for upgrading to newer version, you must go through commits done in #272 and reflect the changes of namespaces.
  • FriendlyUrlToGenerateRepository: deleted. If you want to define your own data for friendly url generation, do it so by implementing the FriendlyUrlDataProviderInterface and tag your service with shopsys.friendly_url_provider.
  • check changes in src/Model, all editData.php were merged into its Data.php relatives
  • Twig has been updated to version 2.4.8
  • access multi-domain attributes of entities via their main entity (instead of the usual entity detail)
  • DomainsType now uses array of booleans indexed by domain IDs instead of array of domain IDs, original behavior can be restored by adding model data transformer IndexedBooleansToArrayOfIndexesTransformer
  • CategoryDomain::$hidden was changed to CategoryDomain::$enabled along with related methods (with negated value)
  • PaymentDomain and TransportDomain are now created even for domains on which the entity should not be visible, check your custom queries that work with payments or transports
  • instead of using EntityManagerFacade::clear() call clear() directly on the EntityManager
  • all *Detail classes were removed:
    • use CategoryWithLazyLoadedVisibleChildren instead of LazyLoadedCategoryDetail
    • use CategoryWithLazyLoadedVisibleChildrenFactory::createCategoriesWithLazyLoadedVisibleChildren() instead of CategoryDetailFactory::createLazyLoadedDetails()
    • use CategoryFacade::getCategoriesWithLazyLoadedVisibleChildrenForParent() instead of CategoryFacade::getVisibleLazyLoadedCategoryDetailsForParent()
    • use CategoryWithPreloadedChildren instead of CategoryDetail
    • use CategoryWithPreloadedChildrenFactory::createCategoriesWithPreloadedChildren() instead of CategoryDetailFactory::createDetailsHierarchy()
    • use CategoryFacade::getVisibleCategoriesWithPreloadedChildrenForDomain() instead of CategoryFacade::getVisibleCategoryDetailsForDomain()
    • use PaymentFacade::getIndependentBasePricesIndexedByCurrencyId() instead of PaymentDetail::$basePricesByCurrencyId
    • use TransportFacade::getIndependentBasePricesIndexedByCurrencyId() instead of TransportDetail::$basePricesByCurrencyId
    • ProductDetail::hasContentForDetailBox() is not available anymore (it was useless)
    • use ProductCachedAttributesFacade for accessing product parameter values and selling price
    • in templates, use Twig function getProductParameterValues(product) instead of productDetail.parameters
    • in templates, use Twig function getProductSellingPrice(product) instead of productDetail.sellingPrice
  • create your custom easy-coding-standard.yml in your project root with your ruleset (you can use predefined ruleset as shown below)
  • in order to run all checks, there is new unified way - execute php vendor/bin/ecs check /path/to/project
  • see EasyCodingStandard docs for more information

Example of custom configuration file

#easy-coding-standard.yml
imports:
    - { resource: '%vendor_dir%/shopsys/coding-standards/easy-coding-standard.yml' }
parameters:
    exclude_files:
        - '*/ignored_folder/*'
    skip:
        ObjectCalisthenics\Sniffs\Files\FunctionLengthSniff:
            - '*/src/file.php'
  • check changes in the docker-compose.yml template you used, there were a couple of important changes you need to replicate
    • easiest way is to overwrite your docker-compose.yml with by the appropriate template
  • on *nix systems, fill your UID and GID (you can run id -u and id -g to obtain them) into Docker build arguments www_data_uid and www_data_gid and rebuild your image via docker-compose up --build
  • change owner of the files in shared volume to www-data from the container by running docker exec -u root shopsys-framework-php-fpm chown -R www-data /var/www/html
    • the user has shared UID, so you will be able to access it as well from the host machine
    • shared volume with postgres data should be owned by postgres user: docker exec -u root shopsys-framework-php-fpm chown -R postgres /var/www/html/var/postgres-data
  • if you were using a mounted volume to share Composer cache with the container, change the target directory from /root/.composer to /home/www-data/.composer
    • in such case, you should change the owner as well by running docker exec -u root shopsys-framework-php-fpm chown -R www-data /home/www-data/.composer

Before monorepo

Before we managed to implement monorepo for our packages, we had slightly different versions for each of our package, that's why is this section formatted differently.

From 0.4.2 to 0.5.0

From 0.4.0 to 0.4.1

From 0.2.0 to 0.4.0

From 0.1.0 to 0.2.0

From 0.4.0 to 0.4.1

From 0.3.0 to 0.4.0

From 0.1.0 to 0.2.0

From 0.2.0 to 0.2.1

From 0.1.1 to 0.2.0

From 0.4.0 to 0.5.0

  • implement method getMainCategoryId() in your implementations of StandardFeedItemInterface.

From 0.3.0 to 0.4.0

  • implement method isSellingDenied() for all implementations of StandardFeedItemInterface.
  • you have to take care of filtering of non-sellable items in implementations of FeedConfigInterface::processItems() in your product feed plugin because the instances of StandardFeedItemInterface passed as an argument can be non-sellable now.
  • implement method getAdditionalInformation() in your implementations of FeedConfigInterface.
  • implement method getCurrencyCode() in your implementations of StandardFeedItemInterface.

From 0.2.0 to 0.3.0

  • remove method getFeedItemRepository() from all implementations and usages of FeedConfigInterface.

From 0.1.0 to 0.2.0

  • Rename all implementations and usages of FeedItemInterface::getItemId() to getId().
  • Rename all implementations and usages of FeedItemCustomValuesProviderInterface to HeurekaCategoryNameProviderInterface.
  • If you are using custom values in your implementation, you need to implement interfaces from package shopsys/plugin-interface (see how to work with data storage interface).

From 0.2.0 to 0.3.0

  • all implementations of DataStorageInterface now must have implemented method getAll() for getting all saved data indexed by keys

From 2.0.0-beta.21.0 to 7.0.0-alpha1

  • manual upgrade from this version will be very hard because of BC-breaking extraction of shopsys/framework
    • at this moment the core is not easily extensible by your individual functionality
    • before upgrading to the new architecture you should upgrade to Dockerized architecture of 2.0.0-beta.21.0
    • the upgrade will require overriding or extending of all classes now located in
      shopsys/framework that you customized in your forked repository
    • it would be wise to wait with the upgrade until the newly build architecture has matured
  • update custom tests to be compatible with phpunit 7. For further details visit phpunit release announcements phpunit 6 and phpunit 7

From 2.0.0-beta.20.0 to 2.0.0-beta.21.0

  • do not longer use Phing targets standards-ci and standards-ci-diff, use standards and standards-diff instead

From 2.0.0-beta.17.0 to 2.0.0-beta.18.0

  • use SimpleCronModuleInterface and IteratedCronModuleInterface from their new namespace Shopsys\Plugin\Cron (instead of Shopsys\FrameworkBundle\Component\Cron)

From 2.0.0-beta.16.0 to 2.0.0-beta.17.0

  • coding standards for JS files were added, make sure phing eslint-check passes
    (you can run phing eslint-fix to fix some violations automatically)

From 2.0.0-beta.15.0 to 2.0.0-beta.16.0

  • all implementations of Shopsys\ProductFeed\FeedItemRepositoryInterface must implement interface Shopsys\FrameworkBundle\Model\Feed\FeedItemRepositoryInterface instead
  • parameter email_for_error_reporting was renamed to error_reporting_email_to in app/config/parameter.yml.dist,
    you will be prompted to fill it out again during composer install
  • all implementations of StandardFeedItemInterface must implement methods isSellingDenied() and getCurrencyCode(), see product-feed-interface

From 3.x to 4.0

  • In order to run all checks, there is new unified way - execute php vendor/bin/ecs check /path/to/project --config=vendor/shopsys/coding-standards/easy-coding-standard.neon
Example of custom configuration file
Version 3.x and lower
// custom phpcs-fixer.php_cs
<?php

$originalConfig = include __DIR__ . '/../vendor/shopsys/coding-standards/build/phpcs-fixer.php_cs';

$originalConfig->getFinder()
    ->exclude('_generated');

return $originalConfig;
Version 4.0 and higher
#custom-coding-standard.neon
includes:
    - vendor/symplify/easy-coding-standard/config/psr2-checkers.neon
    - vendor/shopsys/coding-standards/shopsys-coding-standard.neon
parameters:
    exclude_files:
        - *_generated/*