deploying and configuring mashery local docker on amazon ec2 · 2017-01-26 · deploying and...

20
Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install Docker Engine, Docker Machine, and Docker Compose on to your machine. 2. Download the TIBCO Mashery Local for Docker installation from TIBCO eDelivery website and extract contents of file. Building Docker Images 3. Navigate to the root folder of the extracted contents of the TIBCO Mashery Local for Docker installation and run the following command: a. ./build-docker.sh 4. Verify that three images are created: ml_core.tar.gz ml_db.tar.gz ml_mem.tar.gz 5. Create a directory ‘images’ and move the three image files created from step 4 in to it. 6. Copy the docker-compose.yml file from the examples folder in to the images folder. 7. In order for NTP to work, the following modification is necessary: a. In the docker-compose.yml file, under the Services/ml_tm section, add: privileged: true. (use the same indent as container_name: ml_tm) b. Under the Services/ml_tm/ports section, add: - "123:123" (use the same indent as - "80:80")

Upload: others

Post on 19-Jul-2020

31 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install

Deploying and Configuring Mashery Local Docker on Amazon EC2

Pre-Requisites

1. Download and install Docker Engine, Docker Machine, and Docker Compose on to your machine.

2. Download the TIBCO Mashery Local for Docker installation from TIBCO eDelivery website and extract contents of file.

Building Docker Images

3. Navigate to the root folder of the extracted contents of the TIBCO Mashery Local for Docker installation and run the following command:

a. ./build-docker.sh 4. Verify that three images are created:

• ml_core.tar.gz • ml_db.tar.gz • ml_mem.tar.gz

5. Create a directory ‘images’ and move the three image files created from step 4 in

to it.

6. Copy the docker-compose.yml file from the examples folder in to the images folder.

7. In order for NTP to work, the following modification is necessary:

a. In the docker-compose.yml file, under the Services/ml_tm section, add: privileged: true. (use the same indent as container_name: ml_tm)

b. Under the Services/ml_tm/ports section, add: - "123:123" (use the same indent as - "80:80")

Page 2: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install

Create VPC

1. In the Virtual Private Cloud service, navigate to the ‘Your VPCs’:

2. Click ‘Create VPC’. 3. On the dialog enter values and click ‘Yes, Create’:

• Name tag: MLVPC • CIDR block: 192.168.0.0/20 • Tenancy: Default

4. Please record the VPC ID as it will be required later.

Page 3: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install

Enable DNS Hostnames on the VPC

5. Make sure the ‘MLVPC’ is selected, choose ‘Edit DNS Hostnames’ action:

6. On the ‘Edit DNS Hostnames’ dialog toggle ‘Yes’ and click ‘Save’:

Page 4: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install

Create Subnet in VPC

7. Navigate to the ‘Subnet’ section:

8. Click ‘Create Subnet’, on the dialog enter values and click ‘Yes, Create’:

• Name tag: MLPubSubnet • VPC: From dropdown choose ‘MLVPC’ • Availability Zone: From dropdown choose an Availability Zone • CIDR block: 192.168.0.0/20

9. Please record the Subnet ID as it will be required later.

Page 5: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install

Create Internet Gateway

10. Navigate to the ‘Internet Gateway’ section:

11. Click ‘Create Internet Gateway’ 12. On the dialog enter values and click ‘Yes, Create’:

• Name tag: MLInternetGWay

Page 6: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install

Attach Internet Gateway to VPC

13. Make sure the ‘MLInternetGWay’ is selected. 14. Click ‘Attach to VPC’ button and select ‘MLVPC’ vpc from VPC dropdown list. 15. Click ‘Yes, Attach’.

Page 7: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install

Create Route Table

16. Navigate to the ‘Route Tables’ section:

17. Click ‘Create Route Table’. 18. On the dialog enter values and click ‘Yes, Create’:

• Name tag: MLPublicRoute • VPC: From dropdown choose ‘MLVPC’

Page 8: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install

Associate Subnet to Route Table

19. Make sure the ‘MLPublicRoute’ Route Table is selected. 20. In the ‘Subnet Associations’ tab click ‘Edit’:

21. Click ‘Associate’ tick-box and click ‘Save’:

Page 9: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install

Create Route in Route Table

22. Make sure the ‘MLPublicRoute’ Route Table is selected. 23. In the ‘Routes’ tab click ‘Add another route’:

24. Enter values and click ‘Save’:

• Destination: 0.0.0.0/0 • Target: From dropdown choose correct Internet Gateway ID

Page 10: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install

Create Security Groups

25. In the Virtual Private Cloud service, navigate to the ‘Security Groups’:

26. Click ‘Create Security Group’ 27. On the dialog enter values and click ‘Yes, Create’:

• Name tag: MLMasterSG • Group name: MLMasterSG • Description: MLMasterSG • VPC: From dropdown choose ‘MLVPC’

28. Click ‘Create Security Group’ 29. On the dialog enter values and click ‘Yes, Create’:

• Name tag: MLSlaveSG • Group name: MLSlaveSG • Description: MLSlaveSG • VPC: From dropdown choose ‘MLVPC’

Page 11: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install

30. Click ‘Create Security Group’ 31. On the dialog enter values and click ‘Yes, Create’:

• Name tag: MLLBSG • Group name: MLLBSG • Description: MLLBSG • VPC: From dropdown choose ‘MLVPC’

Page 12: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install

Add Inbound Rules to Security Groups

32. Make sure the ‘MLMasterSG’ Security Group is selected. 33. In the ‘Inbound Rules’ tab click ‘Edit’.

34. Enter values and click ‘Add another rule: • Type: From dropdown choose ‘Custom TCP Rule’ • Protocol: TCP • Port Range: 80 • Source: 0.0.0.0/0

35. Repeat adding ‘Custom TCP Rule’ for the following TCP Ports:

• Port Range: 22,443,2200,3306,2376,5480,8000,8084, and 11212 • Source: 0.0.0.0/0 (for all)

36. Add another rule:

• Type: From dropdown choose ‘Custom UDP Rule’ • Protocol: TCP • Port Range: 80 • Source: 0.0.0.0/0

37. Add another rule:

• Type: From dropdown choose ‘All ICMP’ • Source: 0.0.0.0/0

38. Click ‘Save’. 39. Your Inbound Rules should resemble:

Page 13: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install

40. Select ‘MLSlaveSG’ Security Group and repeat steps 30-34. 41. Select ‘MLLBSG’ Security Group. 42. In the ‘Inbound Rules’ tab click ‘Edit’. 43. Enter values and click ‘Add another rule:

• Type: From dropdown choose ‘Custom TCP Rule’ • Protocol: TCP • Port Range: 80 • Source: 0.0.0.0/0

44. Repeat adding another ‘Custom TCP Rule’ for port 443. 45. Click ‘Save’

Page 14: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install
Page 15: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install
Page 16: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install

Create EC2 Instances from public AMI

If the AMI does not exist in your region that you may need to copy the AMI from one of the above regions.

REGION REGION NAME AMI Name AMI-ID

us-east-1 US East (N. Virginia) Ubuntu 16.04 ami-efe09bf8

eu-west-1 EU (Ireland) Ubuntu 16.04 ami-ab5e0ed8

You will need the following information to provision the AMI instance using docker-machine:

• AWS Access Key • AWS Secret Key • AWS Region • AWS Zone • AWS AMI ID • AWS VPC ID for ‘MLVPC’ (created in step 2) • AWS Subnet ID for ‘MLPubSubnet’ (created in step 8) • AWS Security Group Names (created in step 27 and 29)

The syntax for creating the docker container on AWS EC2 is:

docker-machine create --driver amazonec2 --amazonec2-access-key <<AWS-ACCESS-KEY>> --amazonec2-secret-key <<AWS-SECRET-KEY>> --amazonec2-region <<AWS-REGION>> --amazonec2-zone <<AWS-ZONE>> --amazonec2-ami <<AWS-AMI-ID>> --amazonec2-instance-type --amazonec2-retries --amazonec2-vpc-id <<AWS-VPC-ID>> --amazonec2-subnet-id <<AWS-SUBNET-ID>> --amazonec2-security-group MLMasterSG --amazonec2-tags Name,<<TAG-NAME>> <<AWS-EC2-INSTANCE-NAME>>

46. From the shell and using docker-machine create an AMI Instance ‘aws-ml-master’ for Mashery Local Master:

docker-machine create --driver amazonec2 --amazonec2-access-key AKIAJ7REY77CI25OTZ9Z --amazonec2-secret-key doKBpA64bmIyROv11J+x1NYGHWKB3SoG8o1b7msj --amazonec2-region eu-west-1 --amazonec2-zone a --amazonec2-ami ami-ab5e0ed8 --amazonec2-instance-type m3.medium --amazonec2-retries 60 --amazonec2-vpc-id vpc-da321fbe --amazonec2-subnet-id subnet-acf6c7da --amazonec2-security-group MLMasterSG --amazonec2-tags Name,ML-Master aws-ml-master

Page 17: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install

47. From the shell and using docker-machine create an AMI Instance ‘aws-ml-slave1’ for Mashery Local Slave:

docker-machine create --driver amazonec2 --amazonec2-access-key AKIAJ7REY77CI25OTZ9Z --amazonec2-secret-key doKBpA64bmIyROv11J+x1NYGHWKB3SoG8o1b7msj --amazonec2-region eu-west-1 --amazonec2-zone a --amazonec2-ami ami-ab5e0ed8 --amazonec2-instance-type m3.medium --amazonec2-retries 60 --amazonec2-vpc-id vpc-da321fbe --amazonec2-subnet-id subnet-acf6c7da --amazonec2-security-group MLSlaveSG --amazonec2-tags Name,ML-Slave1 aws-ml-slave1

Page 18: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install

Create Load Balancer

48. In the EC2 service, navigate to the ‘Load Balancers’:

49. Click ‘Create Load Balancer’ 50. Choose ‘Classic Load Balancer’ and click ‘Continue’ button. 51. Configure Load Balancer:

• Load Balancer Name: MLLB • VPC: MLVPC • Scheme: internet-facing • Listeners:

o Protocol HTTP, Port 80

52. Click ‘Next: Assign Security Group’ button 53. Select only the ‘MLLBSG’ Security Group 54. Click ‘Next: Configure Security Settings’ button 55. Click ‘Next: Configure Health Check’ button 56. Configure Health Check:

• Ping Protocol: From dropdown choose ‘TCP’

57. Click ‘Next: Add EC2 Instances’ button. 58. Select both ‘ML-Master’ and ‘ML-Slave1’ EC2 instances. 59. Click ‘Next: Add Tags’ button 60. Click ‘Review and Create’ button.

Page 19: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install

Load ML Images to AWS EC2 Instances

Loading of the Docker images must be performed using the command-line docker tools.

61. From a shell prompt, cd to the folder containing the Mashery Local images (ml_core.tar.gz, ml_mem.tar.gz, and ml_db.tar.gz)

62. Set environment variables to allow docker-machine to run commands against aws-ml-master EC2 instance:

eval $(docker-machine env aws-ml-master)

63. Load images using docker load command:

docker load –i ./ml_core.tar.gz

docker load –i ./ml_mem.tar.gz

docker load –i ./ml_db.tar.gz

64. Using docker-compose start the container in detached mode: docker-compose up –d

65. Set environment variables to allow docker-machine to run commands against aws-ml-slave1 EC2 instance:

eval $(docker-machine env aws-ml-slave1)

66. Load images using docker load command:

docker load –i ./ml_core.tar.gz

docker load –i ./ml_mem.tar.gz

docker load –i ./ml_db.tar.gz

67. Using docker-compose start the container in detached mode: docker-compose up –d

The Masher Local instance should be accessible from the Public DNS of the EC2 Instances.

The Mashery Local console is accessible on https://<PUBLIC-DNS>>:5480/

Page 20: Deploying and Configuring Mashery Local Docker on Amazon EC2 · 2017-01-26 · Deploying and Configuring Mashery Local Docker on Amazon EC2 Pre-Requisites 1. Download and install