---
title: Cloud Foundry(v226)をBOSH-Liteでインストールメモ
tags: ["Cloud Foundry", "BOSH", "BOSH-Lite"]
categories: ["Dev", "PaaS", "CloudFoundry"]
date: 2016-01-05T14:40:29Z
updated: 2016-09-14T03:44:30Z
---

**!!注意!!**

<strong>
この記事は古いです。<a href="https://blog.ik.am/entries/389">こちら</a>を参照してください。
</strong>

今まで、ずっとインストールに失敗して[MicroPCF](https://blog.ik.am/entries/361)に逃げていたけれど、やっぱりCloud Foundryを学ぶ上でBOSHは避けて通れないので、再挑戦。
ようやくうまくいったので、メモ。とりあえず手順だけ。コマンドの意味の説明は追々。

インストール時の環境は以下です。

* OS X El Capitan (10.11.1)
* iMac (Retina 5K, 27-inch, Late 2015) 3.3 GHz Intel Core i5, 32 GB 1867 MHz DDR3
* Vagrant 1.7.4
* VirtualBox 5.0.10r104061
* BOSH-Lite [9000.85.0](https://github.com/cloudfoundry/bosh-lite/releases/tag/9000.85.0)
* Cloud Foundry [v226](https://github.com/cloudfoundry/cf-release/releases/tag/v226)


``` console
$ sudo gem install bosh_cli --no-ri --no-rdoc
```

``` console
$ mkdir workspace
```

``` console
$ cd workspace
```

``` console
$ git clone https://github.com/cloudfoundry/bosh-lite.git
```

``` console
$ vagrant up --provider=virtualbox
```

``` console
$ export no_proxy=xip.io,192.168.50.4
```

``` console
$ bosh target 192.168.50.4 lite
admin/admin
```

``` console
$ bosh login
admin/admin
```

``` console
$ bin/add-route
+ old_ips=10.244.0.0/19
+ ips=10.244.0.0/16
+ gw=192.168.50.4
+ echo 'Adding the following route entry to your local route table to enable direct container access: 10.244.0.0/16 via 192.168.50.4. Your sudo password may be required.'
++ uname
+ '[' Darwin = Darwin ']'
+ sudo route delete -net 10.244.0.0/19 192.168.50.4
Password:
route: writing to routing socket: not in table
delete net 10.244.0.0: gateway 192.168.50.4: not in table
+ sudo route delete -net 10.244.0.0/16 192.168.50.4
route: writing to routing socket: not in table
delete net 10.244.0.0: gateway 192.168.50.4: not in table
+ sudo route add -net 10.244.0.0/16 192.168.50.4
add net 10.244.0.0: gateway 192.168.50.4
```

``` console
$ cd ..
```

``` console
$ git clone https://github.com/cloudfoundry/cf-release.git
```

``` console
$ cd cf-release
```

``` console
$ git checkout v226
```

``` console
$ bosh upload release https://bosh.io/d/github.com/cloudfoundry/cf-release?v=226
```
ログは https://gist.github.com/making/4115a4e4ea61fe5fa7b0

``` console
$ ./scripts/update 
```
ログは https://gist.github.com/making/9968a23abc2dac12aec0

``` console
$ sudo gem install bundler
```

``` console
$ wget https://github.com/cloudfoundry-incubator/spiff/releases/download/v1.0.7/spiff_darwin_amd64.zip
```

``` console
$ unzip spiff_darwin_amd64.zip
```

``` console
$ mv spiff /usr/local/bin/
```

``` console
$ sudo ./scripts/generate-bosh-lite-dev-manifest 
Deployment set to `/Users/maki/workspace/cf-release/bosh-lite/deployments/cf.yml'
```

``` console
$ bosh upload stemcell https://s3.amazonaws.com/bosh-warden-stemcells/bosh-stemcell-3147-warden-boshlite-ubuntu-trusty-go_agent.tgz
Acting as user 'admin' on 'Bosh Lite Director'

Using remote stemcell `https://s3.amazonaws.com/bosh-warden-stemcells/bosh-stemcell-3147-warden-boshlite-ubuntu-trusty-go_agent.tgz'

Director task 4
  Started update stemcell
  Started update stemcell > Downloading remote stemcell. Done (00:04:53)
  Started update stemcell > Extracting stemcell archive. Done (00:00:03)
  Started update stemcell > Verifying stemcell manifest. Done (00:00:00)
  Started update stemcell > Checking if this stemcell already exists. Done (00:00:00)
  Started update stemcell > Uploading stemcell bosh-warden-boshlite-ubuntu-trusty-go_agent/3147 to the cloud. Done (00:00:10)
  Started update stemcell > Save stemcell bosh-warden-boshlite-ubuntu-trusty-go_agent/3147 (d9c47c25-b5f8-4f06-7531-9244dc207653). Done (00:00:00)
     Done update stemcell (00:05:06)

Task 4 done

Started		2016-01-05 12:51:38 UTC
Finished	2016-01-05 12:56:44 UTC
Duration	00:05:06

Stemcell uploaded and created.
```

``` console
$ bosh stemcells
Acting as user 'admin' on 'Bosh Lite Director'

+---------------------------------------------+---------------+---------+--------------------------------------+
| Name                                        | OS            | Version | CID                                  |
+---------------------------------------------+---------------+---------+--------------------------------------+
| bosh-warden-boshlite-ubuntu-trusty-go_agent | ubuntu-trusty | 3147    | d9c47c25-b5f8-4f06-7531-9244dc207653 |
+---------------------------------------------+---------------+---------+--------------------------------------+

(*) Currently in-use

Stemcells total: 1
```

``` console
$ bosh deploy
```
ログは https://gist.github.com/making/bc00f5a7acc727104bbd

``` console
$ bosh vms
Acting as user 'admin' on 'Bosh Lite Director'
Deployment `cf-warden'

Director task 10

Task 10 done

+---------------------------------------------------------------------------+---------+-----+-----------+--------------+
| VM                                                                        | State   | AZ  | VM Type   | IPs          |
+---------------------------------------------------------------------------+---------+-----+-----------+--------------+
| api_z1/0 (937db9a9-6ccb-4911-a461-4498a4c02438)                           | running | n/a | large_z1  | 10.244.0.134 |
| consul_z1/0 (94b921ab-1707-4bd8-9210-3c98916c244b)                        | running | n/a | small_z1  | 10.244.0.54  |
| doppler_z1/0 (e24d76f4-b4e1-4635-bbea-41b4505a5a94)                       | running | n/a | medium_z1 | 10.244.0.142 |
| etcd_z1/0 (b2a266e6-398b-4267-b320-1d7ede34c279)                          | running | n/a | medium_z1 | 10.244.0.42  |
| ha_proxy_z1/0 (b76a8bee-1625-4494-91cc-130f034877f3)                      | running | n/a | router_z1 | 10.244.0.34  |
| hm9000_z1/0 (57d26dc9-efe4-404f-9098-d53e05f245b2)                        | running | n/a | medium_z1 | 10.244.0.138 |
| loggregator_trafficcontroller_z1/0 (5c74c7d6-9042-43e4-b65e-9ad0efd39e84) | running | n/a | small_z1  | 10.244.0.146 |
| nats_z1/0 (04d0adc1-8285-48b7-8402-308b417a1f86)                          | running | n/a | medium_z1 | 10.244.0.6   |
| postgres_z1/0 (5883ff27-1dcb-46e7-88ea-7dcca97d1ea6)                      | running | n/a | medium_z1 | 10.244.0.30  |
| router_z1/0 (49768ef4-51d6-4f54-a64e-f14443c3eaa1)                        | running | n/a | router_z1 | 10.244.0.22  |
| runner_z1/0 (78ef9673-a2d3-4d3b-b4af-53f72cae7597)                        | running | n/a | runner_z1 | 10.244.0.26  |
| uaa_z1/0 (87d561fc-e996-4fe2-a976-cb30cde240e6)                           | running | n/a | medium_z1 | 10.244.0.130 |
+---------------------------------------------------------------------------+---------+-----+-----------+--------------+

VMs total: 12
```

``` console
$ cf login -a api.bosh-lite.com -u admin -p admin --skip-ssl-validation
API endpoint: api.bosh-lite.com
Authenticating...
OK


                   
API endpoint:   https://api.bosh-lite.com (API version: 2.44.0)   
User:           admin   
No org or space targeted, use 'cf target -o ORG -s SPACE'

```

できた＼(^o^)／
あとは[前記事](https://blog.ik.am/entries/361)の内容と同じですね。


`bosh upload`は各々一回こけたのですが、再度実行すればうまくいきました。

[次](https://blog.ik.am/entries/370)は次世代アーキテクチャのDiegoをデプロイする。
