Thứ Sáu, 15 tháng 4, 2016

Deploying Mule Applications

Deploying Mule Applications 

Depending upon the setup and demands of your production environment, there are numerous ways of deploying Mule applications. This document offers a brief overview of some of the ways you can deploy your Mule applications from Anypoint Studio.
  1. Deploy to the Studio embedded test server.
  2. Deploy to an enterprise server.
  3. Publish to the Mule Management Console Application Repository.
  4. Deploy to the Anypoint Platform.

Deploy on the Studio Embedded Test Server

To test your application, run it locally on the Mule server embedded in Studio. Bundled with Anypoint Studio, the embedded Mule test server can run for up to 12 hours before it must be restarted.
deploy_embedded
When you specify Run As > Mule Application, Studio automatically builds and deploys your application to the internal Mule server, which starts automatically, if necessary.
  1. In the Package Explorer, right-click your project’s name, then select Run As >Mule Application.
  2. Studio runs the application on the embedded Mule test server. (Unless you stop it, Studio runs the application for a period of 12 hours.) View the application’s activities in the Studio console.
  3. To stop the application from running, click the red, terminate button at the top edge of the console.

Deploy on an Enterprise Server

Export the Studio application to a zip file, then deploy it on an Enterprise Server. This approach is ideal for Mule servers in production environments. The zip file contains all the resources (such as code libraries and application metadata) necessary to run the application, and import it into Studio again for further development. You can use the Mule ESB as an enterprise server as described in Downloading and Starting Mule ESB.
deploy_server
Deploying a Studio-built application in production on an Mule Enterprise server involves three steps:
  1. Export the application from Studio.
  2. Launch the Enterprise server.
  3. Deploy the application on the Enterprise server.

Exporting an Application from Studio

Studio lets you save a project as a Mule Deployable Archive (a zip file). Such a packaged Mule archive provides a convenient method for transferring files between editions of Studio or backing up Studio projects. The package includes all information specific to your application(s), including flows, configuration files, Java classes, referenced HTML files, and more.
  1. Right-click the project name in the Package Explorer pane, then select Export.
  2. In the Export wizard, click Mule to expand the associated node, select Anypoint Studio Project to Mule Deployable Archive (includes Studio metadata), then click Next.
  3. Select an output folder where you want to save your project archive, and clickFinish.

Launching the Enterprise Server

  1. If you do not already have Mule ESB Enterprise Standalone installed on your system, download the Mule ESB Enterprise Runtime trial.
  2. Start Mule.
Need more detail?
  1. Open a new command line. Windows: Open the ConsoleMac: Open the Terminal application (Applications > Utilities > Terminal).
  2. Access the directory and folder where you unpacked Mule Standalone (the application folder in Mule). For example, typecd /Users/me/Downloads/mule-enterprise-standalone-3.n.n/ - Where n.n is the latest Mule version
  3. Start Mule. For example, type ./bin/mule

Deploying an Application on the Enterprise Server

  1. Navigate to the folder on your local drive into which saved your archived Studio application, then copy the zip file.
  2. Navigate to the folder that contains your copy of Mule ESB Standalone, then paste the application’s zip file into the apps folder.
  3. Mule polls the apps folder every 5 seconds (every 5000ms); it picks up the application you copied to the apps folder, then extracts and deploys it automatically. In the command line, Mule notifies you that it has deployed the application.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
     *** - - + APPLICATION + - -
     * - - + STATUS + - - ** my_first_application
     * DEPLOYED           ** default
     * DEPLOYED
     ***INFO  2016-01-05 15:40:57,516 [WrapperListener_start_runner]
     org.mule.module.launcher.DeploymentService:
     +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     Mule is up and kicking
     (every 5000ms)
     +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4. If you wish to undeploy your application but keep Mule ESB running, navigate to the app directory and delete the file your_application.txt. This removes your application from the /app directory.
  5. To stop Mule ESB from running in the command line, hit CTRL-C.

Deploy to The Anypoint Platform

Deploy the application to the Anypoint Platform, Mule’s platform for cloud-based integration. The Anypoint Platform represents the least painful approach for fast, worry-free cloud-to-cloud and cloud-to-on-premises deployment. 
deploy_cloudhub
The Anypoint Platform includes the Runtime Manager, which can deploy manage and monitor applications running in the cloud and on-premises. CloudHub, which takes care of the backend of cloud applications, is a full integration Platform as a Service (iPaaS). It provides a convenient way for developers to launch their applications on a cloud platform, while also providing many enhanced features for solving cloud-to-cloud and cloud-to-premise integration problems. Anypoint Studio is fully integrated with Runtime Manager and facilitates simple application deployment.
Deploying a Studio-built application to the Anypoint Platform involves three steps:
  1. Create an Anypoint Platform account.
  2. If you wish to deploy to the cloud, you must adapt your Studio application to CloudHub.
  3. Deploy your Studio application.

Creating an Anypoint Platform account

You manage and deploy applications in CloudHub and on-premises via the Runtime Manager. You access Runtime Manager via the Anypoint Platform, if you don’t have an account, you can easily create a new one. 

Adapting an Application for CloudHub

These steps are only relevant for applications that are meant for deploying to a CloudHub server.
Many projects can be deployed directly to CloudHub. However, some projects require minor modifications, as summarized below.
  • If you are deploying a project that listens on a static port, you need to change the port to a dynamic value so that CloudHub can set it at deployment time. To do so, change your port values to ${http.port} or ${https.port}. You can create an application.properties file that allows you to run your project locally on a specific port and also on CloudHub as a dynamic port. See the example Hello World on CloudHub for details on how to create this file.
  • If using the Jetty connector, set the host to 0.0.0.0 instead of localhost.
See CloudHub and Mule and Developing a CloudHub application for more details on adapting an application to CloudHub.

Deploying an Application to the Anypoint Platform

See Deploying to CloudHub or Deploying to Your Own Servers for instructions on how to deploy through the Anypoint Platform UI. You can also deploy to CloudHub directly from the Studio IDE.
  1. In Studio, right-click the project name in the Package Explorer pane, then select Deploy to Anypoint Platform.
  2. You are prompted to enter your Anypoint Platform login credentials. Then a menu will open where you must select an Environment and sub organization to deploy to, a domain in which to deploy your application, the runtime to deploy to, etc. If deploying to the cloud, the domain name you enter must be a unique sub-domain which CloudHub creates for your application on the cloudhub.io domain such as, My-Project-Name. CloudHub automatically checks the availability of the sub-domain, then displays a checkmark icon to confirm that your entry is unique.
  3. Click Finish to deploy your application to the Anypoint Platform.
  4. In your Web browser, access your Runtime Manager console in the Anypoint Platform to view your newly deployed application.

Sharing Resources

If you’re deploying multiple applications to the same server or servers (except for CloudHub), in whichever of the ways explained above, and those applications could share the same resources, then you can create a common domain where you can define common configurations that can then be referenced by multiple projects. This allows you to, for example, expose different services in different projects through the same HTTP host and port and be able to deploy everything without any conflicts. Read More.

Publish to the Mule Management Console Application Repository

You can publish the application to the Application Repository in the Mule Management Console. Once in the repository, the application can be deployed from the repository to multiple Mule server instances, and even to multi-node MuleclustersDownload and install MMC.
Once in the repository, the application can be deployed from the Repository to multiple Mule server instances and even to multi-node high-availability clusters. To publish an application to the management console’s app repo, you must first download, then install and set-up Mule ESB Standalone with Mule Management Console. Access the management console’s Walkthrough to set up a console environment, then complete the following steps to publish your Studio application to its application repository.
  1. In Studio, right-click the project name in the Package Explorer pane, then select Deploy to Anypoint Platform > Mule Management Console.
  2. In the publication wizard, input a value for each of the fields to specify the location, login credentials of your management console, and settings for your application.
  3. Click Finish to publish the app to the repository.
  4. Follow the directions in the management console Walkthrough to deploy your application to the Mule server (or cluster of servers).

Không có nhận xét nào:

Đăng nhận xét