Note: Run all the commands in this topic from the ~/deployments
directory that you created in the Deploying MicroBOSH on OpenStack topic.
先决条件
To deploy Cloud Foundry to OpenStack, you must first complete the followingsteps:
- Install the BOSH Command Line Interface (CLI).
-
Confirm that your OpenStack instance includes four flavors that correspondwith the OpenStack default flavor names
m1.small
,m1.medium
,m1.large
, andm1.xlarge
.These flavors must have the following listed specifications, at minimum:OpenStack Flavor Name CPUs RAM (GB) Disk (GB) Ephemeral Disk (GB) m1.small 1 2 10 20 m1.medium 2 4 10 40 m1.large 4 8 10 80 m1.xlarge 8 16 10 160 -
Provision an IP address and set your DNS to map
*
records to this IPaddress.For example, if you usemycloud.com
domain as the base domain foryour Cloud Foundry deployment, set a*
A record for this zone mapping tothe IP address that you provision. -
Create an OpenStack security group named
cf
.Configure thecf
security group as follows:- Open all ports of the VMs in the
cf
security group to all other VMs inthecf
security group. This allows the VMs in thecf
security groupto communicate with each other. - Open port 22 for administrator SSH access.
- Open port 80 for HTTP traffic.
- Open all ports of the VMs in the
Target the BOSH Director
Use the bosh target
command with the IP address of the BOSH Director toconnect to the BOSH Director.Log in with the default user name and password, admin
and admin
, or use theuser name and password that you set when you installed BOSH.
$ bosh target https://192.168.109.81:25555 Target set to `bosh' Your username: admin Enter password: ***** Logged in as 'admin'
Record the BOSH Director UUID
Use the bosh status
command to view information about your BOSH deployment.Record the UUID of the BOSH Director. You use the UUID when Customizing the Cloud Foundry Deployment Manifest Stub for OpenStack.
$ bosh status Config /home/me/.bosh_config Director Name bosh_openstack URL https://192.168.109.81:25555 Version 1.2710.0 (00000000) User admin UUID abcdef12-3456-7890-abcd-ef1234567890 CPI openstack dns enabled (domain_name: bosh) compiled_package_cache disabled snapshots disabled Deployment not set
Upload a Stemcell
-
Open https://bosh.io/stemcells in a web browserto view a list of publicly available BOSH stemcells.The list displays the most recent build numbers of BOSH stemcells, organized by operating system, target IaaS, and hypervisor.
-
Choose a BOSH stemcell for OpenStack and click the build number to download.
-
In a terminal window, run
bosh upload stemcell STEMCELL-NAME
to upload thestemcell to the BOSH Director.$ bosh upload stemcell ./bosh-stemcell-2754-openstack-kvm-ubuntu-trusty-go_agent.tgz
Create a Deployment Manifest Stub
Create a manifest stub file named cf-stub.yml
.Customize the manifest stub for your environment.
Deploy Cloud Foundry
-
Clone the
cf-release
GitHub repository.$ git clone https://github.com/cloudfoundry/cf-release.git
-
Use the
update
helper script to update thecf-release
submodules.$ cd cf-release $ ./update
-
Install spiff.
-
Run the following spiff command from the
cf-release
directory to create a deployment manifest namedcf-deployment.yml
:generate_deployment_manifest INFRASTRUCTURE MANIFEST-STUB > cf-deployment.yml
Replace INFRASTRUCTURE with
openstack
and replace MANIFEST-STUB with the name and location of yourcf-stub.yml file
. For example:$ ./generate_deployment_manifest openstack cf-stub.yml > cf-deployment.yml
Note:
generate_deployment_manifest
can accept a list of stub files. For example:generate_deployment_manifest openstack cf-stub.yml cf-consul.yml > cf-dm.yml
Note: The
cf-deployment.yml
uses the default OpenStack flavor names ofm1.small
,m1.medium
,m1.large
, andm1.xlarge
. If your OpenStack instance uses alternate names for these flavors, change the default flavor names incf-deployment.yml
to match the alternate names that your instance uses. -
Use
bosh target
to target the BOSH Director.$ bosh target Current target is https://192.168.109.81:25555
-
Set your deployment to the generated manifest.
$ bosh deployment cf-deployment.yml
-
Use
bosh create release
to create a Cloud Foundry release.This command prompts you for a development release name.$ bosh create release
-
Use
bosh upload release
to upload the generated release to the BOSHDirector.$ bosh upload release
-
Deploy the uploaded Cloud Foundry release.
$ bosh deploy
Note:
bosh deploy
can take 2-3 hours to complete. -
Use
curl
to test the API endpoint of your Cloud Foundry installation.$ curl api.subdomain.domain/info
If
curl
succeeds, it should return the JSON-formatted information.Ifcurl
does not succeeds, check your networking and make sure your domainhas an NS record for your subdomain. -
You should be able to target your Cloud Foundry installation with the cf Command Line Interface (CLI) and log in as anadministrator.
The user name,
admin
and the password,fakepassword
, are specified inthe deployment manifest under uaa:scim:users.For more information about managing organizations, spaces, users, andapplications, refer to the cf CLI topic.
Update Cloud Foundry
-
If you make change to your manifest, run
bosh deploy
to update your CloudFoundry deployment with these changes. -
If you make changes to the
cf-release
directory, runbosh create release && bosh upload release && bosh deploy
to update your Cloud Foundry deployment with these changes.
Verify the Deployment
- Run
bosh vms
. This command provides an overview of the virtual machines that BOSH manages as part of the current deployment. The state of every VM should show as running.
$ bosh vms +-----------------------------+---------+------------------+---------------+ | Job/index | State | Resource Pool | IPs | +-----------------------------+---------+------------------+---------------+ | nfs_server/0 | running | nfs_server | 10.146.21.174 | | ccdb/0 | running | ccdb | 10.146.21.175 | | cloud_controller/0 | running | cloud_controller | 10.146.21.176 | | collector/0 | running | collector | 10.146.21.178 | | health_manager/0 | running | health_manager | 10.146.21.173 | | nats/0 | running | nats | 10.146.21.172 | | router/0 | running | router | 10.146.21.171 | | syslog/0 | running | syslog | 10.146.21.177 | | uaa/0 | running | uaa | 10.146.21.180 | | uaadb/0 | running | uaadb | 10.146.21.179 | | dea/0 | running | dea | 10.146.21.181 | | saml_login/0 | running | saml_login | 10.146.21.181 | +-----------------------------+---------+------------------+---------------+