Configuring a Deployment Target

Now that the pages are put together, let's try to publish to a public server.

You can set up multiple deployment targets on a single site, for example you can have a separate deployment target for each environment:

  • Development
  • Test
  • Production.

In this example, we'll publish to Github Pages.

Let's go to the Site Config and set up a Deployment Target.

A variety of Deployment Target Types are supported:

  • Amazon S3
  • SFTP
  • FTP
  • FTPS
  • Git SSH
  • Git HTTPS
  • CMS Deployment Host

You can also publish to a local folder on the server, or leave it blank to download published files as a zip.

The CMS Deployment Host is an interesting feature used in integrating web apps.  The CMS Host enables the CMS server to remotely publish to a local dev machine, by running the CMS host program to make it an endpoint.

Let's go ahead and configure the deployment target for Github:

  1. First, we'll create a new repo, and call it "demo-cms"
  2. Next let's enable Github Pages on that Repo
  3. Copy the repo SSH path from Github and paste it into the CMS Deployment Target
  4. Set the Deployment Target's URL Prefix parameter to "/NAME_OF_REPO/"
  5. Copy the Deployment Target's OpenSSH key to the Github repo's Deploy Keys, and allow Write Access for that key

Optionally, set the deployment target's Published Site URL property, so that the site can be easily launched from the publish log.

Publishing the Site

In order to publish the site, we'll click "Publish" on the top menu, and then "Add Deployment"

We can either publish a Release, or the current checked-out revision.

Since we haven't merged our revision into the master branch yet, let's do that:

  1. Open the Revision, and click "Submit for Publish Review"
  2. Review the Revision, and Approve to merge it into the master branch

Next, click on the "Publish" tab again, and click "Add Deployment".  Since no revision is currently checked out, it will go directly to publishing a Release:

  1. If multiple Deployment Targets are configured, such as development, acceptance testing, and production, select the deployment target from the drop-down.
  2. The Deployment Tag must be a unique tag that describes the release.  The Deployment Tag is searchable and keeps track of releases.
  3. Click "Schedule Deployment" to begin the publish process

When publish is complete, click the "View Deployed Site" button on the bottom of the log to view the site.

After committing the files to Github, the Github Pages app can take a minute or two to process the pages and make them available on the public URL.

The jsHarmony CMS has a few additional features in the Publish Log:

  • A zip file with all the published files can be downloaded
  • A change log can be viewed with files added / changed / modified
  • Each publish can be redeployed, if necessary to roll back to a previous revision.

Publishing to a Subfolder

On some sites, like Github Pages, you might be publishing to a non-root folder.  For example, in this tutorial, we published to the "demo-cms" subfolder, because Github Pages creates a subfolder for each repo.

A few items are important to keep in mind when publishing to a subfolder:

  1. First, in your deployment target, set the URL Prefix to the subfolder.
  2. Next, in your Page Templates, set a "base" tag, to add the URL prefix to all links and images on that page.
  3. Finally, make sure that all your URLs inside the template are relative, which means that they do not have the "/" or "https://domain" in front.

If you follow these steps, your site should publish well for both the root website and subfolders.