Jump to content
  • Developing and Deploying applications with TIBCO BusinessWorks? Container Edition on Docker Swarm Setup in AWS


    Manoj Chaurasia

    Table of Contents

    Introduction

    This guide provides the steps to follow in order to deploy TIBCO BusinessWorks? Container Edition application as a docker service in docker swarm. The swarm being setup in Amazon Web Services (AWS).

    We carry out the setup in two phases, viz. development, and deployment. In order to demonstrate this, we develop a simple TIBCO BusinessWorks REST Application, create a docker image out of it in the development phase, and deploy it as a docker service in docker swarm in the deployment phase.

    Pre-Requisite

    1. TIBCO BusinessWorks Container Edition
    2. Access to an AWS account with permissions to use CloudFormation and create the following objects:
      • EC2 instances + Auto Scaling groups
      • IAM profiles
      • DynamoDB Tables
      • SQS Queue
      • VPC + subnets and security groups
      • ELB
      • CloudWatch Log Group
    3. SSH key in AWS in the region where you want to deploy (required to access the completed Docker install)

    To access the full set of required permissions please check Docker for AWS IAM permissions here: https://docs.docker.com/docker-for-aws/iam-permissions

    Development :

    Create a BusinessWorks Application.

    • Open the REST service Wizard to create a new REST service and fill it as shown.
    capture_61.png.d887ad1031963bf3f5f0b89d07d9829a.png
    • Click Next
    • In the Configuration of the Get operation provide Response name as "user" and type as "XSD Element" and select Create New Schema.
    • Create the new schema as shown below
    capture_62.png.fdadbf1dcbc804615cbccf23d47fca96.png

     

     

    • Click Ok and then Finish
    • Use the below configuration in the HTTP connection resource
    Screenshot2022-11-13at4_08_39PM.thumb.png.4daff6d180b39b2df3e243202485adf0.png

     

     

    • Please make sure that the port value of the Module property is changed from 8080 so as to avoid any port conflicts
    Screenshot2022-11-13at4_08_42PM.png.21e2c7056162bb502af267be54115a42.png

    Create a Docker Image

    • Export the EAR file.
    Screenshot2022-11-13at4_22_46PM.thumb.png.33f32ace5907a25f29cbe6239fd76957.png 
    • Create a Dockerfile with your favorite text editor that uses the base TIBCO BusinessWorks Container Edition image and adds the new EAR file.

    Sample Dockerfile:

    FROM tibco/bwce:2.2

    ADD SFDemo_1.0.0.ear /

    • Build your docker image on your local repository:

    example: docker build ?t tibco/sfdemo .

    • Login to your docker hub account by entering the command in CLI: ?docker login?

    Provide the username and password of your dockerhub account.

    • Tag the image: ?docker tag <image> <dockerhub_username/repository:tag>?

    Notice that the notation for associating a local image with a repository on a registry is: ?username/repository:tag?

    Check the newly created image tag : ?docker image ls?

    • Publish the image to your dockerhub account: ?docker push username/repository:tag?
    • Now your image is publicly available and from now on you can pull and run the image from the remote repository.

    Deployment

    Setting Docker Swarm in AWS

    Screenshot2022-11-13at4_09_18PM.thumb.png.8ac68f03850a5f24eb26e23bd28fe44b.png

     

    • It will open CloudFormation windows with a template. Click on Next
    • Fill in the parameters below (you can use values as per your requirements also)
      • Number of Swarm Managers = 1
      • Number of Swarm Workers = 2
      • Which SSH key to use = SSH key in AWS in the region where you want to set up Swarm
      • Enable daily resource cleanup = yes
      • Use CloudWatch for container logging = yes
      • Swarm manager instance type = t2.small
      • Manager ephemeral storage volume size = 20 GB
      • Manager ephemeral storage volume type = standard
      • Agent worker instance type = t2.micro
      • Worker ephemeral storage volume size = 20 GB
      • Worker ephemeral storage volume type = gp2
    • Click Next
    • You can skip the options page that opens by clicking Next.
    • Click on the acknowledgment radio button and click on Create Button.
    • When created you will get the create complete status in the AWS CloudFormation console.
    • Click on Output Tab.
    Screenshot2022-11-13at4_09_28PM.thumb.png.8ef7372d7c1b403100a9496b334a558f.png

    ??

    • ????The different keys means as below
      • DefaultDNSTarget is the AWS load balancer.
      • Managers will list all the managers working in Swarm.
      • Click on the link (value) provided against managers and copy the Public IPv4 IP address of the manager
    • SSH into the manager node of the swarm
      • ssh -i "Path_to_AWS_SSH key filename" docker@IP_AddressOfManager
      • -i option is used to provide the ssh key filename
      • docker@IP_AddressOfManager is used to login into Swarm manager as a docker user 
    • Now we are ready to deploy our BW application as a service in the swarm.
    • Use the below command syntax to create a service 
      • docker service create --name <service Name> --publish mode=host,target=<Internal port used in BW app>,published=<Port Exposed to outside world> <Docker Hub username/repository:tag>
    • Once the service is created, you can check the logs in CLoudWatch console to check if the BW application started successfully.
    Screenshot2022-11-13at4_09_38PM.thumb.png.562c22e9d7c111ba5ca228d7ea7bfd55.png

     

    • Once the app is running, you can access it using the address : DefaultDNSTarget:ExposedPort/swagger

    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...