Table of Contents
- Introduction
- Pre-Requisite
- Development :
- Create a BusinessWorks Application.
- Create a Docker Image
- Deployment
- Setting Docker Swarm in AWS
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
- TIBCO BusinessWorks Container Edition
- 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
- 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.
- 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
- Click Ok and then Finish
- Use the below configuration in the HTTP connection resource
- Please make sure that the port value of the Module property is changed from 8080 so as to avoid any port conflicts
Create a Docker Image
- Export the EAR file.
- 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
- Go to https://docs.docker.com/docker-for-aws/#quickstart and click on Deploy Docker Community Edition for AWS
- 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.
??
- ????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.
- Once the app is running, you can access it using the address : DefaultDNSTarget:ExposedPort/swagger
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 accountSign in
Already have an account? Sign in here.
Sign In Now