Phase: Design and Development
During design and development of your Developer Portal, you need the ability to quickly and easily see your work render in your test cluster. To help you with testing, stage-portal-customizations is a new command for the Cluster Manager CLI utility tool.
stage-portal-customizations CLI command
This CLI command can be invoked with a single parameter - a valid path to a .zip file somewhere in your tml-cm container that adheres to the .zip file 'contract', which asks for the following:
-
a single .zip file contains any or all of the following types of file in the root of the .zip files' folder structure:
-
(1) file named
customizations.js- used for template customizations. -
(1) file named
translations.js- used for translation customizations -
(1) folder named
assets- contains any arbitrary hierarchy of folders with files in them; the files can be served into your portal templates/pages by using the Files API.
-
How to create a valid .zip file
-
Assemble your assets,
customizations.jsandtranslations.jsinto a single folder on the machine where the mods were made.For example:
yournamehere@My-MacBook-Pro:~/code/new-customizations|
⇒ ls -al
total 48
drwx------ 5 yournamehere staff 160 Sep 17 17:49 .
drwx------+ 694 yournamehere staff 22208 Sep 17 16:43 ..
drwxr-xr-x@ 5 yournamehere staff 160 Sep 17 17:29 assets
-rw-r--r--@ 1 yournamehere staff 5457 Aug 6 11:53 customizations.js
-rw-r--r--@ 1 yournamehere staff 15951 Aug 6 11:53 translations.js -
Create a .zip file of that folder.
For example:
yournamehere@My-MacBook-Pro:~/code/new-customizations|
⇒ zip -rq ~/Documents/newest-customizations.zip ./* -
Copy the .zip file to your
tml-cmcontainer.For example:
yournamehere@My-MacBook-Pro:~/code/new-customizations|
⇒ docker cp ~/Documents/newest-customizations.zip
a9aeb2b3f81a:/tmp/customizations.zip -
Launch a Bash shell to that container from your local machine.
For example:
yournamehere@My-MacBook-Pro:~/code/new-customizations|
⇒ docker exec -it a9aeb2b3f81a /bin/bash -
Executing the Cluster Manager
stage-portal-customizationscommand.For example:
[root@a9aeb2b3f81a mashery]# clustermanager stage-portal-customizations /tmp/customizations.zip
Unzipped:
/opt/mashery/portal/assets
/opt/mashery/portal/customizations.js
/opt/mashery/portal/translations.js
/opt/mashery/portal/assets/images
/opt/mashery/portal/assets/images/logo.svg
/opt/mashery/portal/assets/custom.css
The Cluster Manager CLI prevents you from submitting a .zip file with contents that do not adhere to these constraints, with an actionable error message to guide the remedy.