Install Guide for Magento 2 CE/EE + Pacemaker Community Edition (CE) + example data step by step

In this Quickstart Tutorial, you will find detailed information about Pacemaker - Simple Console Tool installation and usage.

To give you a better impression, what is possible with Pacemaker Community Edition (CE), we are running an example that is based on a Magento 2 CE/EE Sample Data installation.

Follow the steps to delete, replace and add/update products + categories in a Magento 2 CE/EE installation with the Sample Data provided by Magento 2 CE/EE.

  • You can find the sources for Magento 2 CE/EE 2 on the Magento 2 CE/EE website

  • It is best practice to download the complete package directly from the Magento 2 CE/EE website

  • Under the precondition that you have a running Magento 2 CE/EE system, follow the instructions in the Magento 2 CE/EE guide to install your current Magento 2 CE/EE instance

Step 1: Install Magento 2 CE/EE >= 2.3 using composer

  • Requirements for a successful local Magento 2 CE/EE installation in the current version:

    • Composer

    • PHP >= 7.3

    • Local server to host a local instance

    • Local HTTPS support

    • If nessary, a Magento Marketplace Account to access the Magento Repository is needed as well

    • Follow the installation steps recommended by Magento 2 CE/EE to set up a Magento 2 CE/EE instance locally successfully

Step 2: Create database recommended by Magento 2 CE/EE without the official Magento 2 CE/EE example data as a blank installation

# navigate into your magento working directory
cd <magento-install-dir>

# create the magento database tables
bin/magento setup:install \
--admin-firstname Admin \
--admin-lastname Developer \
--admin-email johndoe@m241ce-pacemaker-exampledata.test \
--admin-user admin \
--admin-password admin123 \
--base-url https://m241ce-pacemaker-exampledata.test/ \
--db-host 127.0.0.1:3307 \
--db-name my-local-magento-instance \
--db-user root --db-password root --use-rewrites 1 \
--backend-frontname admin \
--currency EUR --timezone Europe/Berlin \
--cleanup-database

Step 3: Set up a local host for your instance to access the installation via browser

  • Depending on your local development environment you use (Nginx…​..), set up a locally accessable host

  • e.g. https://m241ce-pacemaker-exampledata.test/

Step 4: [ Optional! ] - Create additional Websites/Stores/Storeviews if needed

  • If required, now is the time to create all nessary Store Websites/Stores/Store View

Step 5: Install Pacemaker and sample data

Add the repository with the sample data to your Magento 2 CE/EE installation by running the following command:

Step 6: Create required folders

<magento-install-dir>/pub/media/catalog if not exists

# navigate into your magento working directory
cd <magento-install-dir>

# create the directories catalog and product at once
mkdir pub/media/catalog

# or as shortcut command
composer require techdivision/import-cli-simple \
&& composer require techdivision/import-sample-data

The Pacemaker Community CLI well as the Sample Data files for your Magento 2 CE/EE version should now be available under the <magento-install-dir>/vendor/bin/techdivision/import-cli-simple and <magento-install-dir>/vendor/bin/techdivision/import-sample-data directories.

  • Additionally, the product images can be linked in the Magento media directory

By default, the images are not copied to the media directory; they can be linked to make them visible in the frontend after importing the products. That can be done by creating symlinks to access the example data images

# navigate into your magento working directory
cd <magento-install-dir>

# create symlink to the product image files
ln -s vendor/techdivision/import-sample-data/generic/media/catalog/product \
pub/media/catalog/product

Step 8: Running the import

  • Suppose this is the first import, which we expect, the default import directory <magento-install-dir>/var/importtexport must be created first

  • All files with the sample data (attribute sets, attributes, categories, and products) need to be copied into this directory

The command for the import of the sample data plus the images looks like following:

# navigate into your magento working directory
cd <magento-install-dir>

# create the importexport directory
mkdir var/importexport

# copy all files to forlder importexport
cp vendor/techdivision/import-sample-data/generic/data/attributes-set/add-update/*.csv var/importexport \
&& cp vendor/techdivision/import-sample-data/generic/data/attributes/add-update/*.csv var/importexport \
&& cp vendor/techdivision/import-sample-data/generic/data/categories/add-update/*.csv var/importexport \
&& cp vendor/techdivision/import-sample-data/generic/data/products/add-update/*.csv var/importexport

# start import
vendor/bin/import-simple import:create:ok-file \
&& vendor/bin/import-simple import:attributes:set \
&& vendor/bin/import-simple import:attributes \
&& vendor/bin/import-simple import:categories \
&& vendor/bin/import-simple import:products

Only if a ok flag file is available in the same directory where the CSV files are located, the import process will start

The naming convention for the ok flag file must follow one of these naming conventions:

  • <IMPORT-DIRECTORY>/<PREFIX>.ok

  • <IMPORT-DIRECTORY>/<PREFIX>_<FILENAME>.ok

  • <IMPORT-DIRECTORY>/<PREFIX>_<FILENAME>_<COUNTER>.ok

which results in one of

  • import-cli-simple/projects/sample-data/tmp/magento-import.ok

  • import-cli-simple/projects/sample-data/tmp/magento-import_20170203.ok

  • import-cli-simple/projects/sample-data/tmp/magento-import_20170203_01.ok

In case we have got a Bunch , the flag file must contain the name of the CSV files that have to be imported within the next iterations.

If the flag file would be named <magento-install-dir>/var/importexport/product-import_20161021-161909.ok for example and contains the following lines:

  • product-import_20161021-161909_01.csv

  • product-import_20161021-161909_02.csv

  • product-import_20161021-161909_03.csv

  • product-import_20161021-161909_04.csv

The importer has to be invoked four times (because the example above is no Bunch ), whereas, on each innovation, the next file will be imported and removed from the flag file.

Take a look in the subdirectories of <magento-install-dir>/vendor/bin/techdivision/import-sample-data/ for a working examples.

Step 9: Add Missing Indexes

As the Pacemaker Community Edition (CE) functionality differs from the Magento 2 standard, for performance reasons, it is necessary to add some essential indexes manually.

To do that, open a MySQL command line or MySql-Tool of your choice (e.g. Sequel Ace), connect to your MySQL server instance and enter the following SQL statement

When using the Magic 360 component, additional the following indexes need to be added

ALTER TABLE `eav_attribute_option_value` ADD INDEX `EAV_ATTRIBUTE_OPTION_VALUE_VALUE` (`value` ASC); \
ALTER TABLE `catalog_product_entity_int` ADD INDEX `CATALOG_PRODUCT_ENTITY_INT_VALUE` (`value` ASC); \
ALTER TABLE `catalog_product_entity_varchar` ADD INDEX `CATALOG_PRODUCT_ENTITY_VARCHAR_VALUE` (`value` ASC); \
ALTER TABLE `catalog_product_entity_decimal` ADD INDEX `CATALOG_PRODUCT_ENTITY_DECIMAL_VALUE` (`value` ASC); \
ALTER TABLE `catalog_product_entity_datetime` ADD INDEX `CATALOG_PRODUCT_ENTITY_DATETIME_VALUE` (`value` ASC); \
ALTER TABLE `url_rewrite` ADD INDEX `URL_REWRITE_ENTITY_ID` (`entity_id` ASC); \
ALTER TABLE `url_rewrite` ADD INDEX `URL_REWRIRE_ENTITY_TYPE_ENTITY_ID` (`entity_id` ASC, `entity_type` ASC); \
ALTER TABLE `catalog_product_entity_media_gallery` ADD INDEX `CATALOG_PRODUCT_ENTITY_MEDIA_GALLERY_VALUE` (`value`);

Step 10: Clean up

  • To see the imported data, call following commands:

# navigate into your magento working directory
cd <magento-install-dir>

bin/magento indexer:reindex
bin/magento c:f

# or as one command
bin/magento indexer:reindex && bin/magento c:f

Final Result

  • Following all steps, here the final result of a fully functional Magento Shop including Pacemaker Community Edition (CE) example data

ce usecases install exampledata