### Install Baler using Git and npm Source: https://docs.webscale.com/reference/stratus/guides/magento-2/using-baler These commands are used to clone the Baler repository and install its Node.js dependencies. Ensure you have Node.js version 10.12.0 or later installed. This is the initial setup phase for the Baler tool itself. ```bash git clone https://github.com/magento/baler.git cd baler npm install ``` -------------------------------- ### Install SupervisorD for Python 2.7 Source: https://docs.webscale.com/reference/stratus/guides/webscale-stratus/using-supervisord Installs SupervisorD for Python 2.7.x environments. It requires pip to install setuptools and supervisor, and downloads a configuration file. It also involves creating symlinks for binary files and optionally creating/editing a start.sh script. This is only possible on PHP 7.4 and above. ```shell pip install --target=/srv/.local/lib/python2.7/site-packages/ setuptools supervisor mkdir -p /srv/supervisord cd /srv/supervisord; wget -c https://raw.githubusercontent.com/magemojo/m2-patches/main/supervisord.conf cd ~/.local; ln -s /srv/.local/lib/python2.7/site-packages/bin/ bin; /srv/.local/bin/supervisord -c /srv/supervisord/supervisord.conf mkdir -p /srv/pwa cd /srv/pwa touch start.sh ; chmod a+rwx start.sh pip install setuptools supervisor /srv/.local/bin/supervisord -c /srv/supervisord/supervisord.conf ``` -------------------------------- ### Install SupervisorD for Python 3.7 Source: https://docs.webscale.com/reference/stratus/guides/webscale-stratus/using-supervisord Installs SupervisorD for Python 3.7.x environments. It requires pip3 to install setuptools and supervisor, and downloads a configuration file. It also involves creating symlinks for binary files and optionally creating/editing a start.sh script. This is only possible on PHP 7.4 and above. ```shell pip3 install --target=/srv/.local/lib/python3.7/site-packages/ setuptools supervisor mkdir -p /srv/supervisord cd /srv/supervisord; wget -c https://raw.githubusercontent.com/magemojo/m2-patches/main/supervisord.conf cd ~/.local; ln -s /srv/.local/lib/python3.7/site-packages/bin/ bin; /srv/.local/bin/supervisord -c /srv/supervisord/supervisord.conf mkdir -p /srv/pwa cd /srv/pwa touch start.sh ; chmod a+rwx start.sh pip3 install setuptools supervisor /srv/.local/bin/supervisord -c /srv/supervisord/supervisord.conf ``` -------------------------------- ### Install Magento 2 Source: https://docs.webscale.com/reference/stratus/guides/webscale-stratus/stratus-cli Installs the latest version of the Magento 2 codebase. Warning: This action will permanently delete all existing data and replace the codebase. ```bash /usr/share/stratus/cli magento.install ``` -------------------------------- ### Backup Magento Database via SSH Source: https://docs.webscale.com/reference/stratus/guides/webscale-stratus/go-live-on-stratus Provides example commands for backing up a Magento database using mysqldump and n98-magerun2. Requires SSH access and database credentials. ```bash #example database dump commands mysqldump -uUSERNAME -pPASSWORD DATABASENAME > migrate.sql ``` ```bash #with n98 n98-magerun2 db:dump ``` -------------------------------- ### Copy PWA Studio Example Venia Source: https://docs.webscale.com/reference/stratus/guides/pwa-configuration This command copies the PWA Studio example Venia shell script to the /srv/pwa directory. For Magento versions higher than 2.4.3, the script is automatically copied and executed. For older versions, manual copying and editing of the script are required before execution to ensure correct PWA Studio and NVM installation. ```bash cp /usr/share/stratus/pwa-example-venia.sh /srv/pwa-example-venia.sh ``` -------------------------------- ### Get Help for STRATUS CLI Source: https://docs.webscale.com/reference/stratus/guides/webscale-stratus/stratus-cli Displays a list of all available STRATUS CLI commands along with their descriptions. This is the primary command for understanding CLI functionality. ```bash /usr/share/stratus/cli help ``` -------------------------------- ### Download and Install Restic on Linux Source: https://docs.webscale.com/reference/stratus/guides/general/backup-strategies Downloads the Restic binary for Linux amd64, decompresses it, renames it to 'restic', and grants execute permissions. This is a prerequisite for using Restic. ```shell $ wget https://github.com/restic/restic/releases/download/v0.9.6/restic_0.9.6_linux_amd64.bz2 $ bzip2 -d restic_0.9.6_linux_amd64.bz2 $ mv restic_0.9.6_linux_amd64 restic $ chmod u+x restic ``` -------------------------------- ### Connect to Existing Magento Server via SSH Source: https://docs.webscale.com/reference/stratus/guides/webscale-stratus/go-live-on-stratus Demonstrates how to connect to an existing Magento server using SSH. Includes standard SSH login, login with a private key, and login with a custom port. ```bash ssh myuser@mycurrenthost.com ``` ```bash #with key ssh -i /path/to/keyfile myuser@mycurrenthost.com ``` ```bash #with custom port ssh -p 1234 myuser@mycurrenthost.com ``` -------------------------------- ### Start Cron Jobs Source: https://docs.webscale.com/reference/stratus/guides/webscale-stratus/stratus-cli Starts the cron job scheduler, enabling scheduled tasks to run again after being stopped. ```bash /usr/share/stratus/cli crons.start ``` -------------------------------- ### Configure Magento 1 local.xml Database Credentials Source: https://docs.webscale.com/reference/stratus/guides/webscale-stratus/go-live-on-stratus Example XML configuration for Magento 1's local.xml file, detailing how to set database connection parameters including hostname, username, password, and database name. ```xml 1 ``` -------------------------------- ### Run Magento 2 Deployment Processes Source: https://docs.webscale.com/reference/stratus/guides/magento-2/using-baler These commands trigger various Magento 2 deployment tasks, including upgrading the setup, compiling dependency injection, and deploying static content. These are standard procedures after installing or enabling new modules in Magento. ```bash n98-magerun2 setup:upgrade n98-magerun2 setup:di:compile n98-magerun2 setup:static-content:deploy ``` -------------------------------- ### Install Terser Globally via npm Source: https://docs.webscale.com/reference/stratus/guides/magento-2/using-terser Installs the Terser JavaScript minifier globally on your system using npm. This makes the Terser command-line tool available system-wide. Ensure Node.js and npm are installed and updated. ```bash npm install terser -g ``` -------------------------------- ### Verify Terser Installation and Path Source: https://docs.webscale.com/reference/stratus/guides/magento-2/using-terser Commands to verify the successful installation of Terser and determine its executable path. These commands confirm that Terser is accessible from your system's command line. ```bash $ node -v v17.3.0 $ npm install terser -g added 6 packages, and audited 7 packages in 687ms found 0 vulnerabilities $ whereis terser terser: /usr/local/nvm/versions/node/v17.3.0/bin/terser ``` -------------------------------- ### List PHP Options Source: https://docs.webscale.com/reference/stratus/guides/webscale-stratus/stratus-cli Displays a list of the current PHP configuration settings applied to the environment. ```bash /usr/share/stratus/cli php.options.list ``` -------------------------------- ### Upgrade Magento from 2.3.x to 2.4.x Source: https://docs.webscale.com/reference/stratus/guides/magento-2/magento-2-upgrade-recommendations Commands for upgrading a Magento installation from a 2.3.x version to a 2.4.x version. This process requires specific Composer commands to manage root updates and product editions, along with increased memory limits for Composer operations and subsequent Magento setup, compilation, and deployment steps. ```shell php -d memory_limit=4096M /usr/local/bin/composer require magento/composer-root-update-plugin=~1.0 --no-update php -d memory_limit=8000M /usr/local/bin/composer update php -d memory_limit=4096M /usr/local/bin/composer require magento/product-community-edition=2.4.3 --no-update --interactive-magento-conflicts php -d memory_limit=8000M /usr/local/bin/composer update php -d memory_limit=4096M bin/magento setup:upgrade php -d memory_limit=4096M bin/magento setup:di:compile php -d memory_limit=4096M bin/magento setup:static-content:deploy ``` -------------------------------- ### Download and Install Go and MailHog (Shell) Source: https://docs.webscale.com/reference/stratus/guides/webscale-stratus/using-mailhog Downloads and installs the Go programming language and the MailHog binary using shell commands. This involves fetching Go, extracting it, setting the PATH, and then installing MailHog via `go install`. ```shell wget -c https://go.dev/dl/go1.19.5.linux-amd64.tar.gz tar -xvf go1.19.5.linux-amd64.tar.gz export PATH=$PATH:/srv/bin/go/bin go install github.com/mailhog/MailHog@latest ``` -------------------------------- ### NodeJS Version Check and Setup Source: https://docs.webscale.com/reference/stratus/guides/pwa-configuration Checks the installed NodeJS version and installs a specific version (12.22.7) using NVM, followed by global Yarn installation. This ensures compatibility with the chosen Vue Storefront version. ```shell #!/bin/bash set -e cd /srv/pwa && export NVM_DIR=/srv/pwa/nvm mkdir -p $NVM_DIR curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash . "$NVM_DIR/nvm.sh" nvm install 12.22.7 nvm use 12.22.7 npm install yarn -g yarn install || exit $? cd /srv/pwa; yarn dev ``` -------------------------------- ### Install MagePack Magento Module with Composer Source: https://docs.webscale.com/reference/stratus/guides/magento-2/using-magepack This snippet demonstrates how to install the MagePack Magento module using the composer package manager. This is the recommended installation method for the module. ```shell composer require creativestyle/magesuite-magepack ``` -------------------------------- ### Install MagePack Globally with npm Source: https://docs.webscale.com/reference/stratus/guides/magento-2/using-magepack This command installs the MagePack tool globally using npm. Ensure Node.js version 10 or higher is installed before running this command. ```shell npm install -g magepack ``` -------------------------------- ### Create a Google Cloud Storage Bucket Source: https://docs.webscale.com/reference/stratus/guides/general/backup-strategies This command creates a new bucket in Google Cloud Storage. Buckets must have globally unique names. This example uses 'standard' storage class and specifies the 'US' multi-region. The `-p` flag is used to specify the project ID. ```bash $ ./gsutil/gsutil mb -c standard -l US -p my-backups-256118 gs://mark-stratus-backups Creating gs://[bucket-name]... ``` -------------------------------- ### Upgrade Magento to 2.3.x using Magento Script Source: https://docs.webscale.com/reference/stratus/guides/magento-2/magento-2-upgrade-recommendations Steps to upgrade a Magento installation to a 2.3.x version using a provided script. It involves downloading the script, running it with specific parameters for repository and version, updating Composer dependencies, and then performing Magento setup, compilation, and deployment tasks with adjusted memory limits. ```shell wget https://raw.githubusercontent.com/magento/magento2/2.3/dev/tools/UpgradeScripts/pre_composer_update_2.3.php php -f pre_composer_update_2.3.php -- --root=/srv/public_html --repo=https://repo.magento.com/ --version=2.3.3 php -d memory_limit=4096M /usr/local/bin/composer update php -d memory_limit=8000M bin/magento setup:upgrade php -d memory_limit=4096M bin/magento setup:di:compile php -d memory_limit=4096M bin/magento setup:static-content:deploy ``` -------------------------------- ### Upgrade Magento to a Major Release (e.g., 2.2.7) Source: https://docs.webscale.com/reference/stratus/guides/magento-2/magento-2-upgrade-recommendations Commands to upgrade a Magento installation to a specific major version (e.g., 2.2.7). It involves specifying the product edition, updating Composer dependencies with increased memory limits, and running Magento setup commands for upgrade, DI compilation, and static content deployment. ```shell composer require magento/product-community-edition 2.2.7 --no-update php -d memory_limit=4096M /usr/local/bin/composer update php -d memory_limit=4096M /usr/local/bin/composer -v install php -d memory_limit=4096M bin/magento setup:upgrade php -d memory_limit=4096M bin/magento setup:di:compile php -d memory_limit=4096M bin/magento setup:static-content:deploy ``` -------------------------------- ### Configure Magento 2 env.php Database Credentials Source: https://docs.webscale.com/reference/stratus/guides/webscale-stratus/go-live-on-stratus Example PHP configuration for Magento 2's env.php file, specifying database connection details such as host, database name, username, and password. ```php [ 'table_prefix' => '', 'connection' => [ 'default' => [ 'host' => 'mysql', 'dbname' => 'DATABASENAME', 'username' => 'USERNAME', 'password' => 'PASSWORD', 'model' => 'mysql4', 'engine' => 'innodb', 'initStatements' => 'SET NAMES utf8;', 'active' => '1' ] ] ], ?> ``` -------------------------------- ### Composer Commands for Magento Upgrade (PHP 7.4 to 8.1) Source: https://docs.webscale.com/reference/stratus/guides/magento-2/magento-2-upgrade-recommendations A sequence of Composer commands to manage dependencies and upgrade Magento, specifically addressing compatibility issues between PHP versions and Magento framework. This includes installing a plugin, updating dependencies, clearing cache, running setup upgrade, and changing PHP versions. ```shell composer require magento/composer-root-update-plugin ~2.0 --no-update composer update rm -rf var/cache/* ; rm -rf var/page_cache/* ; rm -rf generated/code/* ; php bin/magento setup:upgrade composer require-commerce magento/product-community-edition 2.4.4 --no-update composer update rm -rf var/cache/* ; rm -rf var/page_cache/* ; rm -rf generated/code/* ; php bin/magento setup:upgrade ``` -------------------------------- ### Make Start Script Executable Source: https://docs.webscale.com/reference/stratus/guides/pwa-configuration Changes the permissions of the `start.sh` script to make it executable by the user. This is required before running the script to start the Vue Storefront development server. ```shell chmod u+x start.sh ``` -------------------------------- ### Configure PHP for ionCube Loader Source: https://docs.webscale.com/reference/stratus/guides/webscale-stratus/install-ioncube-loader-on-stratus This command sequence sets up the PHP configuration directory, copies existing configurations, removes a custom ini file, and creates a symbolic link for ionCube's configuration. It prepares the environment for the ionCube extension. ```bash mkdir php_conf cp -a /usr/local/etc/php/conf.d/* php_conf cd php_conf/ rm zzz_custom.ini ln -s /usr/local/etc/php/conf.d/zzz_custom.ini ./ cp /usr/local/etc/php/php.ini ./ ``` -------------------------------- ### NVM: List Installed Node.js Versions Source: https://docs.webscale.com/reference/stratus/guides/general/node-js-nvm-manager Lists all Node.js versions that have been installed locally using NVM. This helps in managing and identifying available versions on your system. ```bash $ nvm ls ```