Deploy an Application and Configure a Database with Stack Manager

Use Oracle Cloud Stack to deploy an application to Oracle Application Container Cloud Service and configure an Oracle MySQL Cloud Service database in a single operation.

Oracle Cloud Stack is a component of Oracle Cloud that lets you to create multiple cloud resources as a single unit called a stack. You create, delete, and manage these resources together as a unit, but you can also access, configure, and manage them through their service-specific interfaces. Stacks also define the dependencies between your stack resources, so that Oracle Cloud Stack creates and destroys the resources in a logical sequence.

Stacks are created from templates. Oracle Cloud Stack includes many certified Oracle stack templates for Oracle Application Container Cloud Service. Most have names beginning with Oracle-ACCS.

One of the most basic stack templates for Oracle Application Container Cloud Service is Oracle-LMP, which implements the popular LAMP pattern (Linux, Apache, MySQL, PHP), although by default Apache isn't configured. This template creates a stack that's composed of these resources:

  • A service instance in Oracle MySQL Cloud Service

  • An optional PHP application instance in Oracle Application Container Cloud Service that’s connected to the database

The optional application can be modified to have a different runtime, such as Java or Node.js, or multiple instances.

Note:

Prior to creating a cloud stack from this template that includes the application, you must upload the application to Oracle Cloud Infrastructure Object Storage Classic. The template doesn’t automatically create a storage container or upload the application file.

Get Started

Create a stack using the Oracle-LMP template. Refer to these topics in Using Oracle Cloud Stack:

A video and a tutorial are also available.

Tutorial icon Tutorial

Template Parameters

In the Oracle-LMP template, the values of these input parameters can be customized for each stack creation:

  • MySQL database VM compute shape (CPU, memory, storage)

  • MySQL database system user name and password

  • Secure Shell (SSH) public key for MySQL database VM administration

  • Location of your PHP application in Oracle Cloud Infrastructure Object Storage Classic

  • Number of instances of your PHP application

  • Memory (GB) allocated to each instance of your PHP application

The stack name (the predefined parameter serviceName) is used to name the new services. This stack name is joined with the text “Container” and “db”.

Customize the Template

Export and update the Oracle-LMP template to customize your stack’s behavior. Modify the template’s name and contents, such as adding a template parameter or changing the parameters used to create the application instance. See:

See the following for some examples of customizing this stack template.

Set Environment Variables

Your PHP application may rely on environment variables so that you can customize its behavior or tune its performance without modifying code. Use Oracle Application Container Cloud Service to set one or more environment variables (name/value pairs).

resources: 
  phpContainer: 
    type: apaas
    parameters: 
      ...
      deployment: 
        memory: { "Fn::Join": ["", ["Fn::GetParam": instanceMemory, G]] }
        instances: { "Fn::Join": ["", ["Fn::GetParam": numberOfInstances]]}
        environment: 
          NUM_CONNECTIONS: 5
          SCHEMA_NAME: Order

Change the Runtime

If your application is written in a language other than PHP, then you can change the runtime environment. For example, to change the runtime to Java, make these changes to the template:

  • Change all occurrences of phpContainer to javaContainer.

  • Within the resource definition of javaContainer, change the runtime parameter to Java.

resources:
   javaContainer:
     type: apaas
     parameters:
       ...
       runtime: Java