Uniform Docs

Uniform Docs

›Getting Started

JAMstack for Sitecore

  • Overview
  • Supported Versions
  • FAQ

Getting Started

  • Sitecore Installation
  • MVC Starter Kit
  • JSS Starter Kit
  • Deploying Sites

Deploying Sites

Deploying the site means exporting it and copying the file to a hosting environment. The starter kit supports several popular hosting environments.

If you don't see your preferred hosting service, let us know so we can add support for it. But in the meantime, you can use the instructions in the other hosts section. It's a little more manual, but it is still very simple.

Netlify

Netlify is known as a great platform for JAMstack sites. Not only does it act as the origin for your site, it also provides a build environment.

Manual build

Running a manual build process allows you to control exactly how and when your application is built and deployed. It is also a good option when your Sitecore instance is not accessible from the internet due to it being a local development environment or sitting behind a firewall.

  1. If you don't already have one, create a free account on Netlify.
  2. Create a new access token.
  3. In a text editor, open the file src/.env
  4. Add the following environment variables, using your Netlify access token:
    UNIFORM_PUBLISH_TARGET=Netlify
    NETLIFY_ACCESS_TOKEN=[!!! NETLIFY ACCESS TOKEN !!!]
    
  5. Open a terminal window to the folder src
  6. Run the following command to build and export the site: npm run export
  7. Run the following command to deploy the site to Netlify: npm run deploy
  8. When the process is finished, the following message is displayed in the terminal window:
    Deploying wait-for-deploy start Waiting for deploy to go live...
    Deploying wait-for-deploy stop Deploy is live!
    NetlifyPublishProvider deployed site files: out
    
  9. The URL for the site on Netlify is written to the file netlify.config.json

Automated build

One of the features developers love about Netlify is how easy it is to configure automated builds. An automated build is triggered by a commit to source control. The build process itself runs on Netlify.

Your Sitecore instance must be accessible via the internet in order for automated builds to work. The build process runs on Netlify. If Netlify cannot reach your Sitecore instance, the build will fail.

If you are using a local Sitecore instance, you may want to consider setting up a tunnel to your your server. ngrok provides an easy solution.

  1. Fork the git repository.
  2. In Netlify, create a new site from Git.
  3. Select your fork.
  4. Specify the following values:
    • Build command: npm run export
    • Publish directory: src/out
  5. Edit the advanced build settings.
  6. Add the same environment variables that you added to the src/.env file. You can omit the variable NETLIFY_ACCESS_TOKEN.

AWS

  1. In AWS, ensure you have the following credentials for a user with the policy AmazonS3FullAccess:
    • Access Key ID
    • Secret access key
  2. Add the following to the src\.env file:
    UNIFORM_PUBLISH_TARGET=awss3
    AWS_ACCESS_ID=[!!! AWS ACCESS KEY ID !!!]
    AWS_SECRET=[!!! AWS SECRET ACCESS KEY !!!]
    AWS_REGION=[!!! AWS REGION FOR S3 BUCKET CREATION !!!]
    #
    # During the first deployment, the S3 bucket is provisioned.
    # At that time, the proper URL is available. Prior to the
    # first deployment, any value can be used here.
    UNIFORM_PUBLISH_AWSS3_PUBLIC_URL=temporary_value
    
  3. Run the following command to build, export and deploy the site to AWS: npm run deploy:aws
  4. When the process is finished, the following message is displayed in the terminal window:
    AwsS3PublishProvider deployed site files: out
    
  5. The URL for the site on AWS is written to the file aws.config.json. Set this value in the file src\.env

Azure Blob Storage

  1. In Azure, provision a Blob Storage account in your preferred region.
  2. Navigate to Settings > Access keys
  3. Copy the value of key 1 > Connection string for use later.
  4. Create a container named $web
  5. In Azure Portal, navigate to your Azure Blob container.
  6. Navigate to Static website
  7. Make sure this setting is enabled and it is associated with the $web container created above.
  8. Copy the value of Primary endpoint for use later.
  9. Add the following to the src\.env file:
    UNIFORM_PUBLISH_TARGET=azureblob
    UNIFORM_PUBLISH_AZUREBLOB_PUBLIC_URL=[!!! PRIMARY ENDPOINT VALUE !!!]
    AZURE_CONTAINER=$web
    AZURE_STORAGE_CONNECTION_STRING=[!!! KEY 1 > CONNECTION STRING VALUE !!!]
    
  10. Open a terminal window to the folder src
  11. Run the following command to build, export and deploy the site to Azure: npm run deploy:azure
  12. You can access the site using the value from Primary endpoint

Other Hosts

With Uniform, a Sitecore site can be deployed to virtually any service that can host static files. The process is a one-step process with the services above. The process with other hosts is a two-step process.

  1. Enter the following command to export the application: npm run export
  2. The following folder contains the static files that make up the JSS site. The files in this folder can be deployed to any hosting service: out
  3. If you want to run your own web server and serve the files in the out folder by using the following command: npx serve out
Last updated on 5/13/2020
← JSS Starter Kit
  • Netlify
  • AWS
  • Azure Blob Storage
  • Other Hosts
Copyright © 2020 Uniform