Install Docker & docker-compose on Ubuntu 20.04

Install with one command: curl -sL https://magenaut.com/getdocker | bash Or follow the below steps. 1. Install Docker on Ubuntu 20.04 sudo apt-get update sudo apt install docker.io sudo systemctl enable –now docker sudo usermod -aG docker $USER newgrp docker 2. Install docker-compose on Ubuntu 20.04 sudo apt-get install curl sudo curl -L “https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)” … Read more

Use OpenVPN for server but keep incoming connections

I need to fake IP of current webserver using OpenVPN that installed on another server. The problem is it will block all incoming connections to my webserver ( 80, 443, and 22 for example). First, I need to force the incoming packets to be routed over its public interface: sudo ip rule add from $(ip … Read more

Magento 2 log rotation with logrotate

Why? Log rotation is an automated process to remove or archive old and big log files. More information here. Magento 2 log files get bigger every day, it may take too much space and slow down your server. In fact, you can backup and delete Magento log files, but it’s better if there’s an automated … Read more

Fix Magento 2 cron_schedule catalog_product_attribute_value_synchronize error

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magento2`.`catalog_product_entity_datetime`, CONSTRAINT `CAT_PRD_ENTT_DTIME_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CAS), query was: INSERT INTO catalog_product_entity_datetime(attribute_id, store_id, entity_id, `value`) VALUES (:attribute_id0,:store_id0,:entity_id0,:value0) ON duplicate KEY UPDATE `value` = VALUES(`value`) The problem Cron schedule return status error when processing … Read more

Magento ON-DEMAND courses are now free until June 30th, 2020

magento2 training overview magenaut blog

Update 2020-08-20 If you already added the free courses, you can still visit and learn them for free via this URL: https://cpcontents.adobe.com/public/newlearner/newlearner_1369e616.html   Today I’ve just discovered the Magento 2 courses for newbies are now free (again). It worth $2500 but it’s now free until June 30th, 2020. If you are new with Magento 2 … Read more

Environment variables from docker-compose .env to Dockerfile

1. Declare the variables in .env PHPFPM_IMAGE=php:7.2-fpm USER_ID=1000 2. Pass the variables to Dockerfile using args in docker-compose.yml version: '3' services: app: build: context: . dockerfile: Dockerfile args: PHPFPM_IMAGE: ${PHPFPM_IMAGE} USER_ID: ${USER_ID} 3. Use the keyword ARG to receive the variables in Dockerfile # ARG to use WITH "FROM" ARG PHPFPM_IMAGE FROM $PHPFPM_IMAGE # ARG … Read more

Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\App\ExceptionHandlerInterface

Environment: PHP 7.2 Magento 2.3.4 1. The error Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\App\ExceptionHandlerInterface in /var/www/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:50 Stack trace: #0 /var/www/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create(‘Magento\\Framewo…’) #1 /var/www/vendor/magento/framework/App/Http.php(100): Magento\Framework\ObjectManager\ObjectManager->get(‘Magento\\Framewo…’) #2 /var/www/generated/code/Magento/Framework/App/Http/Interceptor.php(14): Magento\Framework\App\Http->__construct(Object(Magento\Framework\App\ObjectManager), Object(Magento\Framework\Event\Manager), Object(Magento\Framework\App\AreaList), Object(Magento\Framework\App\Request\Http), Object(Magento\Framework\App\Response\Http\Interceptor), Object(Magento\Framework\App\ObjectManager\ConfigLoader), Object(Magento\Framework\App\State), Object(Magento\Framework\Registry), NULL) #3 /var/www/vendor/magento/framework/ObjectManager/Factory/Abs in /var/www/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 50 This error is caused by missing abstraction-implementation mapping in app/etc/di.xml. 2. Added this line … Read more

M2 development with Docker

The story Although I have tried so many docker-compose projects, I didn’t find any project that matches my requirement: Uses only Official Images. Simply enough to setup/modify. No extra deployment step from host to containers after changing the code. So I have created a docker-compose project. Below are the reasons for you to use or … Read more

Fix Error: Notice: Array to string conversion

Problem The site is using the Amasty Product Feed extension. If you set the Schedule and trying to save feed profiles: Unable to save feed with ID xx. Error: Notice: Array to string conversion in /magento_dir/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 3105 My environment: PHP 7.2 Magento 2.3.3 Amasty Product Feed 2.5.1 Temporary solution Although I updated the extension … Read more