Oracle Content and Experience (OCE) allows you to create content-rich websites with the Sites Builder. In this blog you will learn how to use OCE Toolkit that you can download from GitHub here, to setup test to production (T2P) deployment via Git/SVN repository for a site and content published to the site pages.
The T2P setup is enabled via CLI T2P utilities that we added to the OCE Toolkit in the 19.3.1a release.
I assume that you have provisioned one OCE service on Oracle Public Cloud that you nominated as your Development OCE server (DEV) plus, another OCE service as your UAT or Production server (UAT or PROD). The content model, site, site resources (theme, components, etc.), content items and digital assets that you publish to the site are created / edited on the DEV environment. Once ready, these resources can be exported to the local file system using OCE Toolkit CLI, and then propagated to the PROD server.
In addition, OCE Toolkit allows you to develop some resources, like components, section or content layouts directly into the local file system, test them using a local NodeJS server and then deploy to the DEV instance. This is a common approach for developing custom resources for OCE. Also note that the OCE Toolkit CLI commands are bi-directional, which allows you to move updates from the PROD back to the DEV instance.
Setup
You should start by installing OCE Toolkit on your local machine or on a Compute VM that you provisioned on Oracle Public Cloud.
Create Source in your Local File System
In a directory inside your Git / SVN repository type the following:
cec install
This will create a source tree, with a package.json. Then do an npm install to fetch dependencies into the source tree. Update package.json to include any further dependencies you may need for your custom resources.
Setup connection to your Source and Target OCE instance
Based on your OCE deployment topology, you can have one, two, or more OCE services registers with OCE Toolkit. It could be for example, DEV, TEST and PROD servers, or just DEV and PROD. Or you can test in a single PROD server, and then use OCE Toolkit CLI to publish your site and go-live. I will register DEV, TEST and PROD servers.
cec register-server DEV -e https://your-dev-instance.com -u user -p password cec register-server UAT -e https://your-test-instance.com -u user -p password cec register-server PROD -e https://your-production-instance.com -u user -p password
Test you connections as follows to validate the setup:
cec list --server DEV
Create an initial site in DEV instance
If you already have your site create in OCE, you can use it to follow the steps below. I will start by creating an asset repository and localization policy in the OCE DEV instance to use for my brand new site:
cec create-repository Repo1 --server DEV cec create-localization-policy Policy1 -r en-US -l en-US --server DEV
Create a template for the the site in the local file system. I am using seeded Blog template, but you can create and use template for your own site.
cec create-template blog-template -f BlogTemplate
Upload the template with content to create the Content Types & Content Type to Layout maps; theme and components for the site:
cec upload-template blog-template --server DEV
Upload template again but now exclude the content, content will be added after the site is created.
cec upload-template blog-template -x --server DEV
Create the content site – and upload the content to the site with “update” option to keep the IDs:
cec create-site blog-site -t blog-template -r Repo1 -l Policy1 -d en-US --server DEV cec upload-content blog-template -t -r Repo1 -u -c blog-site -l "blog-site Site" --server DEV
Publish blog-site and content:
cec control-content publish -c blog-site --server DEV cec control-site publish -s blog-site --server DEV cec control-site bring-online -s blog-site --server DEV
In real life, this would be a milestone that you reach after site and site resourecs development is finished and you are ready to hand the site over to you UAT team.
Propagate a Site from DEV to UAT server for the first time
Use the following commands to pull the site from DEV into local file system, and then push to the UAT server for testing.
Export the site called blog-site from the DEV server into the local file system, this is done via a template, so that we can include the theme, custom components, and content used in the site. The old version of the template is deleted in DEV before being re-created.
cec delete-template blog-template -p --server DEV cec create-template-from-site blog-template --site blog-site -i --server DEV cec download-template blog-template --server DEV
At this point you can optionally test the template in the local NodeJS server that comes with OCE Toolkit:
cec develop & open http://localhost:8085/templates/blog-template
The UAT instance must have an asset repository, and localization policy, which you can create as follows:
cec create-repository Repo1 --server UAT cec create-localization-policy Policy1 -r en-US -l en-US --server UAT
Upload the site to the UAT server. This is done via the template, which will create content types, components and the theme on upload.
cec upload-template blog-template --server UAT
Upload template again but now exclude the content, content will be added after site is created.
cec upload-template blog-template -x --server UAT
Create the content site – and upload the content to the site with “update” option to keep the IDs.
cec create-site blog-site -t blog-template -r Repo1 -l Policy1 -d en-US --server UAT cec upload-content blog-template -t -r Repo1 -u -c blog-site -l "blog-site Site" --server UAT
Publish blog-site and content.
cec control-content publish -c blog-site --server UAT cec control-site publish -s blog-site --server UAT cec control-site bring-online -s blog-site --server UAT
Your UAT team can start testing the site on the UAT OCE service.
Make changes to the Site in DEV and create Content using OCE Web UI
This would be next milestone that you reach after UAT completed testing so that you need to fix the issues they found or address feedback that they provide. Alternatively, this can be the start of site update or new version development.
Using tools in the Asset Repository and Site Builder on the DEV OCE server, make changes to you site and content published to it.
Propagate the updated Site and Content from DEV to UAT
Export the site into the local file system.
cec delete-template blog-template -p --server DEV cec create-template-from-site blog-template --site blog-site -i --server DEV cec download-template blog-template --server DEV
Upload the template to the UAT instance to update components, theme, and content types.
cec delete-template blog-template -p --server UAT cec upload-template blog-template --server UAT
Update the site and content from changes in the template in the local file system.
cec update-site blog-site -t blog-template --server UAT
Re-publish the blog-site and content.
cec control-content publish -c blog-site --server UAT cec control-site publish -s blog-site --server UAT
This step completes the T2P propagation cycle – you created site and content on DEV OCE service; deployed to UAT OCE service first time; made changes to your site and content in DEV and at last, update the site and content on UAT ICE service.
In this blog I described how you can complete the T2P deployment steps manually. You can easily add OCE T2P CLI commands to a script to automated the T2P process.
Happy DevOps-ing!