Before installing the Fastly_Cdn module you should setup a test environment as you will need to put Fastly in front which will certainly take a while for configuring and testing. If you directly roll out this solution to your production server you might experience issues that could affect your normal business.
Ensure that your Magento2 store is running without any problems in your environment as debugging Magento2 issues with Fastly in front might be difficult.
Fastly_Cdn supports Magento2 Community and Enterprise Edition from version 2.0 onwards.
You will need to signup for a free account with fastly.com in order to use the module. If you need professional services for assistance with setting up your environment please contact magento@fastly.com.
The tasks involved in this are:
- Add the Fastly_Cdn module to the Magento server. (Instructions)
- Configure the Fastly_Cdn module on the Magento server. (Instructions)
The installation of the Magento module is pretty easy and can be performed in a few ways depending on your Magento version.
- Install from Magento Marketplace (only Magento 2.2.x versions)
- Install using Composer
- Install from Zip file
This will require an account with Magento Commerce and the associated API tokens will be used to sync with the marketplace.
- Open a browser to the Magento Marketplace and add the module to the cart. Check out and ensure that this is added to your account.
- Log into the admin section of the Magento system in which to install the module as an administrator.
- Start the Web Setup Wizard by navigating to 'System > Web Setup Wizard'.
- Click 'Component Manager' to synchronise with Magento Marketplace.
- Click to 'Enable' the Fastly_Cdn module. This will start the wizard.
- Follow the on screen instructions, being sure to create backups.
- Proceed to Configuring the Module.
-
You will first need to SSH into the machine that is running Magento. This will look something like this.
ssh username@123.456.78.90
-
If the user that you logged in as is not the Magento filesystem owner, you may need to switch users. Depending on your installation this could be the ecommerce user, e.g.
su - ecommerce
. -
Go to the Magento home directory. You should see an
index.html
and anindex.php
in this directory. Depending on your Magento installation this could be at/var/www/html
. -
Ensure that the files in
app/etc
inside the Magento home directory are write enabled for the Magento filesystem owner that you are logged in as:ls app/etc -l
You are looking for a
w
in the third position from the left for each file, e.g.-rw-rw-r--
. If you have something like-r--rw-r--
you will need to use the chmod command to change permissions on the directory. -
Ensure that Git and Composer are installed, by checking which version you have:
git --version composer --version
If they are not present, here are instructions for installing Git, and here are instructions for installing Composer.
-
Inside the Magento Home directory add the Composer repository for the Fastly module:
composer config repositories.fastly-magento2 git "https://github.com/fastly/fastly-magento2.git"
-
Next, fetch the Fastly module:
composer require fastly/magento2
You may receive an alert that a package is missing or has been abandoned. Provided the alert is green you are fine to proceed.
-
Once the installation process has completed, enable the Fastly module:
bin/magento module:enable Fastly_Cdn
-
Finally clean up tasks:
bin/magento setup:upgrade
You can ignore the prompt to re-run the Magento compile command, and complete the installation with:
bin/magento cache:clean
-
Once this has completed log in to the Magento Admin panel and proceed to Configuring the Module.
-
Open a browser to GitHub note/copy the URL of the version to install.
-
Log in to the Magento server as the Magento filesystem owner and navigate to the Magento Home directory.
-
Create a directory
<magento home>/app/code/Fastly/Cdn/
and change directory to the new directory. -
Download the zip/tarball and decompress it.
-
Move the files out of the
fastly-magento2
into<magento home>/app/code/Fastly/Cdn/
. -
At this point, it is possible to install with either the:
Web Setup Wizard's Component Manager (only Magento 2.2.x versions, for 2.1.x use command line)
- To install in the Web Setup Wizard. Open a browser and log in to the Magento admin section with administrative privileges.
- Navigate to 'System > Web Setup Wizard'.
- Click 'Component Manager' scroll down and locate 'Fastly_Cdn'. Click enable on the actions.
- Follow the on screen instructions ensuring to create backups.
Command line
- To enable the module on the command line change directory to the Magento Home directory. Ensure you are logged in as the Magento filesystem owner.
- Verify that 'Fastly_Cdn' is listed and shows as disabled:
bin/magento module:status
. - Enable the module with:
bin/magento module:enable Fastly_Cdn
. - Then we need to ensure the configuration tasks are run:
bin/magento setup:upgrade
. - Finally on the command line to clear Magento's cache run:
bin/magento cache:clean
.
-
Once this has been completed log in to the Magento Admin panel and proceed to Configuring the Module.
-
Ensure that your Magento version is tested and supported with the version of Fastly_Cdn that you are using.
-
Ensure that all files and folders have the correct permissions for the Magento Filesystem Owner and the Web Server user.
-
Ensure that the cache's are cleaned and disable / re-enable the module.
-
Ensure that text content is not being compressed.
If any critical issue occurs you can't easily solve, execute
bin/magento module:disable Fastly_Cdn
as the Magento Filesystem Owner to
disable the Fastly_Cdn module. If necessary clear Magento's cache again.
If possible, gather as much data and open an issue to help improve the module.