This project contains the Ansible devops playbooks, templates and files to spin up a Service Fabric cluster of any specified size on AWS. The consumer of the playbook can specify the number of machines, the sizes of the machines, and the AWS deployment region. By default, the playbook uses the following:
# extracted from ./site.yml
ami_id: ami-a9a8e4c9 # EBS Optimized Ubuntu 16.04
key_name: demo-ssh-key # name of the public key to create (uses ~/.ssh/id_rsa.pub)
aws_region: us-west-1 # the deployment region
aws_tag: service-fabric-demo # tag used to count instances
instance_type: m4.large # using 2 CPU, 8 GB, 450 Mbps EBS backed
instance_count: 5 # number of machines
- Install Python 2.7 and Pip
- Install Ansible
- Install Boto
- Setup your AWS credentials for Boto
- Clone this repo and change to the root directory of the repo
- Test boto connectivity with
./ec2.py --list
- From the root directory of this repo
ansible-playbook site.yml -i ec2.py
- Log on to the cluster
ssh ubuntu@{cluster ip}
- Setup an ssh tunnel to view the dashboard locally
ssh -N -p 22 -C ubuntu@{cluster ip} -L 19080:localhost:19080
- After starting the tunnel, open your local browser to https://localhost:19080
- To deploy to the cluster
- you can setup additional ssh tunnels and work locally
- you can open external ports to expose the cluster publicly (by default, the only public port open is 22)
- Example
ssh ubuntu@{cluster ip}
yo azuresf
- name the app
testapp
- select
Reliable Actor Service - Java
- name the actor
testactor
- name the app
cd testapp
gradle
azuresfcli config mode arm
azuresfcli servicefabric cluster connect https://localhost:19080
./install.sh
- Look to your dashboard and you should see your application running in the cluster.
- $$$$
- From the root directory of this repo
ansible-playbook terminate.yml -i ec2.py
Here are some other details to help out anyone not familiar with Ansible.
├── LICENSE
├── README.md
├── ec2.ini
├── ec2.py
├── roles
│ ├── common
│ │ └── tasks
│ │ └── main.yml
│ ├── provision-ec2
│ │ └── tasks
│ │ └── main.yml
│ └── service-fabric
│ ├── tasks
│ │ └── main.yml
│ └── templates
│ └── manifest.xml.j2
├── site.yml
└── terminate.yml
- site.yml is the start of all deployment activity. It includes three roles, provision-ec2, common and service-fabric.
- Roles
- provision-ec2: handles all of the AWS related provisioning
- common: handles bootstrapping the initial Ubuntu image (adds Python 2.7)
- service-fabric: installs and builds the SF cluster
- tasks contains the tasks to be executed during deployment
- templates contains jinja2 template to be deployed to the cluster
- terminate.yml destroys clusters
- ec2.ini contains boto / ec2 configuration defaults
- ec2.py is an inventory script for pulling remote machine inventory from AWS