Notes: Module 4: Mule 3 Fundamentals: Deploying and Managing APIs

4-1) Introducing Deployment Options

Deploy to Production will need a dedicated Mule Runtime.”

Two options:
i) CloudHub
ii) On-Prem

On-Prem Mule runtimes
- Easy to install
- Requires minimal resources
- Can run multiple applications
- Uses a Java Service Wrapper that controls the JVM from the operating system and starts Mule
- Can be managed by:
--- Mule Management Console (being phased out)
--- Runtime Manager in cloud-based Anypoint Platform
--- Runtime Manager in Anypoint Platform On-Premises Edition
--- Stand-alone on-prem Runtime Manager

4-2) Preparing an Application for Deployment

Application Properties:
- An alternative to hard-coding credentials and resources
- Are injected into the application at runtime
- Can by encrypted
- Are defined in .properties files

Defining application properties:
- Create a properties file in the src/main/resources folder
- Define properties in the properties file i.e. db.prop1, db.prop2, ...
- Create a Properties Placeholder global element
- Use the properties in the application i.e. ${db.prop1}

Image: You can use a dynamic value for the location of the Property Placeholder

Setting environment variables:
- For dev, set environment variables in e.g. env = DEV
- For deployment to the cloud:
--- Set values in the Runtime Manager Properties tab for the application before you start it.
- For deployment to a Mule runtime on-prem:
--- Variables must be passed to Mule runtime when it starts
--- Set them in wrapper.conf before starting Mule

4-3) Deploying Applications to the Cloud

From Anypoint Studio
From Anypoint Platform using Runtime Manager

4-4) Creating API Proxies

An API proxy is an application that controls access to a web service, restricting access and usage through the use of an API gateway.
The API Gateway is a runtime designed and optimized to host an API or to open a connection to an API deployed to another runtime.

Image: API Gateway

4.5) Managing access to APIs

Use the API Manager to manage access to the APIs (includes setting SLAs)
The API Gateway enforces the policies

Image: Client ID Expression & Client Secret Expression

4.6) Restricting Access to API Implementations

On-Prem API Implementations and API proxies:
- Set up an API Gateway cluster inside a DMZ to run the API proxy applications.

On-Prem API Implementations and Cloud API Proxies (AWS):

Cloud API implementations and API proxies:
- Option 1: Do no use separate API proxy applications and instead specify policies for the service API implementation applications
- Option 2: Use VPC
--- Expose API proxy applications outside the VPC using ports 8081 or 8082
--- Expose API implementations inside the VPC using ports 8091 or 8092