How To: Setting up the Oracle Content Management Toolkit

The Oracle Content Management Toolkit is a Command-Line Utility that allows you to execute many function against OCM. Now.. you could script these functions by hand and use the public APIs but pretty much all the features you could need are scripted and available here.

💡
It's updated regularly and available on github - https://github.com/oracle/content-and-experience-toolkit

The toolkit is broken down into the following feature segments -

  • Documents
  • Components
  • Templates
  • Themes
  • Sites
  • Assets
  • Content
  • Recommendations
  • Taxonomies
  • Permissions
  • Translations
  • Jobs
  • Groups
  • Environment

Setup

The setup process is pretty straight forward:

Pre-reqs

  • Make sure node and npm are in your PATH. Use NodeJS version 14+.
  • Download the Content Toolkit - e.g. from GitHub - link
💡
You can also check out the official setup guide here https://github.com/oracle/content-and-experience-toolkit/tree/master/sites

Open up a terminal as an admin and go to the folder where you have extracted the Content Toolkit:

# Open the sites folder 
cd <download-path>/content-and-experience-toolkit/sites

# Install the toolkit
npm install

Add the "cec" toolkit CLI to your path

Mac

sudo ln -s $PWD/node_modules/.bin/cec /usr/local/bin/cec

Windows

Launch "SystemPropertiesAdvanced.exe"

Open your "Environment Variables..."

Select your Path Variable and then select the "Edit" button.

Add the path to your "<toolkit>\node_modules\.bin" as highlighted below:

Now launch a new terminal and initiate the toolkit.

# Type cec to initiate and see a list of toolkit commands
cec

Preparing your Toolkit development folder

Now that the toolkit is installed we need to define a location to store assets and develop locally.

Launch up your terminal

# create your dev folder it can be anything
mkdir cec-src
cd cec-src

# use the install cmd
cec install

Registering an OCM Server to run toolkit commands against

You can register and reference as many OCM instances as you want to do this.

# you can use the -h flag to get more information 
# on how to execute cec commands here is an example - 
cec register-server -h
# Register your OCM Instance
cec register-server <name> -e https://<instanceName>.cec.ocp.oraclecloud.com -u <user> -p <password>

Once registered you can see the JSON server configuration in your Toolkit development folder

\src\servers\<name>\server.json

Finally confirm the connection to your registered server works

cec list --server <name>

Spinning up a local development environment against your registered server.

Now that the toolkit is setup and you have registered your OCM Server - we can spin up the local development environment; letting you quickly work on development of components, themes, templates, and content layouts:

# initiate the develop cmd
# point to your server with -s servername that you registered.
cec develop -s <name>

This will launch up a development instance that you can access via
http://localhost:8085

Components, themes, templates, layouts can all be found in your development toolkit folder under "/src" - initially this will be empty.

You can use the toolkit CLI to create or  download the components that you can then work on locally and push back up and auto publish to your  OCM instance.

Example

# Create a basic form component
cec create-component <componentName> -f ContentForm

# Download your component from your OCM server
cec download-component <componentName> -s <serverName>

# Upload your updated form back to the server and publish
cec upload-component <componentName> -s <serverName> -p


Congratulations you now have the Oracle Content Management Toolkit installed a server registered and can easily develop new components and manage your OCM instance directly from the CMD line.