Skip to content

Instantly share code, notes, and snippets.

@sneal
Last active May 13, 2023 15:01
Show Gist options
  • Save sneal/61061fb69aaa30be29e4 to your computer and use it in GitHub Desktop.
Save sneal/61061fb69aaa30be29e4 to your computer and use it in GitHub Desktop.
Add Windows diego to dev pcf

This builds upon the exsting PcfDev Vagrant box by adding a Windows 2012R2 cell capable of hosting .NET 4.5 applications.

Bring up the PcfDev Vagrant box

Add the following provisioner block before the existing provisioner block in the PcfDev Vagrantfile and before you initially bring up the box:

  # Special provisioner to support Windows Cells
  config.vm.provision "shell", run: "once" do |s|
    s.inline = <<-SCRIPT
      echo "- description: Windows Server 2012 R2" >> /var/vcap/jobs/cloud_controller_ng/config/stacks.yml
      echo "  name: windows2012R2" >> /var/vcap/jobs/cloud_controller_ng/config/stacks.yml
      grep -rl "10.0.2.15" /var/vcap/data/jobs | xargs sed -i 's/10.0.2.15/#{local_public_ip}/g'
    SCRIPT
  end

This binds the CF services to the host only interface instead of the NAT'd interface.

Bring up the box according to the PcfDev Vagrant box instructions. Once you see "48 out of 49 running" for a few times, CTRL-C out of the process (this is a workaround for now).

Create a Windows 2012R2 cell

Grab the Windows Cell Vagrantfile and place it another directory separate from the PcfDev Vagrantfile. Bring up the Windows Vagrant box: vagrant up. This will download a public Windows 2012R2 Vagrant box and configure it as a cell in a working CF/Diego deployment.

Push a .NET application

  1. Target your new CF instance: cf api api.local.pcfdev.io --skip-ssl-validation
  2. Login to CF: cf login (user: admin, pwd: admin)
  3. Create a dev space: cf create-space dev
  4. Target the new space: cf target -o "pcfdev-org" -s "dev"
  5. Clone the .NET sample app and push it to CF
git clone https://github.com/cloudfoundry-incubator/NET-sample-app.git
cd NET-sample-app
cf push my-app -s windows2012R2 -b binary_buildpack -u none -p ./ViewEnvironment/

Once you see an App Started message, open your browser to http://my-app.local.pcfdev.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment