Last Updated on 30/05/2021 by Patryk Bandurski
In this article, I will describe to you how to set up a development environment using Runtime Fabric using Docker. I will cover the requirements and detailed walkthrough. After completing this, you will be doing this on your own on AWS.
There are a couple of requirements that you should be aware of. First, are the legal requirements:
- Either Platinium or
- Mule EE License
We distinguish Controller and Worker Virtual Machines. Here are the minimum requirements that you should take into account
- 8 GB memory
- 140 GB disk
- 250 GB disk for Docker
- 15 GB memory
- 80 GB disk
- 250 GB disk for Docker
For the development environment minimum configuration is depicted below. You must have at least one controller and two workers.
This configuration is minimal but allows to deploy many applications. In this scenario, we have High Availability as we use two works in two different AWS availability zones. The load balancer in Controller will split the traffic.
Runtime Fabric walkthrough
Runtime Fabric creation
MuleSoft provides a script that automatically set up the environment. All you need to do is to log in to Anypoint Platform. Go to Runtime Manager and select any environment if you are asked. On the left-hand side, choose Runtime Fabric. After that click, the big blue button “Create Runtime Fabric” as on the screen below.
Then you are asked to name the Runtime Fabric. I have decided to call it dev-fabric. On the next screen, you are able to download scripts. Unzip rtf-install-scripts*.zip file to a convenient location. For AWS there is dedicated aws directory.
In order to run the script, you need to get your AWS credentials. How to get them is described in the Help. Once you have them you may save them as Environment variables or into a fabric.tf file. Here are the variables names:
Here is an example:
set AWS_DEFAULT_REGION=eu-central-1 set AWS_ACCESS_KEY_ID=AKXYZEQ set AWS_SECRET_ACCESS_KEY=5pMn/8O
In order to successfully run the standalone runtime, you need to prepare your license key. Download it and perform the following command to obtain Base64 text
base64 -w0 patryk-bandurski-license.lic
We need to get Base64 activation key that is available on the Fabric page on Anypoint Platform. As you can see below it is in the red rectangle area.
We need to initiate the terraform script. By initiating I mean specifying environment variables.
I have extracted rtf zip file into following directory D:\Pobrane\rtf-install-scripts-20190315-bf0dbc8. Perform the following command, of course, replace the source argument to your local path.
docker run --mount type=bind,source=D:/Pobrane/rtf-install-scripts-20190315-bf0dbc8,target=/src -w /src/aws -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN hashicorp/terraform:latest init
So what is going on
- enable_public_ips (boolean)
- controllers (number)
- workers (number)
You may wonder what the key_pair is. It is used to securely connect to AWS instances. Here you find more about it and how to create it.
docker run -it --mount type=bind,source=D:/Pobrane/rtf-install-scripts-20190315-bf0dbc8,target=/src -w /src/aws -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN hashicorp/terraform:latest apply -var activation_data=YW55cG9pbnQubXNi1hNTRlLTIwMGQzZDQ0N2IzNQ== -var key_pair=MuleSoftMeetup -var enable_public_ips=true -var controllers=1 -var workers=2 -var mule_license=2+W35iUhD9k/xQwi/SdnGq6jLuZcaX+qDXQ== -state=tf-data/rtf.tfstate
Now, after answering two questions all the magic is happening. After a while, you should see info like Apply complete! Resources: 3 added, 0 changed, 0 destroyed.
The script will try to create one controller and two workers. By default as a controller m4.large instance is created. For workers, r4.large is used. Your AWS account may have restrictions regarding the number of instances that you can create. In such a case, you need to contact AWS Support to increase that number. Here you can find more details.
For me, it took 2 hours to have the limit increased.
How to change instance types? Go to the fabric.tf file and change default for variable instance_type_controller and instance_type_worker.
Verify the progress
Installation may take up to 20 minutes. Mainly it depends on the number of nodes that you have decided to create. However, how to verify if everything is progressing correctly.
You should log to your controller machine. First, we need to get a public IP address. It is available in AWS console like in the screenshot below.
In order to log in to your instance use user name ec2-user. Then execute the following command
tail -f /var/log/rtf-init.log
Installation is divided into 11 main sections. After the installer reaches 11th step you should see the following message:
11 / 11: Generate Ops Center credentials ================================================ tr: write error: Broken pipe tr: write error user [email protected] created Ops Center access: URL: https://172.31.0.5:32009/web User: [email protected] Password: b0LeZTMLYsC45Cwy9eVXWR Done. Runtime Fabric installation complete.
Check the status
On Anypoint Platform in the details of your Runtime Fabric, you should see Active status. Like in the picture below.
On AWS console you can also find the details of your new instances.
Setting up the environment with terraform script is really straightforward. Although I used official MuleSoft documentation I had some small difficulties. Nevertheless, it is a big step forward for on-premises environments.
I had described each step separately, but it can be nicely automated by your DevOps team.