Note: Does this article guide you to build a cloudfoundry cluster directly in the production environment. However, if you try to build a CF cluster in your IAAs (which can be used, believe me), here is a quick and effective guidance method.
The following assumes that you have basic cloudfoundry and PAAs knowledge, experienced microcloudfoundry, and even created your own single-node CF instance.
If you don't have one, you need to study cf for a few days, check the official website guide, and then decide whether to create a PAAs cluster.
We know that almost all types of IAAs support fast backup and restoration, such as snapshot or template ). Users can easily create another virtual machine from one virtual machine. In this case, we should be able to create a cluster only based on the "clone" of a single node cloudfoundry. This is the basic idea of this article.
Compared to this method http://support.cloudfoundry.com/entries/20407923-single-multi-node-vcap-deployment-using-chef that installs some CF components on each virtual machine and then starts one by one,
We are doing a lot of work. But the problem arises:
Anyone who has installed a complete single-node cloudfoundry (especially inside the firewall) knows that this work is actually very difficult. Our actual work is much more complicated than the shell command in readme. Alan and I experienced the huge crash of Chef tools in May and many changes in cloudfoundry dependencies. As a result, we had to modify chef files multiple times and fix many bugs.
By the way, the installation script on GitHub in August is also a bit of a problem: the rabbitmq-server-with-plugins-generic-unix-2.4.1.tar.gz package can not be downloaded. We have manually changed it to the two packages of the old script for installation. I didn't have time to mention issue, but it should be corrected soon.
With regard to a large number of external dependencies, cloudfoundry's current installation method is to transfer all dependencies to CF blob, so you do not need to write the URL of the dependency package to the end, however, the dependent package name is still hard code. If you are interested in chef principles, we have posted a post on chef and CF installation in the Forum:
Http://topic.csdn.net/u/20120903/23/d0d7017e-8de3-4931-839f-6c9820f8960c.html? 76371
Now, let's get down to the truth. What we want most now is to first use dev_setup to install a separate cloudfoundry virtual machine and then make it into a template ). Next, we can clone n cloudfoundry nodes by using this template, and connect them with a simple configuration. a cf cluster can be used. More importantly, this template can be saved as a stable version. It will be cloned for later installation without having to go through the thrilling single-node installation process. (There is currently a different version of cloudfoundry template pool in our lab. It is very convenient to use it directly when you need to study it)
Now, let's start!
Step 1. First we need to install a single-node cloudfoundry!
If we are lucky, using the dev_setup method to install a single node cloudfoundry for the template is a very easy process. Option2 in the following document is enough:
Http://support.cloudfoundry.com/entries/20407923-single-multi-node-vcap-deployment-using-chef
However, as mentioned above, we may wish to make some preparations on the following points before unexpected situations arise. (Especially when you do experiments behind the company firewall)
0. Make sure that you are using a ubuntu10.04 64bit Virtual Machine Based on a certain IAAs. The cleaner the better. Then, clone the required source code package at the specified location and check whether there is any empty folder. The installation path and network proxy can be customized using parameters. You must read the following readme more:
Https://github.com/cloudfoundry/vcap/tree/master/dev_setup#readme
1. Many companies prohibit git: Protocol clone. However, such a protocol must be used when many gem packages are installed (gemfile) in CF.
You can try git clone git: // github.com/cloudfoundry/vcap-common.git. If timeout is reached, it will be disabled. The modification method is very simple:
Find all files similar to ../vcap/cloud_controller/gemfile and replace git: // With https ://
(I directly replaced it with the SED command ). Other locations include./vcap/health_manager/gemfile and./vcap/services/./gemfile.
2. All components are installed by default, so you can directly run ../vcap/dev_setup/bin/vcap_dev_setup. Next, stare at the screen and you will probably notice the following prompt:
gpg: requesting key 83EF826A from hkp server apt.opscode.comgpg: no valid OpenPGP data found.gpg: Total number processed: 0
This means that the key cannot be requested because the port of the GPG request key is disabled. The solution is also very simple. Add the parameter to request through port 80 and directly execute:
Apt-key adv -- Recv-keys -- keyserver HKP: // apt.opscode.com/packages@opscode.com.gpg.key:80 83ef826a
You will see the Correct prompt :(Parameters83ef826a is your public key, which must be consistent with the previous one.
)
gpg: requesting key 83EF826A from hkp server apt.opscode.comgpg: key 83EF826A: public key imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1)
Then run the installation script.
3. Check the commit history of each package on GitHub. The bug is fixed almost every day. Therefore, we can choose a more stable commit for our installation experiment. If you have pull or reset the version of the vcap library, do not forget to update its sub-package (such as uaa or something ). CD to each repo to see the commit log, you can ensure the Time of the source code. The commit log is as follows:
Vcapcommit decf636f565e0fb063548cfad616e94d5757c25b
Author: harshawardhan gadgil Date: Fri Jun 22 11:56:35 2012-0700
Uaa commit 56063b744884ea98dfa89587844e56f554356541
Author: Dave syer <dsyer@vmware.com>
Date: Fri May 18 19:14:24 2012 + 0100
Services commit e18b0bb360c3d86d9c210ce2e97c7230d639eec2
Author: harshawardhan gadgil Date: Fri Jun 8 15:38:08 2012-0700
Well, install it with confidence.
The following lists common troble shooting:
1. After the VM is restarted, cloudcontroller cannot be started. The log shows:Can not connect to the sever...This is mostly due to the failure of PostgreSQL. Run/etc/init. d/postgresql-8.4 restart
Generally, the problem is solved.
2. The uaa log has an error, which usually occurs during installation. The simplest method is to upgrade uaa to the latest code version, and then re-execute the installation process.
3. If there is a timeout problem during the installation process, it is not difficult to locate the dependency of the component (such as the Tomcat jar package) by reading the track. Then, you can refer to the previous chef article and try to get rid of it.Download
These dependent URLs.
However, if the newer CF already uses blob to cache These dependencies, this cannot be changed. At this time, we can manually configure the dependencies of the corresponding version. The following steps are for your reference:
CD to../dev_setup/cookbooks;
Among them, ../attributes/Default. RB defines various dependent versions and paths;
If the error is caused by the service installation process, you need to check the installation code defined in ../recipes/Default. RB. and comment out the cf_remote_filetarball_path section;
Place the following Dependencies
Run the installation script again under/var/Cache/dev_setup.
If the problem you encounter cannot be solved, you have to reset the source code to the old one ....
Well, after the above efforts, it is no problem to install a complete single-node cf. Do not forget to read the above readme more. There is a lot of information you need to know in advance. For example, you need to set a variable to true and then execute the installation script to ensure that your CF has the service lifecycle management function.
In Part2, we will continue to explain how to create virtual machine templates and quickly build CF clusters based on these templates.