This repository has been archived by the owner on May 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdeploy-to-bosh-lite
executable file
·97 lines (80 loc) · 3.28 KB
/
deploy-to-bosh-lite
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
# Simple script to download binary releases, update, create, and upload source
# releases, generate deployment manifests and deploy releases to bosh-lite.
#
# We assume you have already cloned the necessary releases into ~/workspace.
set -eu
error() {
echo "[ERROR]: $1" 2>&1
exit 1
}
create_bosh_env() {
ssh-keygen -R 192.168.50.6
bosh create-env ~/workspace/bosh-deployment/bosh.yml \
--state ~/workspace/cf-networking-deployments/environments/local/state.json \
-o ~/workspace/bosh-deployment/virtualbox/cpi.yml \
-o ~/workspace/bosh-deployment/virtualbox/outbound-network.yml \
-o ~/workspace/bosh-deployment/bosh-lite.yml \
-o ~/workspace/bosh-deployment/bosh-lite-runc.yml \
-o ~/workspace/bosh-deployment/jumpbox-user.yml \
-o ~/workspace/bosh-deployment/local-dns.yml \
--vars-store ~/workspace/cf-networking-deployments/environments/local/creds.yml \
-v director_name="Bosh Lite Director" \
-v internal_ip=192.168.50.6 \
-v internal_gw=192.168.50.1 \
-v internal_cidr=192.168.50.0/24 \
-v outbound_network_name="NatNetwork"
}
set_bosh_env() {
bosh -e 192.168.50.6 --ca-cert <(bosh int ~/workspace/cf-networking-deployments/environments/local/creds.yml --path /director_ssl/ca) alias-env vbox
export BOSH_CLIENT="admin"
export BOSH_CLIENT_SECRET="$(bosh int ~/workspace/cf-networking-deployments/environments/local/creds.yml --path /admin_password)"
export BOSH_ENVIRONMENT="vbox"
export BOSH_DEPLOYMENT="cf"
export BOSH_CA_CERT="/tmp/bosh-lite-ca-cert"
bosh int ~/workspace/cf-networking-deployments/environments/local/creds.yml --path /director_ssl/ca > ${BOSH_CA_CERT}
}
upload_bosh_stemcell() {
STEMCELL_VERSION="$(bosh int ~/workspace/cf-deployment/cf-deployment.yml --path=/stemcells/0/version)"
echo "will upload stemcell ${STEMCELL_VERSION}"
bosh -e vbox upload-stemcell "https://bosh.io/d/stemcells/bosh-warden-boshlite-ubuntu-trusty-go_agent?v=${STEMCELL_VERSION}"
}
upload_cloud_config() {
bosh -e vbox -n update-cloud-config ~/workspace/cf-deployment/iaas-support/bosh-lite/cloud-config.yml
}
deploy_cf() {
bosh deploy --no-redact -n ~/workspace/cf-deployment/cf-deployment.yml \
-o ~/workspace/cf-deployment/operations/use-compiled-releases.yml \
-o ~/workspace/cf-deployment/operations/bosh-lite.yml \
-o ~/workspace/cf-deployment/operations/experimental/use-bosh-dns-for-containers.yml \
-o ~/workspace/cf-deployment/operations/experimental/use-bosh-dns.yml \
-o ~/workspace/cf-app-sd-release/opsfiles/use-latest-capi.yml \
-o ~/workspace/cf-deployment/operations/experimental/enable-service-discovery.yml \
-o ~/workspace/cf-app-sd-release/opsfiles/use-latest.yml \
--vars-store ~/workspace/cf-networking-deployments/environments/local/deployment-vars.yml \
-v system_domain=bosh-lite.com
}
upload_local_release() {
bosh create-release --force
bosh upload-release
}
main() {
if [ "$(uname)" == "Darwin" ]; then
sudo route add -net "$ips" "$gw"
fi
create_bosh_env
set_bosh_env
if [ "$(uname)" == "Linux" ]; then
sudo ip route add "$ips" via "$gw"
fi
if [ "$upload_stemcell" == true ]; then
upload_bosh_stemcell
fi
upload_cloud_config
upload_local_release
deploy_cf
}
ips="10.244.0.0/16"
gw="192.168.50.6"
upload_stemcell=true
main