1.6. Create a Fabric Server
What is a Fabric Server?
The first step in creating a new fabric in the cloud is to create a Fabric Server instance. A Fabric Server is a container with a Fabric Registry Agent deployed inside it (there must be at least one Fabric Server in a fabric). You can think of it as a seed for the rest of the fabric.
What happens when you create a Fabric Server?
The
fabric:container-create-cloud
console command, which creates the Fabric Server, is a powerful command that does a lot of things:
- Using the JClouds library, it connects to the AWS and creates a new compute instance in the cloud.
- It uploads your SSH public key to the compute instance.
- It installs all of the basic prerequisites for provisioning and running an Red Hat JBoss Fuse container in the compute instance (for example, by installing JDK 1.6).
- It installs JBoss Fuse in the compute instance.
- It starts up the JBoss Fuse container and deploys a Fabric Registry Agent into the container, so that it functions as a Fabric Server.
- It modifies the EC2 firewall settings for the compute instance (if necessary, creating a new EC2 security group).
Creating a Fabric Server on a micro instance
To create a Fabric Server on a micro instance,
t1.micro
(in Amazon's free usage tier) using a Red Hat Enterprise Linux (RHEL) 6.0 image, enter the following console command:
JBossFuse:karaf@root> fabric:container-create-cloud --name aws-ec2 --ensemble-server --new-user admin --new-user-password admin --zookeeper-password admin --hardwareId t1.micro --os-family rhel --os-version 6.0 registry
This command creates a container called
registry
and the --ensemble-server
option makes the new container a Fabric Server. This command can take a minute or two to complete. If it is successfully, you should see output like the following:
Looking up for compute service. Creating 1 nodes in the cloud. Using operating system: rhel. It may take a while ... Node fabric-24be8a5c has been created. Configuring firewall. Installing fabric agent on container registry. It may take a while... Overriding resolver to publichostname. [id] [container] [public addresses] [status] us-east-1/i-24be8a5c registry [50.19.18.91] success
Creating a Fabric Server on a small instance
The amount of memory available in a micro instance is a bit limited for a Red Hat JBoss Fuse container instance. If you want to create a fabric for a production deployment, it is typically better to use at least a small instance,
m1.small
. You can create a small instance, as follows:
JBossFuse:karaf@root> fabric:container-create-cloud --name aws-ec2 --ensemble-server --new-user admin --new-user-password admin --zookeeper-password admin --hardwareId m1.small --os-family rhel --os-version 6.0 registry
Important
An
m1.small
instance is not covered by the Amazon free usage tier and incurs an hourly usage charge (until the instance is terminated).
SSH login to the new instance
It should now be possible to log on to the new compute instance using SSH. Open a new command prompt and enter the following command:
ssh 50.19.18.91
Where you provide the compute instance's public IP address as the argument to the
ssh
command (you could also use the compute instance's public hostname). The ssh command uses the default RSA private key as credentials.
If you did not put your SSH key pair in the default location, you can specify the private key location explicitly, as follows:
ssh -i PrivateKeyFile 50.19.18.91
Hardware list
If you want to see all of the hardware options available, use the
jclouds:hardware-list
console command:
karaf@root> jclouds:hardware-list [id] [cpu] [cores] [ram] cc1.4xlarge 32.0 8.0 23552.0 cg1.4xlarge 32.0 8.0 22528.0 cc2.8xlarge 88.0 16.0 61952.0 t1.micro 1.0 1.0 630.0 c1.medium 5.0 2.0 1740.0 c1.xlarge 20.0 8.0 7168.0 m1.large 4.0 2.0 7680.0 m1.small 1.0 1.0 1740.0 m1.medium 2.0 1.0 3750.0 m1.xlarge 8.0 4.0 15360.0 m2.xlarge 6.5 2.0 17510.0 m2.2xlarge 13.0 4.0 35020.0 m2.4xlarge 26.0 8.0 70041.0
Image list
If you want to find out what machine images are available on Amazon EC2, enter the following console command:
JBossFuse:karaf@root> jclouds:image-list
Groups and security
Fabric automatically configures an Amazon EC2 security group for the new containers. All of the containers in a fabric should belong to the same security group. By default, Fabric adds all of the cloud containers to the
fabric
group. If necessary, you can specify the group explicitly by specifying the --group
option on the fabric:container-create-cloud
command.