How to migrate out of the Adobe Commerce Cloud to Magento 2 AWS CLOUD!
YOU need to install the Magento Cloud CLI:
1. Install the magento-cloud
CLI.
curl -sS https://accounts.magento.cloud/cli/installer | php
2. Add magento-cloud
CLI to the bash profile.
export PATH=$PATH:$HOME/.magento-cloud/bin
3. To initiate the CLI, call magento-cloud
and enter your Cloud account credentials when prompted.
magento-cloud
Welcome to Magento Cloud! Please log in using your Magento Cloud account. Your email address or username:
4. After login into the cloud, ssh into the environment, executing and following instructions
magento-cloud ssh
Or you can simply use SSH.
And what you need it is just 2 command:
#Copy Files
zip -r --exclude=*pub/media/* --exclude=*pub/static/* --exclude=*.nvm* --exclude=*var/* pub/media/magento.zip .
or tar.gz
tar -pczf magento.tar.gz --warning=no-file-changed exclude “*/pub/media/*” --exclude “*/pub/static/*” --exclude “*/var/*” --exclude “*.zip” --exclude “*.sql” --exclude “*.tar*” --exclude “*/app/etc/env.php*” --exclude “*.gz*” --exclude “*.tgz” .
#Dump DataBase
php -r '$c=include("./app/etc/env.php"); print_r($t=$c["db"]["connection"]["default"]); echo "\n\nTo Quit Magento Cloud you need this command:\n\n mysqldump -h ".$t["host"]." -u ".$t["username"]." -p".$t["password"]." ".$t["dbname"]." | gzip > pub/media/dump.sql.gz\n\n";'
Also you can use the next command just to get Mysql connection command:
php -r '$c=include("./app/etc/env.php"); print_r($t=$c["db"]["connection"]["default"]); echo "\n\nMagento Mysql Connect:\n\n mysql -h ".$t["host"]." -u ".$t["username"]." -p".$t["password"]." ".$t["dbname"]."\n\n";'
You will see the output you need to copy and paste this code :
To Quit Magento Cloud, you need this command:
mysqldump -h 127.0.0.1 -u user -ppassword database | gzip > pub/media/dump.sql.gz
only pub/media is writable and accessible, so you can copy everything and download it to another server using whet or curl
wget htttps://domain/media/magento.zip
wget htttps://domain/media/dump.sql.gz
After you can use this automated script to install Magento 2 AWS or another cloud, provide a server. Graviton 2 processor is also supported.
The only thing you need to do is run:
sudo bash install-all.sh
and import/copy your code and database and code.
After you need undump code and database.
sudo rm -rf /var/www/html/magento/*
unzip magento.zip -d /var/www/html/magento/gzip -d dump.sql.gzmysql -e 'drop database magento2'mysql -e 'create database magento2'mysql magento2 < dump.sql
And change site core_config_seettings.
mysql -e'UPDATE core_config_data set value = "http://sfsdfsd/" where path like "web/%/base_url"'mysql -e'UPDATE core_config_data set value = "http://ssdfsdf/" where path like "web/%/base_link_url"mysql -e'UPDATE core_config_data set value = "0" where path like "%web/secure/use_in%"'mysql -e'UPDATE core_config_data set value = "https://www.doamin-production.com/media/" where path like "web/%/base_media_url"'
We need also to reindex ElasticSearch:
bin/magento indexer:reindex catalogsearch_fulltext
and
bin/magento setup:upgrade
bin/magento setup:di:compile
composer dump -o --apcu
bin/magento setup:static-content:deploy
Using this extension, you don’t need to use Varnish outdated software for the FPC page came. It makes management of Magento easier no buggy proxy anymore!
https://github.com/Genaker/FastFPC