Skip to content

Instantly share code, notes, and snippets.

@martyca
Last active February 11, 2019 09:04
Show Gist options
  • Save martyca/b39f7b3909ddc95e75a7e5763c03c701 to your computer and use it in GitHub Desktop.
Save martyca/b39f7b3909ddc95e75a7e5763c03c701 to your computer and use it in GitHub Desktop.

Links

Bosh

http://bosh.io

GIT

https://git-scm.com

VMware vSphere

https://www.vmware.com/nl/products/vsphere.html

Bosh repository

https://github.com/cloudfoundry/bosh-deployment

Commands

Workspace in ~/Development

mkdir -p  ~/Development/bosh-vsphere
cd  ~/Development/bosh-vsphere

Clone bosh repository

git clone https://github.com/cloudfoundry/bosh-deployment

Deploy bosh

bosh create-env bosh-deployment/bosh.yml \
  --state=./state.json \
  --vars-store=./creds.yml \
  -o bosh-deployment/vsphere/cpi.yml \
  -v director_name=bosh-director \
  -v internal_cidr=192.168.1.0/24 \
  -v internal_gw=192.168.1.1 \
  -v internal_ip=192.168.1.100 \
  -v network_name= \
  -v vcenter_dc= \
  -v vcenter_ds= \
  -v vcenter_ip= \
  -v vcenter_user= \
  -v vcenter_password= \
  -v vcenter_templates= \
  -v vcenter_vms= \
  -v vcenter_disks= \
  -v vcenter_cluster=

Interpolate admin password from creds.yml

bosh int ./creds.yml --path /admin_password

Create bosh environment alias

bosh -e 192.168.50.2 alias-env virtualbox --ca-cert <(bosh int ./creds.yml --path /director_ssl/ca)

Login to bosh environment

bosh -e virtualbox login

Export bosh environment to environment variable

export BOSH_ENVIRONMENT=virtualbox

Upload cloud-config

bosh update-cloud-config bosh-deployment/warden/cloud-config.yml

Download stemcell

wget https://bosh.io/d/stemcells/bosh-warden-boshlite-ubuntu-trusty-go_agent

Upload stemcell to director

bosh upload-stemcell bosh-warden-boshlite-ubuntu-trusty-go_agent

Nginx release - save this to nginx.yml

---
name: nginx

releases:
- name: nginx
  version: latest

stemcells:
- alias: ubuntu
  os: ubuntu-trusty
  version: latest

instance_groups:
- name: nginx
  instances: 1
  azs: [ z1 ]
  vm_type: default
  stemcell: ubuntu
  networks:
  - name: default
  jobs:
  - name: nginx
    release: nginx
    properties:
      nginx_conf: |
        worker_processes  1;
        error_log /var/vcap/sys/log/nginx/error.log   info;
        events {
          worker_connections  1024;
        }
        http {
          include /var/vcap/packages/nginx/conf/mime.types;
          default_type  application/octet-stream;
          sendfile        on;
          keepalive_timeout  65;
          server_names_hash_bucket_size 64;
          server {
            server_name demo.caarels.lab;
            listen *:80;
            access_log /var/vcap/sys/log/nginx/automate-it-access.log;
            error_log /var/vcap/sys/log/nginx/automate-it-error.log;
          }
        }

update:
  canaries: 1
  max_in_flight: 1
  serial: false
  canary_watch_time: 1000-60000
  update_watch_time: 1000-60000

Deploy nginx

bosh -d nginx deploy nginx.yml

Add route (MAC-OS)

sudo route -n add -net 10.244.0.0/24 192.168.50.2

Add route (CentOS)

ip route add 10.244.0.0/24 via 192.168.50.2 dev eth0

Delete deployment

bosh -d nginx delete-deployment

Delete Environment

bosh delete-env bosh-deployment/bosh.yml \
  --state ./state.json \
  -o bosh-deployment/virtualbox/cpi.yml \
  -o bosh-deployment/virtualbox/outbound-network.yml \
  -o bosh-deployment/bosh-lite.yml \
  -o bosh-deployment/bosh-lite-runc.yml \
  -o bosh-deployment/jumpbox-user.yml \
  -o bosh-deployment/uaa.yml \
  -o bosh-deployment/credhub.yml \
  --vars-store ./creds.yml \
  -v director_name=VirtualBox-Director \
  -v internal_ip=192.168.50.2 \
  -v internal_gw=192.168.50.1 \
  -v internal_cidr=192.168.50.0/24 \
  -v outbound_network_name=NatNetwork
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment