Nav

Deploy to Server

This tutorial covers how to create an Anypoint Platform organization, how to install a Mule runtime in a local server and register it on the platform and then how to deploy an application to it via the Anypoint Platform.

Completing this tutorial should take about 20 minutes. You will accomplish the following:

  • Create an account and organization in the Anypoint Platform

  • Install Mule runtime in a local server

  • Register that server on Runtime Manager

  • Upload, deploy, and run a Mule project

Take a look at Deployment Strategies and Managing Servers so that you’re familiar with the different alternatives for deploying your Mule applications.

Create an Anypoint Platform Organization

To deploy applications via the Anypoint Platform, you first need to create an Anypoint Platform account and organization.

  1. Go to https://anypoint.mulesoft.com to create a new account in a new organization.

    Otherwise, if you want your account to be part of an existing organization, ask the administrator of that organization to invite you to join it, then create your account via the link she sends to you.
  2. Enter your information, choose a username and password, then click Create account. Your new user account is now created, if you aren’t joining an existing organization, then a new organization is created too and your user is made its administrator.

Install and Run Mule Runtime

  1. Download the latest version of Mule runtime from the support portal

  2. Unzip it to a folder of your choice

  3. Open a command line window and CD to where you unzipped the contents of this file, then CD to the /bin folder inside it.

  4. Run the following command to verify that it works:

    ./mule start

  5. Once you have confirmed that it runs correctly, hit Ctrl + C to stop the process.

Register Server

  1. Log in to your account on the Anypoint Platform

  2. Navigate to Runtime Manager, and make sure you’re on the correct environment.

  3. Select the Servers tab on the left.

  4. If you haven’t added any servers yet, you will see the following instructions on the screen:

    deploy to server bd7db

    If you already have at least one server registered, then click click Add Server to see these instructions.

    deploy to server bb07b

  5. Runtime Manager provides you with a default command that includes all of the necessary parameters needed to configure a server to work with Anypoint Platform, including specific keys for your organization. Click Copy to copy this command to your clipboard.

    org code

  6. Open a command line window. CD into the $MULE_HOME/bin folder

  7. Paste the command you just copied and run it.

    Replace “server name” with a server name of your choice.
  8. At this point you should see a success message in response to your command. If you look back at the Servers tab in your browser, you should see a server registered with the name you chose for it:

    deploy to server d7c34

  9. Back on the command line window, start your server by running ./mule. Once the server has initialized, you should see the status of the server change from Created to Connected and then to Running.

    deploy to server 08d58

Deploy Via Anypoint Platform

In this tutorial, you will deploy a simple Hello World project. You can either download the finished project archive Here, or you can build it yourself by following the steps on Build a Hello World Application.

If you create the project yourself in Studio by following the tutorial, you must then export it as a deployable .zip file. To do so, go to File > Export and then select Anypoint Studio Project to Mule Deployable Archive.

See Exporting from Studio for more detailed instructions.

  1. If you’re not there already, log into your Anypoint Platform account and go to the Runtime Manager dashboard.

    hello world on cloudhub 6df18

  2. On the Applications tab (selected by default), Click Deploy application.

    hello world on cloudhub 45c14

  3. Choose a unique domain under which to deploy the application, for example helloworld.

    The domain name can be up to 42 characters. A green confirmation check mark is displayed.
  4. Select an environment in which to deploy your application (such as PRODUCTION or QA).

  5. Select the deployment target. In this case, it should be the server you just registered.

    If you don’t see your server as an available target, make sure that the Mule runtime application (./mule) is currently being executed.

    deploy to server 43cc0

  6. Click Choose File and select the ink:_attachments/basic-tutorial.zip[.zip file that you downloaded] from this tutorial or that you exported from Studio.

  7. Click Deploy Application.

    deploy to server 4fbfe

  8. Anypoint Studio packages, uploads, and deploys your application to the server.

For more details about the different deployment settings, see Deploying to Your Own Servers.

Running Your App

Once the deployment is complete (which could take a few minutes), open a browser and direct it to one of the application’s endpoints.

The example application used by this tutorial listens to http://localhost:8081/. If you hit that address, you should see the text "Hello World!"; recall that the application listens for HTTP calls on the root address, sets the payload to the string "Hello World!" and then returns this string as a response to the requester.

deploy to server a5fa2

This proves you have successfully deployed a Mule application to your new Anypoint Platform account!

You can now manage your application through the Runtime Manager, access its dashboard, view logs and alerts, and more.