Difference between revisions of "Automated Amazon EC2 Cloud deployments with openQRM on Debian"
(21 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | This | + | This How-To is about how to manage Public and Hybrid Cloud deployments with openQRM. As the deployment manager for Amazon EC2 and its API compatible derivatives (e.g Eucalyptus) openQRM is capable to fully automate Instance provisioning and to add additional value by attaching automated application deployment via Puppet, automated monitoring via Nagios and also high availability on Infrastructure-Level to the providers cloud features. The whole workflow of Instance-deployment in openQRM is exactly the same as for local resources in the internal IT-environment. |
==Requirements== | ==Requirements== | ||
#One physical Server. Alternatively, the installation can be also done within a Virtual Machine | #One physical Server. Alternatively, the installation can be also done within a Virtual Machine | ||
− | # | + | #At least 1 GB of Memory |
− | # | + | #At least 100 GB of Diskspace |
#Optional VT (Virtualization Technology) enabled in the Systems BIOS so that the openQRM Server can run KVM Virtual Machines later | #Optional VT (Virtualization Technology) enabled in the Systems BIOS so that the openQRM Server can run KVM Virtual Machines later | ||
− | ==Install openQRM on Debian== | + | ===Install openQRM on Debian=== |
#Install a minimal Debian on a physical Server | #Install a minimal Debian on a physical Server | ||
#Install and initialize openQRM | #Install and initialize openQRM | ||
− | A detailed | + | A detailed How-To about the above initial starting point is available at [[Install openQRM on Debian]] |
− | For this | + | For this How-To, we have used the same openQRM server as for the How-To [[Virtualisation with KVM and openQRM on Debian]]. |
− | That means with this | + | That means with this How-To we are going to add functionality to an existing openQRM setup. This is to show that openQRM manages all different virtualization and deployment types seamlessly. |
− | This means you can use either the [[Install openQRM on Debian]] or [[ | + | This means you can use either the [[Install openQRM on Debian]] or [[Virtualisation with KVM and openQRM on Debian]] How-To as a starting point. |
− | == | + | == Step-by-Step == |
+ | === Set a custom Domain name === | ||
As the first step after the openQRM installation and initialisation, it is recommended to configure a custom domain name for the openQRM management network. | As the first step after the openQRM installation and initialisation, it is recommended to configure a custom domain name for the openQRM management network. | ||
− | In this Use-Case the openQRM Server has the private Class C IP address 192.168.178.5/255.255.255.0 based on the previous | + | In this Use-Case the openQRM Server has the private Class C IP address 192.168.178.5/255.255.255.0 based on the previous How-To [[Install openQRM on Debian]]. Since the openQRM management network is a private one any syntactically correct domain name can be used e.g. 'my123cloud.net'. |
The default domain name pre-configured in the DNS plugin is "oqnet.org". | The default domain name pre-configured in the DNS plugin is "oqnet.org". | ||
Line 39: | Line 40: | ||
<blockquote>''/usr/share/openqrm/bin/openqrm boot-service view -n dns -a default''</blockquote> | <blockquote>''/usr/share/openqrm/bin/openqrm boot-service view -n dns -a default''</blockquote> | ||
− | == 2.Enabling Plugins == | + | == 2. Enabling Plugins == |
− | For this | + | For this How-To please enable and start the following plugins in the sequence below: |
− | |||
#dns plugin - ''type Networking'' | #dns plugin - ''type Networking'' | ||
#dhcpd plugin - ''type Networking'' | #dhcpd plugin - ''type Networking'' | ||
Line 52: | Line 52: | ||
#sshterm plugin - ''type Management'' | #sshterm plugin - ''type Management'' | ||
#hybrid-cloud - ''type Deployment'' | #hybrid-cloud - ''type Deployment'' | ||
− | Hint: You can use the filter in the plugin list to find plugins by their type easily! | + | '''Hint''': You can use the filter in the plugin list to find plugins by their type easily! |
+ | [[File:Csm 01-openqrm-ec2 01cc83dc1c.png|thumb|390x390px|Plugin Manager|alt=|none]] | ||
+ | == 3. Install the latest Amazon EC2 Tools == | ||
+ | i. Go to Plugins -> Deployment -> Hybrid-Cloud -> About | ||
+ | [[File:Csm 02-openqrm-ec2 032d98a502.png|thumb|390x390px|Plugin Manager|alt=|none]] | ||
+ | There you can find the URLs and information about the latest Amazon EC2 API- and AMI-Tools. | ||
− | + | ii. Follow these steps to install the Amazon EC2 Tools. | |
− | |||
− | + | Please SSH-login to the openQRM server as 'root' and run the following commands: | |
− | + | <blockquote> | |
+ | ''wget s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip''<br> | ||
+ | ''wget s3.amazonaws.com/ec2-downloads/ec2-ami-tools.zip''<br> | ||
+ | ''unzip ec2-api-tools.zip''<br> | ||
+ | ''unzip ec2-ami-tools.zip''<br> | ||
+ | ''mkdir /usr/local/ec2''<br> | ||
+ | ''cp -r ec2-ami-tools-1.4.0.9/* /usr/local/ec2/''<br> | ||
+ | ''cp -r ec2-api-tools-1.6.8.1/* /usr/local/ec2/'' | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
''apt-get update && apt-get install default-jdk''</blockquote> | ''apt-get update && apt-get install default-jdk''</blockquote> | ||
− | + | '''Note''': The version numbers may be different when newer EC2 Tools become available! | |
− | Then please add the following to the system wide profile /etc/profile | + | Then please add the following to the system-wide profile /etc/profile: |
− | # EC2 Tools | + | <blockquote>''# EC2 Tools'' |
− | export EC2_HOME=/usr/local/ec2 | + | ''export EC2_HOME=/usr/local/ec2''<br> |
− | export PATH=$PATH:$EC2_HOME/bin | + | ''export PATH=$PATH:$EC2_HOME/bin'' |
− | export JAVA_HOME=/usr | + | |
+ | ''export JAVA_HOME=/usr''<br></blockquote> | ||
The EC2 API- and AMI Tools are now installed and available in the system path. | The EC2 API- and AMI Tools are now installed and available in the system path. | ||
− | + | Now please log out of the openQRM server and re-login. This is to activate the new profile settings in the environment. After re-login please restart the openQRM server to also activate the profile in its environment by running: | |
− | /etc/init.d/openqrm restart | + | <blockquote>''/etc/init.d/openqrm restart</blockquote> |
To re-check the configuration please run: | To re-check the configuration please run: | ||
− | ec2-describe-regions -O [your-aws-access-key] -W [your-aws-secret-key] | + | <blockquote>''ec2-describe-regions -O [your-aws-access-key] -W [your-aws-secret-key]</blockquote> |
The output of the above command looks like: | The output of the above command looks like: | ||
− | root@debian:~# ec2-describe-regions -O XXXXXXXXXXXXXXXXXXXXX -W YYYYYYYYYYYYYYYYYYYYYYYY | + | <blockquote>''root@debian:~# ec2-describe-regions -O XXXXXXXXXXXXXXXXXXXXX -W YYYYYYYYYYYYYYYYYYYYYYYY |
− | REGION eu-west-1 ec2.eu-west-1.amazonaws.com | + | ''REGION eu-west-1 ec2.eu-west-1.amazonaws.com<br> |
− | REGION sa-east-1 ec2.sa-east-1.amazonaws.com | + | ''REGION sa-east-1 ec2.sa-east-1.amazonaws.com<br> |
− | REGION us-east-1 ec2.us-east-1.amazonaws.com | + | ''REGION us-east-1 ec2.us-east-1.amazonaws.com<br> |
− | REGION ap-northeast-1 ec2.ap-northeast-1.amazonaws.com | + | ''REGION ap-northeast-1 ec2.ap-northeast-1.amazonaws.com<br> |
− | REGION us-west-2 ec2.us-west-2.amazonaws.com | + | ''REGION us-west-2 ec2.us-west-2.amazonaws.com<br> |
− | REGION us-west-1 ec2.us-west-1.amazonaws.com | + | ''REGION us-west-1 ec2.us-west-1.amazonaws.com<br> |
− | REGION ap-southeast-1 ec2.ap-southeast-1.amazonaws.com | + | ''REGION ap-southeast-1 ec2.ap-southeast-1.amazonaws.com<br> |
− | REGION ap-southeast-2 ec2.ap-southeast-2.amazonaws.com | + | ''REGION ap-southeast-2 ec2.ap-southeast-2.amazonaws.com<br> |
− | root@debian:~# | + | ''root@debian:~#</blockquote> |
− | Configure which Amazon EC2 regions to use | + | == 4. Configure which Amazon EC2 regions to use == |
Best practice is to use the 'openqrm' commandline util to setup which Amazon regions to use for the hybrid-cloud plugin. Please login to the openQRM Server system and run the following command as 'root' in a terminal: | Best practice is to use the 'openqrm' commandline util to setup which Amazon regions to use for the hybrid-cloud plugin. Please login to the openQRM Server system and run the following command as 'root' in a terminal: | ||
− | /usr/share/openqrm/bin/openqrm boot-service configure -n hybrid-cloud -a default -k OPENQRM_PLUGIN_HYBRID_CLOUD_REGIONS -v "eu-west-1, us-west-1" | + | <blockquote>''/usr/share/openqrm/bin/openqrm boot-service configure -n hybrid-cloud -a default -k OPENQRM_PLUGIN_HYBRID_CLOUD_REGIONS -v "eu-west-1, us-west-1"</blockquote> |
To (re)view the current configuration of the Hybrid-Cloud plugin please run: | To (re)view the current configuration of the Hybrid-Cloud plugin please run: | ||
− | /usr/share/openqrm/bin/openqrm boot-service view -n hybrid-cloud -a default | + | <blockquote>''/usr/share/openqrm/bin/openqrm boot-service view -n hybrid-cloud -a default</blockquote> |
− | |||
− | |||
− | |||
− | |||
− | + | == 5. Create a Hybrid-Cloud Account == | |
+ | i. Go to Plugins -> Deployment -> Hybrid-Cloud -> Actions and click on 'Add new Account' | ||
+ | [[File:csm_03-openqrm-ec2_abdea0a4c9.png|thumb|390x390px|Account Selection Screen|alt=|none]] | ||
+ | ii. Provide an account name and the AWS Access and Secret Key plus a description for the account. Then click on submit. | ||
+ | [[File:csm_04-openqrm-ec2_9625f7f297.png|thumb|390x390px|Add new Account screen|alt=|none]] | ||
− | Adding the account is then checking to get access via the provided credentials. If configured correctly the account is added as seen below. | + | iii. Adding the account is then checking to get access via the provided credentials. If configured correctly the account is added as seen below. |
You can now easily access all kind of Amazon EC2 functionalities through the different action buttons. | You can now easily access all kind of Amazon EC2 functionalities through the different action buttons. | ||
+ | [[File:csm_05-openqrm-ec2_74b883d91e.png|thumb|390x390px|Account Selection Screen|alt=|none]] | ||
+ | == 6. Choose AMIs for deployment== | ||
+ | i. Go to Plugins -> Deployment -> Hybrid-Cloud -> About | ||
+ | [[File:csm_02-openqrm-ec2_032d98a502.png|thumb|390x390px|About Hybrid-Cloud page|alt=|none]] | ||
− | + | ii. In the section 'Manage and automate public and private clouds' -> AMIs you can find a URL to some current Ubuntu AMIs. Please open the url and find an AMI of your choice in the region of your choice. For this How-To will will use a 'Ubuntu 13.04 64bit' AMI named | |
− | |||
− | |||
− | |||
− | In the section 'Manage and automate public and private clouds' -> AMIs you can find a URL to some current Ubuntu AMIs. Please open the url and find an AMI of your choice in the region of your choice. For this | ||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | 'ami-23a9b057'. | ||
− | + | '''Note:''' Those AMIs are updated frequently so the AMI name may change! | |
+ | [[File:csm_06-openqrm-ec2_1cfbb96e0d.png|thumb|390x390px|Ubuntu AMIs Selection Screen|alt=|none]] | ||
+ | iii. Now go to Plugins -> Deployment -> Hybrid-Cloud -> Actions -> AMI. This will list available AMIs in the selected region. | ||
+ | [[File:csm_07-openqrm-ec2_7c578d7f38.png|thumb|390x390px|Add/Remove Image for AMIs page|alt=|none]] | ||
− | + | iv. Click on the AMI filter 'U' button and find the AMI you have selected on the Ubuntu AMI page. Click on 'Add Image' for that AMI. | |
+ | [[File:csm_08-openqrm-ec2_0bec5042bc.png|thumb|390x390px|Add Image to AMI|alt=|none]] | ||
+ | v. This creates a new available Image object in the openQRM server. | ||
+ | [[File:csm_09-openqrm-ec2_ffb87a7a55.png|thumb|390x390px|New Image object is created|alt=|none]] | ||
− | Create a custom auto-configuration script to the EC2 Instance on S3 | + | == 7. Create a custom auto-configuration script to the EC2 Instance on S3 == |
The integration with Amazon EC2 in openQRM allows to attach a custom script to a starting Instance. The Instance is then running this script on system startup. This can be used in combination with the Puppet integration to fully pre-configure an Instance in EC2. The easiest way to create such a custom auto-configuration script is to use the S3 action in the account overview. This provides you with a File-Manager for S3 and allows to easily upload files to S3. Those files, if set to 'public-read' permission is directly available via http. As an example we create a small bash-script which actually just outputs some text to a file. | The integration with Amazon EC2 in openQRM allows to attach a custom script to a starting Instance. The Instance is then running this script on system startup. This can be used in combination with the Puppet integration to fully pre-configure an Instance in EC2. The easiest way to create such a custom auto-configuration script is to use the S3 action in the account overview. This provides you with a File-Manager for S3 and allows to easily upload files to S3. Those files, if set to 'public-read' permission is directly available via http. As an example we create a small bash-script which actually just outputs some text to a file. | ||
Line 151: | Line 158: | ||
Now go to Plugins -> Deployment -> Hybrid-Cloud -> Actions -> S3 and create a new S3 bucket. | Now go to Plugins -> Deployment -> Hybrid-Cloud -> Actions -> S3 and create a new S3 bucket. | ||
− | + | [[File:Csm 10-openqrm-ec2 194d0af9a0.png|none|thumb|390x390px|Create S3 bucket page]] | |
− | |||
Click on 'Files in bucket' to list the files in the bucket. | Click on 'Files in bucket' to list the files in the bucket. | ||
− | + | [[File:Csm 11-openqrm-ec2 d9809cefc0.png|none|thumb|390x390px|Bucket list page]] | |
− | |||
Click on 'Upload file' button to upload the custom 'my-custom-auto-configure.sh' script from your desktop. | Click on 'Upload file' button to upload the custom 'my-custom-auto-configure.sh' script from your desktop. | ||
+ | [[File:Csm 12-openqrm-ec2 7a76a2eba9.png|none|thumb|390x390px|Upload 'my-custom-auto-configure.sh' script]] | ||
+ | Select the 'my-custom-auto-configure.sh' script from your desktop, set the File Permission to 'public-read' and submit. | ||
+ | [[File:Csm 13-openqrm-ec2 8fa6ddd09d.png|none|thumb|390x390px|Configure uploaded script settings]] | ||
+ | The 'my-custom-auto-configure.sh' script got uploaded to the S3 bucket and is available via http. Please copy the URL of the uploaded script, we are going to paste the URL in the following 'Instance Add' dialog. | ||
+ | [[File:Csm 14-openqrm-ec2 dc080e6f68.png|none|thumb|390x390px|Fully configured custom script]] | ||
− | + | == 8. Pre-configure Nagios service checks == | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | Pre-configure Nagios service checks | ||
Now go to Plugins -> Monitoring -> Nagios3 -> Services. and login to the embedded Nagios server with the openqrm credentials. | Now go to Plugins -> Monitoring -> Nagios3 -> Services. and login to the embedded Nagios server with the openqrm credentials. | ||
− | + | [[File:Csm 32-openqrm-ec2 a7a2765715 (1).png|none|thumb|390x390px|Nagios Server login]] | |
− | |||
Here the standard Nagios configuration after the Debian package is installed. | Here the standard Nagios configuration after the Debian package is installed. | ||
− | + | [[File:Csm 33-openqrm-ec2 2902ec1579.png|none|thumb|390x390px|Standard Nagios configuration installation]] | |
− | |||
Now go to Plugins -> Monitoring -> Nagios3 -> Config -> Services. and click on 'Add new Service' | Now go to Plugins -> Monitoring -> Nagios3 -> Config -> Services. and click on 'Add new Service' | ||
− | + | [[File:Csm 37-openqrm-ec2 9227b98e67.png|none|thumb|390x390px|Nagios3 Add New Service]] | |
− | |||
Select the http service (Port 80) and click on 'Submit' | Select the http service (Port 80) and click on 'Submit' | ||
+ | [[File:Csm 36-openqrm-ec2 ac02e01129.png|none|thumb|390x390px|New service configuration]] | ||
+ | Your Nagios Service check list should look like this after adding the http service | ||
+ | [[File:Csm 37-openqrm-ec2 9227b98e67.png|none|thumb|390x390px|Nagios Service check list]] | ||
− | + | == 9. Create a new Instance on Amazon EC2 == | |
− | + | Go to Datacentre -> Server. and click on 'Add a new Server' | |
− | + | [[File:Csm 15-openqrm-ec2 14cf155c65.png|none|thumb|390x390px|Add new server]] | |
− | |||
− | |||
− | |||
− | |||
− | Create a new Instance on Amazon EC2 | ||
− | Go to | ||
− | |||
− | |||
Provide a name for the new server. Easiest is to use the 'Generate name' button. | Provide a name for the new server. Easiest is to use the 'Generate name' button. | ||
− | + | [[File:Csm 16-openqrm-ec2 d220c08913.png|none|thumb|390x390px|Give the server a name]] | |
− | |||
In the Resource-Select please click on 'New Resource' | In the Resource-Select please click on 'New Resource' | ||
− | + | [[File:Csm 17-openqrm-ec2 cf734acce8.png|none|thumb|390x390px|Allocate resource for new server]] | |
− | |||
Here the list of available Resource types. Please select 'Cloud (localboot) Virtual Machine' | Here the list of available Resource types. Please select 'Cloud (localboot) Virtual Machine' | ||
− | + | [[File:Csm 18-openqrm-ec2 658b0f67ed.png|none|thumb|390x390px|Select Cloud (localboot) Virtual Machine]] | |
− | |||
This forwards to the Hybrid-Cloud plugin actions. Please click on 'Instances' | This forwards to the Hybrid-Cloud plugin actions. Please click on 'Instances' | ||
− | + | [[File:Csm 19-openqrm-ec2 dacbf66243.png|none|thumb|390x390px|Select Account Screen]] | |
− | |||
The following screenshot shows the empty Instance list. Please click on 'Add Instance' | The following screenshot shows the empty Instance list. Please click on 'Add Instance' | ||
+ | [[File:Csm 20-openqrm-ec2 2206ecc055.png|none|thumb|390x390px|Instances for new server]] | ||
+ | In the Instance - Select the AMI, the availability zone, type, keypair and security group. | ||
− | + | '''Hint:''' Keypairs can be managed via the 'Keypair' action, security groups can be managed with the 'Groups' action! | |
− | |||
− | |||
− | Hint: Keypairs can be managed via the 'Keypair' action, security groups can be managed with the 'Groups' action! | ||
Click on submit when finished. | Click on submit when finished. | ||
− | + | [[File:Csm 21-openqrm-ec2 6c2635adc6.png|none|thumb|390x390px|Click on submit]] | |
− | |||
Creating a new Instance automatically creates a new resource in openQRM and forward back into the server wizard. Please select the just created new resource and click on 'Submit' | Creating a new Instance automatically creates a new resource in openQRM and forward back into the server wizard. Please select the just created new resource and click on 'Submit' | ||
− | + | [[File:Csm 22-openqrm-ec2 9ad9e37f36.png|none|thumb|390x390px|Resource allocation]] | |
− | |||
Next select the Image object created from the AMI before. | Next select the Image object created from the AMI before. | ||
− | + | [[File:Csm 23-openqrm-ec2 0d73331be7.png|none|thumb|390x390px|Select the image from the AMI]] | |
− | |||
On this screen please click on 'Submit' to edit the Image parameter. | On this screen please click on 'Submit' to edit the Image parameter. | ||
− | + | [[File:Csm 24-openqrm-ec2 fbcf81a51f.png|none|thumb|390x390px|Click Submit]] | |
− | + | The Edit Image form allows to set a custom password for the server. | |
− | The Image | + | [[File:Csm 25-openqrm-ec2 814a254e2f.png|none|thumb|390x390px|Set a password]] |
− | + | '''Please notice:''' Normally SSH-Access to Amazon EC2 instances works only on behalf of a private- and public keypair. Amazon EC2 keypairs can be easily managed through the 'keypair' action. Anyway openQRM also allows to simply set a password in the Image-Edit section. Setting a password there automatically sets the password in the Instance AMI and enables to allow SSH-Login with password. | |
− | |||
− | Please notice: Normally SSH-Access to Amazon EC2 instances works only on behalf of a private- and public keypair. Amazon EC2 keypairs can be easily managed through the 'keypair' action. Anyway openQRM also allows to simply set a password in the Image-Edit section. Setting a password there automatically sets the password in the Instance AMI and enables to allow SSH-Login with password. | ||
Here the final Server-Edit screen. Click on 'Submit' to save the server configuration. | Here the final Server-Edit screen. Click on 'Submit' to save the server configuration. | ||
+ | [[File:Csm 26-openqrm-ec2 e518821b49.png|none|thumb|390x390px|Click on submit]] | ||
− | + | == 10. Configure Puppet recipes for the EC2 Instance == | |
− | Configure Puppet recipes for the EC2 Instance | + | Go again to Datacentre -> Server. and edit the just created server object. |
− | Go again to | + | [[File:Csm 27-openqrm-ec2 17087b845c.png|none|thumb|390x390px|Edit the newly created server object]] |
− | |||
− | |||
Click on Deployment -> Puppet to add a custom Puppet recipe to the server. | Click on Deployment -> Puppet to add a custom Puppet recipe to the server. | ||
− | + | [[File:Csm 28-openqrm-ec2 f34b3bc6ba.png|none|thumb|390x390px|Add a custom Puppet recipe]] | |
− | |||
Here we choose the included 'webserver' puppet recipe which automatically installs and starts apache. | Here we choose the included 'webserver' puppet recipe which automatically installs and starts apache. | ||
+ | [[File:Csm 39-openqrm-ec2 97c6c68d47.png|none|thumb|390x390px|Select 'webserver']] | ||
+ | The overview of the Puppet deployment configuration looks now like this: | ||
+ | [[File:Csm 30-openqrm-ec2 eed9152a2a.png|none|thumb|390x390px|Puppet deployment configuration]] | ||
− | + | == 11. Set up monitoring for the EC2 Instance == | |
− | + | Go again to Datacentre -> Server and edit the just created server object. Click on Deployment -> Nagios3 | |
− | + | [[File:Csm 31-openqrm-ec2 4eed9fc746.png|none|thumb|390x390px|Server deployment screen]] | |
− | |||
− | Set up monitoring for the EC2 Instance | ||
− | Go again to | ||
− | |||
− | |||
In the Service-Edit form please select the 'http' service and click on 'Submit' | In the Service-Edit form please select the 'http' service and click on 'Submit' | ||
+ | [[File:Csm 39-openqrm-ec2 97c6c68d47.png|none|thumb|390x390px|Click Submit]] | ||
+ | The overview of the Nagios check configuration looks now like this: | ||
+ | [[File:Csm 40-openqrm-ec2 1c0a0daf90.png|none|thumb|390x390px|Nagios Check overview]] | ||
+ | == 12. Starting the EC2 Instance == | ||
+ | To start the configured Amazon EC2 simply start its server object in Datacentre -> Server. This will create and start the Instance on the Amazon Public Cloud, apply the Image password configuration, apply the puppet recipes, configure WebSSH and execute the custom auto-configuration script we have attached to the Instance from S3. | ||
− | + | i. Go to Datacentre -> Server. Select the new created server object and start it | |
− | + | [[File:Csm 41-openqrm-ec2 cc31dfa6b6.png|thumb|390x390px|Datacentre Server Selection page|alt=|none]] | |
− | |||
− | |||
− | |||
− | |||
− | Go to | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | ii. The server object is now activated and the deployment of the Amazon EC2 instances has started.[[File:Csm 42-openqrm-ec2 90a06ab354.png|thumb|390x390px|Amazon EC2 console after we have started the deployment.|alt=|none]] | |
− | + | [[File:Csm 43-openqrm-ec2 6d8e970430.png|thumb|390x390px|alt=|none]] | |
+ | iv. You can now use the 'ssh' button in the server list at Datacenter -> Server to easily login to the Instance. | ||
− | + | '''Note:''' Your browser will warn because of a self-signed ssl certificate for the WebSSH login! Please accept to login. | |
+ | [[File:Csm 48-openqrm-ec2 e720c7fc36.png|thumb|390x390px|A quick check that the webserver is up+running|alt=|none]] | ||
− | + | v. Here a screenshot of the embedded Nagios console with the http service check activated.[[File:Csm 46-openqrm-ec2 2d5b45ef14.png|thumb|390x390px|alt=|none]] | |
− | + | vi. Please re-check /tmp/my-custom-auto-configure.log on the Instance to see you custom script got executed. | |
− | |||
− | + | vii. And here's the Datacentre Dashboard after we have created the Amazon EC2 Instance | |
− | + | [[File:Csm 47-openqrm-ec2 9d58093544.png|thumb|390x390px|You can now fully automate your Amazon EC2 deployment with openQRM|alt=|none]] | |
− | + | [[Category:Tutorial]] | |
− | + | [[Category:Automate]] | |
− | + | [[Category:Amazon EC2]] | |
− | + | [[Category:Deployment]] | |
− | + | [[Category:Debian]] | |
− | + | [[Category:Cloud]] | |
− | |||
− | |||
− | |||
− |
Latest revision as of 09:12, 5 November 2020
This How-To is about how to manage Public and Hybrid Cloud deployments with openQRM. As the deployment manager for Amazon EC2 and its API compatible derivatives (e.g Eucalyptus) openQRM is capable to fully automate Instance provisioning and to add additional value by attaching automated application deployment via Puppet, automated monitoring via Nagios and also high availability on Infrastructure-Level to the providers cloud features. The whole workflow of Instance-deployment in openQRM is exactly the same as for local resources in the internal IT-environment.
Requirements
- One physical Server. Alternatively, the installation can be also done within a Virtual Machine
- At least 1 GB of Memory
- At least 100 GB of Diskspace
- Optional VT (Virtualization Technology) enabled in the Systems BIOS so that the openQRM Server can run KVM Virtual Machines later
Install openQRM on Debian
- Install a minimal Debian on a physical Server
- Install and initialize openQRM
A detailed How-To about the above initial starting point is available at Install openQRM on Debian
For this How-To, we have used the same openQRM server as for the How-To Virtualisation with KVM and openQRM on Debian. That means with this How-To we are going to add functionality to an existing openQRM setup. This is to show that openQRM manages all different virtualization and deployment types seamlessly.
This means you can use either the Install openQRM on Debian or Virtualisation with KVM and openQRM on Debian How-To as a starting point.
Step-by-Step
Set a custom Domain name
As the first step after the openQRM installation and initialisation, it is recommended to configure a custom domain name for the openQRM management network.
In this Use-Case the openQRM Server has the private Class C IP address 192.168.178.5/255.255.255.0 based on the previous How-To Install openQRM on Debian. Since the openQRM management network is a private one any syntactically correct domain name can be used e.g. 'my123cloud.net'. The default domain name pre-configured in the DNS plugin is "oqnet.org".
The best practice is to use the 'openqrm' commandline util to setup the domain name for the DNS plugin. Please login to the openQRM Server system and run the following command as 'root' in a terminal:
/usr/share/openqrm/bin/openqrm boot-service configure -n dns -a default -k OPENQRM_SERVER_DOMAIN -v my123cloud.net
The output of the above command will look like:
root@debian:~# /usr/share/openqrm/bin/openqrm boot-service configure -n dns -a default -k OPENQRM_SERVER_DOMAIN -v my123cloud.net
Setting up default Boot-Service Konfiguration of plugin dns
root@debian:~#
To (re)view the current configuration of the DNS plugin please run:
/usr/share/openqrm/bin/openqrm boot-service view -n dns -a default
2. Enabling Plugins
For this How-To please enable and start the following plugins in the sequence below:
- dns plugin - type Networking
- dhcpd plugin - type Networking
- tftpd plugin - type Networking
- device-manager plugin - type Management
- nfs-storage - type Storage
- lvm-storage - type Storage
- nagios3 - type Monitoring
- puppet - type Deployment
- sshterm plugin - type Management
- hybrid-cloud - type Deployment
Hint: You can use the filter in the plugin list to find plugins by their type easily!
3. Install the latest Amazon EC2 Tools
i. Go to Plugins -> Deployment -> Hybrid-Cloud -> About
There you can find the URLs and information about the latest Amazon EC2 API- and AMI-Tools.
ii. Follow these steps to install the Amazon EC2 Tools.
Please SSH-login to the openQRM server as 'root' and run the following commands:
wget s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip
wget s3.amazonaws.com/ec2-downloads/ec2-ami-tools.zip
unzip ec2-api-tools.zip
unzip ec2-ami-tools.zip
mkdir /usr/local/ec2
cp -r ec2-ami-tools-1.4.0.9/* /usr/local/ec2/
cp -r ec2-api-tools-1.6.8.1/* /usr/local/ec2/apt-get update && apt-get install default-jdk
Note: The version numbers may be different when newer EC2 Tools become available!
Then please add the following to the system-wide profile /etc/profile:
# EC2 Tools
export EC2_HOME=/usr/local/ec2
export PATH=$PATH:$EC2_HOME/binexport JAVA_HOME=/usr
The EC2 API- and AMI Tools are now installed and available in the system path.
Now please log out of the openQRM server and re-login. This is to activate the new profile settings in the environment. After re-login please restart the openQRM server to also activate the profile in its environment by running:
/etc/init.d/openqrm restart
To re-check the configuration please run:
ec2-describe-regions -O [your-aws-access-key] -W [your-aws-secret-key]
The output of the above command looks like:
root@debian:~# ec2-describe-regions -O XXXXXXXXXXXXXXXXXXXXX -W YYYYYYYYYYYYYYYYYYYYYYYY
REGION eu-west-1 ec2.eu-west-1.amazonaws.com
REGION sa-east-1 ec2.sa-east-1.amazonaws.com
REGION us-east-1 ec2.us-east-1.amazonaws.com
REGION ap-northeast-1 ec2.ap-northeast-1.amazonaws.com
REGION us-west-2 ec2.us-west-2.amazonaws.com
REGION us-west-1 ec2.us-west-1.amazonaws.com
REGION ap-southeast-1 ec2.ap-southeast-1.amazonaws.com
REGION ap-southeast-2 ec2.ap-southeast-2.amazonaws.com
root@debian:~#
4. Configure which Amazon EC2 regions to use
Best practice is to use the 'openqrm' commandline util to setup which Amazon regions to use for the hybrid-cloud plugin. Please login to the openQRM Server system and run the following command as 'root' in a terminal:
/usr/share/openqrm/bin/openqrm boot-service configure -n hybrid-cloud -a default -k OPENQRM_PLUGIN_HYBRID_CLOUD_REGIONS -v "eu-west-1, us-west-1"
To (re)view the current configuration of the Hybrid-Cloud plugin please run:
/usr/share/openqrm/bin/openqrm boot-service view -n hybrid-cloud -a default
5. Create a Hybrid-Cloud Account
i. Go to Plugins -> Deployment -> Hybrid-Cloud -> Actions and click on 'Add new Account'
ii. Provide an account name and the AWS Access and Secret Key plus a description for the account. Then click on submit.
iii. Adding the account is then checking to get access via the provided credentials. If configured correctly the account is added as seen below.
You can now easily access all kind of Amazon EC2 functionalities through the different action buttons.
6. Choose AMIs for deployment
i. Go to Plugins -> Deployment -> Hybrid-Cloud -> About
ii. In the section 'Manage and automate public and private clouds' -> AMIs you can find a URL to some current Ubuntu AMIs. Please open the url and find an AMI of your choice in the region of your choice. For this How-To will will use a 'Ubuntu 13.04 64bit' AMI named
'ami-23a9b057'.
Note: Those AMIs are updated frequently so the AMI name may change!
iii. Now go to Plugins -> Deployment -> Hybrid-Cloud -> Actions -> AMI. This will list available AMIs in the selected region.
iv. Click on the AMI filter 'U' button and find the AMI you have selected on the Ubuntu AMI page. Click on 'Add Image' for that AMI.
v. This creates a new available Image object in the openQRM server.
7. Create a custom auto-configuration script to the EC2 Instance on S3
The integration with Amazon EC2 in openQRM allows to attach a custom script to a starting Instance. The Instance is then running this script on system startup. This can be used in combination with the Puppet integration to fully pre-configure an Instance in EC2. The easiest way to create such a custom auto-configuration script is to use the S3 action in the account overview. This provides you with a File-Manager for S3 and allows to easily upload files to S3. Those files, if set to 'public-read' permission is directly available via http. As an example we create a small bash-script which actually just outputs some text to a file.
On your Desktop create a new file named 'my-custom-auto-configure.sh' with the following content:
- !/bin/bash
echo "Here custom commands are running on instance startup" > /tmp/my-custom-auto-configure.log
Now go to Plugins -> Deployment -> Hybrid-Cloud -> Actions -> S3 and create a new S3 bucket.
Click on 'Files in bucket' to list the files in the bucket.
Click on 'Upload file' button to upload the custom 'my-custom-auto-configure.sh' script from your desktop.
Select the 'my-custom-auto-configure.sh' script from your desktop, set the File Permission to 'public-read' and submit.
The 'my-custom-auto-configure.sh' script got uploaded to the S3 bucket and is available via http. Please copy the URL of the uploaded script, we are going to paste the URL in the following 'Instance Add' dialog.
8. Pre-configure Nagios service checks
Now go to Plugins -> Monitoring -> Nagios3 -> Services. and login to the embedded Nagios server with the openqrm credentials.
Here the standard Nagios configuration after the Debian package is installed.
Now go to Plugins -> Monitoring -> Nagios3 -> Config -> Services. and click on 'Add new Service'
Select the http service (Port 80) and click on 'Submit'
Your Nagios Service check list should look like this after adding the http service
9. Create a new Instance on Amazon EC2
Go to Datacentre -> Server. and click on 'Add a new Server'
Provide a name for the new server. Easiest is to use the 'Generate name' button.
In the Resource-Select please click on 'New Resource'
Here the list of available Resource types. Please select 'Cloud (localboot) Virtual Machine'
This forwards to the Hybrid-Cloud plugin actions. Please click on 'Instances'
The following screenshot shows the empty Instance list. Please click on 'Add Instance'
In the Instance - Select the AMI, the availability zone, type, keypair and security group.
Hint: Keypairs can be managed via the 'Keypair' action, security groups can be managed with the 'Groups' action!
Click on submit when finished.
Creating a new Instance automatically creates a new resource in openQRM and forward back into the server wizard. Please select the just created new resource and click on 'Submit'
Next select the Image object created from the AMI before.
On this screen please click on 'Submit' to edit the Image parameter.
The Edit Image form allows to set a custom password for the server.
Please notice: Normally SSH-Access to Amazon EC2 instances works only on behalf of a private- and public keypair. Amazon EC2 keypairs can be easily managed through the 'keypair' action. Anyway openQRM also allows to simply set a password in the Image-Edit section. Setting a password there automatically sets the password in the Instance AMI and enables to allow SSH-Login with password.
Here the final Server-Edit screen. Click on 'Submit' to save the server configuration.
10. Configure Puppet recipes for the EC2 Instance
Go again to Datacentre -> Server. and edit the just created server object.
Click on Deployment -> Puppet to add a custom Puppet recipe to the server.
Here we choose the included 'webserver' puppet recipe which automatically installs and starts apache.
The overview of the Puppet deployment configuration looks now like this:
11. Set up monitoring for the EC2 Instance
Go again to Datacentre -> Server and edit the just created server object. Click on Deployment -> Nagios3
In the Service-Edit form please select the 'http' service and click on 'Submit'
The overview of the Nagios check configuration looks now like this:
12. Starting the EC2 Instance
To start the configured Amazon EC2 simply start its server object in Datacentre -> Server. This will create and start the Instance on the Amazon Public Cloud, apply the Image password configuration, apply the puppet recipes, configure WebSSH and execute the custom auto-configuration script we have attached to the Instance from S3.
i. Go to Datacentre -> Server. Select the new created server object and start it
ii. The server object is now activated and the deployment of the Amazon EC2 instances has started.
iv. You can now use the 'ssh' button in the server list at Datacenter -> Server to easily login to the Instance.
Note: Your browser will warn because of a self-signed ssl certificate for the WebSSH login! Please accept to login.
v. Here a screenshot of the embedded Nagios console with the http service check activated.
vi. Please re-check /tmp/my-custom-auto-configure.log on the Instance to see you custom script got executed.
vii. And here's the Datacentre Dashboard after we have created the Amazon EC2 Instance