How to deploy to Akamai NetStorage
#
IntroductionThe following diagram illustrates the components involved with deploying a Sitecore site to Akamai NetStorage.
#
Prerequisites- You have completed the Getting Started section, so your site is ready to be deployed to static storage.
- Uniform for Sitecore starter kit (for Deploy).
- Akamai account with NetStorage enabled.
- Uniform Upload Tool for Akamai NetStorage (optional).
#
Media SyncA future version of Uniform will support media sync to Akamai NetStorage. Currently you must either host media files on your Sitecore CD instance or use media sync to a supported system (e.g. Azure Blob Storage).
#
Steps#
Add storage groupLog into Akamai.
In the left menu, navigate to ORIGIN SERVICES > NetStorage.
In the left menu, click Storage Groups.
Click + Add Storage Group.
Enter values for the fields and click Next.
Select the zones you want to use and click Next.
Click Next.
Click + Upload Directory.
Enter a value in the Name field and click Create.
Enter the following values and click Save:
- Quick Delete -
enabled
- Index Name -
/index.html
- Quick Delete -
Click Next.
Click Next.
Click Create.
You should see your storage group in the list.
note
It takes from 1-2 hours for the storage group to be propagated to the NetStorage network. You can continue to configure Akamai during this time.
#
Add upload account- In Akamai, in the left menu navigate to ORIGIN SERVICES > NetStorage.
- In the left menu, click Upload Accounts.
- Click + Add Upload Account.
- Complete the form, then click Next.
- Tick the box next to the storage group you created in the previous section, then click Next.
- Click Netstorage HTTP CMS API.
- Click + Add HTTP API Key.
- Click Save.
- Click File Manager.
- Enable the option "Enable File Manager Access", then click Next.
- Click Next.
- Click Create.
- You should see your upload account in the list.
note
It takes from 1-2 hours for the upload account to be propagated to the NetStorage network. You can continue to configure Akamai during this time.
#
Add propertyIn Akamai, in the left menu navigate to CDN > Properties.
Click New Property.
In the product "Ion Standard", click Create Property.
Click Property Manager.
Complete the form, then click Next.
In the section Property Hostnames, click Add.
Add the hostname for the site, then click Next.
Click Next.
Click Submit.
Click Close.
Scroll down to the section Property Configuration Settings.
Click Default Rule.
In the section Behaviors, find the behavior Origin Server.
Enter the following values:
- Origin Type -
NetStorage
- NetStorage Account - Select the storage account you created in the earlier section.
- Origin Type -
Under Default Rule, navigate to Offload origin.
In the section Behaviors, find the behavior Caching.
Set the following values:
- Caching option -
Cache
- Maxage -
10 minutes
- Caching option -
Under Default Rule, navigate to Offload origin > HTML pages.
In the section Behaviors, find the behavior Caching.
Set the following values:
- Caching option -
Cache
- Maxage -
10 minutes
- Caching option -
Click Add Behavior.
Select ESI (Edge Side Includes) and click Insert Behavior.
Click Add Behavior.
Select Downstream Cacheability and click Insert Behavior.
Scroll down to the behavior.
For the value Caching Option, select Don't allow caching (bust).
(optional) If you are personalizing based on geographic location, click Insert Behavior.
(optional, continued) Select Content Targeting (EdgeScape) and click Insert Behavior.
(optional) If you are personalizing based on device characterization, click Insert Behavior.
(optional, continued) Select Device Characterization - Forward in Header and click Insert Behavior.
(optional, continued) Scroll down to the behavior.
(optional, continued) Select the following characterizations:
brand_name
device_os
device_os_version
is_mobile
is_tablet
marketing_name
mobile_browser
mobile_browser_version
model_name
Under Default Rule, navigate to Augment insights > Traffic reporting.
In the section Behaviors, find the behavior Content Provider Code.
Click Create new....
Enter a name for the CP code and click Create.
Scroll to the top of the page and click Save.
Click the tab Activate.
Click Activate v1 on Production.
Tick the checkbox at the top of the page.
Scroll to the bottom of the page and click Activating v1 on Production.
#
Install Uniform Upload Tool (optional)The Uniform deployment process uploads files to Akamai NetStorage. By default, Uniform uses the Akamai NetStorage API to do this. Uniform also provides an upload tool that offers improved performance. This is a tool that is triggered by the Uniform service during the deployment process.
important
Make sure you have a version of the Uniform Upload Tool that is compatible with the operating system on which the Uniform service is running. Windows and Linux are supported.
- Copy the upload tool to a folder on the machine that runs the Uniform service.
- Make sure the Uniform service has access rights to the upload tool.
#
Collect settingsIn order for the Uniform deployment process to be able to upload static files to Akamai NetStorage, several settings must be configured.
The section describes how to find these settings.
- In Akamai, in the left menu, navigate to ORIGIN SERVICES > NetStorage.
- In the left menu, click Storage Groups.
- Click the row for the storage group you created in the previous section.
- Note the value of HTTP Domain Name.
- In the left menu, click Upload Accounts.
- In the section Upload Account Details, note the value Id.
- In the section Upload Directories, note the value Upload Directory. This is the CP code for the upload directory.
- Click the button Edit.
- In the section Access Methods, click Netstorage HTTP CMS API.
- In the column Actions, click the icon Copy Key. Note the value copied into the clipboard.
- At the bottom of the page, click the button Cancel.
- If you are using the optional Uniform Upload Tool, note the path to the
executable (e.g. If your Uniform service is running on Windows,
the path might be
D:\tools\uniform\Uniform.Akamai.Upload.exe
).
#
Configure deployment serviceThe deployment service in Sitecore is responsible for triggering the Uniform service during the Sitecore publishing process. In order to trigger the Uniform service, a number of settings must be added to Sitecore. These settings are used in several ways:
- Locate the Uniform service.
- Provide settings to the Uniform service that are used to communicate with Akamai.
There are two ways you can configure these settings.
#
Option 1. Sitecore config filesThis option is recommended for production environments.
<sitecore> <uniform> <siteConfigurations> <siteConfiguration name="<YOUR-SITECORE-SITE-NAME>"> <site inherits="<YOUR-SITECORE-SITE-NAME>"/> <deployment> <deploymentService set:ref="uniform/services/hostedDeploymentService"> <ServiceUrl><URL-TO-UNIFORM-SERVICE></ServiceUrl> <environmentVariables hint="raw:AddEnvironmentVariable"> <variable name="UNIFORM_PUBLISH_TARGET">akamai</variable> <variable name="AKAMAI_NETSTORAGE_HOSTNAME"><YOUR-HTTP-DOMAIN-NAME></variable> <variable name="AKAMAI_NETSTORAGE_KEY"><YOUR-HTTP-API-KEY></variable> <variable name="AKAMAI_NETSTORAGE_ID"><YOUR-ACCOUNT-ID></variable> <variable name="AKAMAI_NETSTORAGE_CPCODE"><YOUR-UPLOAD-DIRECTORY-CP-CODE></variable> <variable name="AKAMAI_NETSTORAGE_UPLOAD_TOOL_PATH"><YOUR-UPLOAD-TOOL-PATH></variable> </environmentVariables> </deploymentService> </deployment> </siteConfiguration> </siteConfigurations> </uniform> </sitecore>
note
If you are not using the Uniform Upload Tool, you should remove the variable AKAMAI_NETSTORAGE_UPLOAD_TOOL_PATH
.
#
Option 2. Sitecore items- In Sitecore, open Content Editor.
- Navigate to sitecore > system > Uniform > Site Configurations.
- Select the item that corresponds to your site.
- Add a new item using the template Configure Site.
- Enter the following field values:
- Inherits:
<YOUR-SITECORE-SITE-NAME>
- Inherits:
- Save the item.
- Add a new item using the template Connect: Self-Hosted Deployment Service....
- Enter the following field values:
- ServiceUrl: Url to the Uniform service that is used to generate static pages. (For example, if you are using Next.js, this is the url to the Next.js application.)
- In the field EnvironmentVariables, enter the following values:
- UNIFORM_PUBLISH_TARGET =
akamai
- AKAMAI_NETSTORAGE_HOSTNAME =
<YOUR-HTTP-DOMAIN-NAME>
- AKAMAI_NETSTORAGE_KEY =
<YOUR-HTTP-API-KEY>
- AKAMAI_NETSTORAGE_ID =
<YOUR-ACCOUNT-ID>
- AKAMAI_NETSTORAGE_CPCODE =
<YOUR-UPLOAD-DIRECTORY-CP-CODE>
- UNIFORM_PUBLISH_TARGET =
- If you are using the Uniform Upload Tool, add the following values to the field EnvironmentVariables:
- AKAMAI_NETSTORAGE_UPLOAD_TOOL_PATH =
<YOUR-UPLOAD-TOOL-PATH>
- AKAMAI_NETSTORAGE_UPLOAD_TOOL_PATH =
- Save the item.
#
Configure cache purgeWhen a file in NetStorage is changed, the Akamai cache must be purged in order for Akamai to deliver the latest version of the file.
Follow the instructions on how to configure cache purge.
important
For the CP code, you should use the value for your upload directory,
meaning the value set for the environment variable
AKAMAI_NETSTORAGE_CPCODE
.
#
Start Uniform service- In the terminal window, navigate to the root folder of your Uniform service.
- Enter the following command:
npm run start
#
Trigger deployment- In Sitecore, republish of any page-level item under the
/sitecore/content/<YOUR-SITECORE-SITE-NAME>
item. - The console for your Uniform service will show something like the following:
07/05-10:44:34 info: Received deploy status request, ticket: 0, message: Uploading HTML site files07/05-10:44:35 info: Successfully deployed C:\sitecore-jss-nextjs-starterkit\.temp\0 folder07/05-10:44:35 info: Deleting temp dir: C:\sitecore-jss-nextjs-starterkit\.temp\007/05-10:44:36 info: Temp dir was deleted: C:\sitecore-jss-nextjs-starterkit\.temp\007/05-10:44:36 info: Received deploy status request, ticket: 0, message: Deployment is complete
#
Configure DNSYou should talk with your network administrator before making any changes to DNS. The instructions below may not be appropriate for your environment.
- In Akamai, navigate to your property.
- In the section Active Production Version, click the link next to Version:.
- In the section Property Hostnames, find the value of Edge Hostname.
- In your DNS settings, add a CNAME record using the Edge Hostname value.
#
Troubleshooting#
File Manager setupAkamai offers a tool named File Manager that gives you the ability to view the files in NetStorage from the Akamai Control Center.
- Log into Akamai.
- In the left menu, navigate to ORIGIN SERVICES > NetStorage.
- Click File Manager.
- Click Setup FM Access.
- In the row for your storage group, select the upload account you created, then click Update Access.
- Click File Manager.
- Click the name of your storage group.
- Now you can access the files in the storage group.