Oracle by Example brandingCustomizing a Template for Oracle Cloud Stack

section 0Before You Begin

This 20-minute tutorial shows you how to use the Oracle Cloud Stack console to copy and edit one of the standard Oracle templates.

Background

To build and deploy their applications, businesses often require sophisticated environments that consist of multiple, integrated cloud services. Consider a development environment whose needs include Java application server along with a relational database. Provisioning each of these services for every member of your development team is time-consuming and error-prone. Oracle Cloud Stack uses templates to provision a group of cloud resources called a stack.

Templates also support input parameters. Users can enter values for these parameters when they create a stack from the template.

Cloud Stack provides several standard templates, but you can clone and customize these templates by using the web console. For example, you can modify the default size of the application cluster, or add a new template parameter that enables users to configure the cluster size.

What Do You Need?

  • Valid credentials for an Oracle Cloud account
  • An active subscription to Oracle Java Cloud Service
  • An active subscription to Oracle Cloud Infrastructure Object Storage Classic
  • Your REST endpoint URL for Oracle Cloud Infrastructure Object Storage Classic (see About REST URLs)

section 1Configure Template Storage

If this is the first time for anyone in this Oracle Cloud account to work with templates in the Cloud Stack console, you must create a cloud storage container for your unpublished template files.

  1. Sign in to Oracle Cloud.
  2. From the Oracle Cloud Infrastructure Console, click the Navigation menu Dashboard Menu Icon at the top left corner of the page, expand Classic Infrastructure Services, and then select Storage Classic.

    Note: On some older Oracle Cloud accounts, you use the Oracle Cloud Infrastructure Classic Console. Click the Navigation menu Dashboard Menu Icon, and then select Storage Classic.

  3. From the Storage Classic console, click Create Container.
  4. For Name, enter StackTemplates. Then click Create.
  5. Click the Navigation menu Storage Menu Icon at the top left corner of the page, and then select Oracle Java Cloud Service.

    Tip: You can access Cloud Stack from any Oracle Platform service.

  6. From the Java Cloud Service console, click the Navigation menu Dashboard Menu Icon at the top left corner of the page, and then select Cloud Stack.
  7. From the Oracle Cloud Stack console, click Templates.
    Click Templates on oracle Cloud Stack console
    Description of the illustration click_templates.png
  8. Click the Unpublished tab. The Cloud Storage Credentials dialog displays.

    Note: You can also update the existing storage settings by clicking Configure cloud storage Gear Icon.

  9. For Cloud Storage Container, enter Your_Storage_REST_URL/StackTemplates. For example, https://foo.storage.oraclecloud.com/v1/MyService-bar/StackTemplates.
  10. For Username and Password, enter your Oracle Cloud credentials, or the credentials of another Oracle Cloud user who has write access to this storage container.
  11. Click Apply Changes.
  12. Click the Published tab.

section 2Clone an Oracle Template

  1. From the Published Templates page, locate the Oracle template named Oracle-JCS-DBCS-Template. Use the Search field if necessary.
    search for Oracle-JCS_DBCS_Template
    Description of the illustration JCS_template_icon.png
  2. To the right of the template, click Clone this template Clone Icon. The Template Builder is displayed.
  3. Above the toolbar, click Right Arrow Icon.
    expand arrow above toolbar
    Description of the illustration template_name.png
  4. In the first input field, change the template's name to My-JCS-DBCS-Template.
  5. Set the templateVersion to 1.0.0.
  6. Click Save current template Save Icon.

section 3Add a Template Parameter

  1. In the left panel of the Template Builder, locate Parameters. Click Right Arrow Icon to display the existing parameters.
    expand arrow to display parameters
    Description of the illustration show_parameters.png
  2. To the right of Parameters, click Add parameter Plus Icon.
  3. For the new parameter's name, enter clusterSize.
  4. Click the Add to parameter group select box, and then select the existing group Java Cloud.
    add parameter to existing group Java Cloud
    Description of the illustration select_parameter_group.png
  5. Configure the parameter's attributes:
    • default: 1
    • description: Number of WebLogic nodes
    • label: Cluster Size
    • type: Number
  6. Configure the parameter's constraints:
    • maxValue: 4
    • minValue: 1
  7. Click Apply Changes.
  8. Click Save current template Save Icon.

section 4Update a Resource

  1. Click Snap to grid Grid Icon.
  2. In the canvas area (right side) of the Template Builder, right-click the existing Java (Jaas) resource, and then select Edit.
    click Edit next to the Java resource
    Description of the illustration edit_resource.png
  3. Configure these Java Cloud Service parameters:
    • enableAdminConsole: true
    • serviceLevel: PAAS
    • vmUser: opc
  4. Expand components, and then expand WLS.
    expand WLS under components
    Description of the illustration WLS_params.png
    You might need to scroll down.
  5. Set domainMode to the value PRODUCTION.
  6. For managedServerCount enter the text Fn to display a list of functions. Select the function Fn::GetParam.
    select GetParam function for managedServerCound
    Description of the illustration select_getparam.png
  7. Replace the text paramName with the name of your new template parameter, clusterSize.
    'Fn::GetParam': clusterSize
  8. Expand OTD, and then set shape to the value of the wlComputeShape parameter.
    'Fn::GetParam': wlComputeShape
  9. Click Apply Changes.
  10. Click Save current template Save Icon.

section 5Publish the Template

  1. Click Validate current template Validation Icon.

    If there are any validation errors, click Open YAML editor Command Prompt Icon to view the full template definition, and then correct the errors.

  2. Click Publish the current template Publish Icon. When prompted for confirmation, click Publish.
  3. Click the Published tab.
  4. Verify the presence of your new template, My-JCS-DBCS-Template.

section 6Test the Template

  1. To the right of the template, click Create a stack with this template Create Stack Icon.
  2. Configure the stack's parameters:
    • Name: MyJavaStack
    • Template: My-JCS-DBCS-Template
    • Password (to access JCS and DBCS): Enter a password
    • Confirm Password (to access JCS and DBCS): Enter the same password
    • Cluster Size: 5
    • Usable Database Storage (GB): 15
  3. To the right of SSH Public Key, click Edit.
  4. Select the option Create a New Key, and then click Enter.
  5. Click Download, and then click Done.
  6. Click Next. An error message displays because of your parameter's constraints.
  7. Set Cluster Size back to the value 1, and then click Next.
  8. Click Confirm.

more informationWant to Learn More?