This is a simple Bosh and Cloud Foundry deployment for Virtualbox 7.
- Ubuntu 22.04
- 16GB RAM
- 8 CPUs
you can modify the RAM and CPU in the bosh/operations/vms-resources.yml
file.
Make sure Git is installed on your system.
sudo apt-get install git
Make sure jq is isntalled on your system.
sudo apt-get install jq
Download the latest bosh-cli
release and move it to you $PATH
.
sudo install ~/Downloads/ bosh-cli-x.x.x-linux-amd64 /usr/local/bin/bosh
Install the latest cf-cli
.
wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -
echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
sudo apt-get update
sudo apt-get install cf8-cli
Download the latest credhub
release, extract and move it to
your $PATH
.
tar zxvf ~/Downalods/credhub-linux-amd64-2.9.24.tgz
sudo install ~/Downloads/credhub /usr/local/bin/credhub
Download the latest Virtualbox
and install it.
Don't forget to install the extension pack.
sudo apt install virtualbox virtualbox-dkms virtualbox-ext-pack
You can install ruby with rbenv.
sudo apt install rbenv
rbenv init
rbenv install 3.1.6
In order to use ./scripts/add-cf-admin.sh
, you need to install cf-uaac
or uaa-cli
sudo gem install cf-uaac
Download the latest uaa-cli
release, extract and move it to your
$PATH
.
sudo install ~/Downloads/uaa-linux-amd64-0.14.0 /usr/local/bin/uaa
To create the BOSH and Cloud Foundry deployment, run the following command:
$ ./scripts/create-env.sh
This will :
- deploy BOSH on Virtualbox using bridged network as outbond network.
- deploy BOSH with custom password for vcap user
admin
. - deploy Cloud Foundry on BOSH with the system domain
bosh-lite.com
. - create a directory
deployments
containing:bosh.yml
: BOSH manifestcf.yml
: Cloud Foundry manifestcreds.yml
: credentials for BOSH and Cloud Foundryjumpbox.key
: SSH private key for the jumpboxstate.json
: BOSH state.envrc
: environment variables for bosh cli
By default, the script will create a hostonly
network as followed:
- gateway:
192.168.56.1
- cidr:
192.168.56.0/24
- jumpbox ip:
192.168.56.6
This can be changed in the bosh/vars/vars.yml
file.
You can also change the vcap user's password in the bosh/vars/vars.yml
file.
# use mkpasswd to generate a password hash
mkpasswd -s -m sha-512
Password: REDACTED
$6$p95sDVpIlrzGf0kl$1KP37eS4Jj9nWM/IsS.BcBaMVUO4Arf.Zl8JDRTnpFzqK88h9WSY6qT/dwmr4urjNNKB/2poiuCD6DM7H47WR0
To deploy bosh only, run the following command:
$ ./scripts/deploy-bosh.sh
This will :
- deploy BOSH on Virtualbox using bridged network as outbond network.
- deploy BOSH with custom password for vcap user
admin
. - create a directory
deployments
containing:bosh.yml
: BOSH manifestcreds.yml
: credentials for BOSHjumpbox.key
: SSH private key for the jumpboxstate.json
: BOSH state.envrc
: environment variables for bosh cli
By default, the script will create a hostonly
network as followed:
- gateway:
192.168.56.1
- cidr:
192.168.56.0/24
- jumpbox ip:
192.168.56.6
This can be changed in the bosh/vars/vars.yml
file.
You can also change the vcap user's password in the bosh/vars/vars.yml
file.
# use mkpasswd to generate a password hash
mkpasswd -s -m sha-512
Password: REDACTED
$6$p95sDVpIlrzGf0kl$1KP37eS4Jj9nWM/IsS.BcBaMVUO4Arf.Zl8JDRTnpFzqK88h9WSY6qT/dwmr4urjNNKB/2poiuCD6DM7H47WR0
To deploy Cloud Foundry on an existing BOSH, run the following command:
$ ./scripts/deploy-cf.sh
This will :
- deploy Cloud Foundry on BOSH with the system domain
bosh-lite.com
.
-
To stop the deployment, run the following command:
./scripts/bosh-vm.sh pause
This wil save the state of the bosh vm and stop it.
-
To resume the deployment, run the following command:
./scripts/bosh-vm.sh resume
Using cf-uaac
sudo gem install cf-uaac
source "./deployments/.envrc"
credhub api --server api.bosh-lite.com --skip-tls-validation
uaac target https://uaa.bosh-lite.com --skip-ssl-validation
uaac token client get admin -s "$(credhub g -n "/${bosh_deployment_name}/cf/uaa_admin_client_secret" --output-json | jq .value -r)"
uaac user add "${ACCOUNT_NAME}" -p "${ACCOUNT_PASSWORD}" --emails "${ACCOUNT_EMAIL}"
for group in cloud_controller.admin clients.read clients.secret clients.write uaa.admin scim.write scim.read; do
uaac member add "${group}" "${ACCOUNT_NAME}"
done
You can use the ./scripts/add-cf-admin.sh <account_name> <account_email>
script to add an account.
Using uaa-cli
Download the latest uaa-cli
release, extract and move it to your
$PATH
.
sudo install ~/Downloads/uaa-linux-amd64-0.14.0 /usr/local/bin/uaa
source "./deployments/.envrc"
credhub api --server api.bosh-lite.com --skip-tls-validation
uaac target https://uaa.bosh-lite.com --skip-ssl-validation
uaa get-client-credentials-token admin -s "$(credhub g -n "/${bosh_deployment_name}/cf/uaa_admin_client_secret" --output-json | jq .value -r)"
uaa create-user "${ACCOUNT_NAME}" --email "${ACCOUNT_EMAIL}" --password "${ACCOUNT_PASSWORD}"
for group in cloud_controller.admin clients.read clients.secret clients.write uaa.admin scim.write scim.read; do
uaa add-member "${group}" "${ACCOUNT_NAME}"
done
You can use the ./scripts/add-cf-admin.sh <account_name> <account_email>
script to add an account.
The applications
directory includes a few demo applications.
This is a simple PHP application using php_buildpack
.
# deploy
cd applications/demo-php
# connect to cloud foundry api
cf login -a api.bosh-lite.com --skip-ssl-validation -u $ACCOUNT_NAME -p $ACCOUNT_PASSWORD
cf target -o system
# create space if not exists
cf create-space demo
cf target -s demo
# push the application
cf push
# access through the route
curl -k https://demo-php.bosh-lite.com/
This is a simple binary application using binary_builpack
.
# deploy
cd applications/demo-binary
# connect to cloud foundry api
cf login -a api.bosh-lite.com --skip-ssl-validation -u admin -p REDACTED
cf target -o system
# create space if not exists
cf create-space demo
cf target -s demo
# push the application
cf push
# access through the route
curl -k https://demo-binary.bosh-lite.com/