This article explains how to deploy applications, built with TIBCO’s containerization offering TIBCO BusinessWorks Container Edition (BWCE), to Amazon’s cloud platform AWS Fargate.
Introduction
When you want to launch a container on AWS Elastic Container Service (ECS) you need to choose the launch type: container instances (just EC2 under the hood) or Fargate. Fargate is the smart choice when you don’t have the need to fiddle with IaaS-level stuff that EC2 instances bring. Each task that runs in Fargate comes with a dedicated Elastic Network Interface (ENI) with a private IP address. All containers of the same task can communicate with each other via localhost. Inbound and outbound task communication goes through the ENI. A public IP address can be enabled as well.
The premise of TIBCO BWCE is to simplify integration of backend APIs and systems, embrace native features of chosen container management platforms (like AWS Fargate) and speed up time to market.
With aforementioned tools you have enough ingredients to become dangerous in cloud land. Let’s go!
Prerequisites
To get to know BWCE in a quick and digestiver manner, read this article “TIBCO on Docker: How to create, instantiate and start a TIBCO BusinessWorks Container Edition (BWCE) application Docker Image?” by Rubén Middlejans.
The thing you need to be aware of with Fargate is that before creating the Docker image, you need to create a new hostname ModuleProperty and set it to value ‘0.0.0.0’. The reason why is because AWS Fargate only accepts AWS VPC networking. By using 0.0.0.0 the application will bind to the specific IP-address that’s being used on your Fargate deployment.
Steps
Build the BWCE Docker image and push it to Amazon Elastic Container Repository (ECR).
- Login to ECR by running (choose your own region):
aws ecr get-login –no-include-email –region eu-west-1
A long string will be returned like: docker login -u AWS -p …….. Copy the whole string and run it as a new command. Note: if aws ecr get-login doesn’t work, you might need to configure AWS first. Perform a aws configure and enter your AWS Access Key ID and your AWS Secret Access ID (get them from the Security Credentials page on your profile). - Create your Docker image by running a docker build command and using the AWS ECR repo URI as the tag.For Example: docker build -f DockerFargate -t 123456789012.dkr.ecr.eu-west-1.amazonaws.com/reponame:appname
Note 1: the URI value can be retrieved by logging in to AWS ECR and copying the value of the repo you want the image to be pushed to. - Note 2: When your image is using other images that aren’t present in your local Docker registry yet, you need to log in to Docker by using docker login.
- You are ready to push the image to ECR. Use command:
docker push 123456789012.dkr.ecr.eu-west-1.amazonaws.com/reponame:appname
And wait. Your Terminal will show a nice loader. First time can take a few minutes. When the loader is gone, your upload job is done! Refresh your ECR browser window to validate that your Docker image is there.
Define the AWS Fargate task
- Create an AWS Fargate Task. Select the Fargate Launch Type;
- Choose the image name of the image you just uploaded. Configure:
* Set Task Memory to 1GB;
* Set Task CPU to 0.5;
* Add container and set memory limit to 512, set port mapping, CPU units top 100 and use out of the box logging from awslogs; - Create a cluster. Create a separate VPC because you want to separate all your different types of applications in different VPCs.Note: if you care about auto-scaling, load balancing etc. create a Service which will then refer to youTask. If not, you can just create a Task itself.
Run the BWCE application that you have just defined in your task.
- Choose Launch type Fargate;
- The task definition is Fargate compatible so no error message should be seen;
- Give Task group a name, eg bwce-fargate-group;
- Choose your created VPC;
- Auto-assign public IP: ENABLED;
- Security Group: expose your port(s);
- Validate that the status of your task is ‘RUNNING’.
And you are done!