This is a sample BOSH release than can be deployed using a Windows stemcell. It has a single job called say-hello that repeatedly prints out a message.

After creating a deployment with this release and the say-hello job you can access the job’s standard out with the bosh log command (see documentation on logs for more information).


Release Structure

$ mkdir sample-windows-release
$ cd sample-windows-release
$ bosh init-release --git
$ bosh generate-job say-hello
jobs/
  say-hello/
    templates/
      post-deploy.ps1
      post-start.ps1
      pre-start.ps1
      start.ps1
    monit
    spec
packages/

spec

The spec file specifies the job name and description. It also contains the templates to render, which may depend on zero or more packages. See the documentation on job spec files for more information.

---
name: say-hello

description: "This is a simple job"

templates:
  start.ps1: bin/start.ps1

packages: []

monit

The monit file includes zero or more processes to run. Each process specifies an executable as well as any arguments and environment variables. See the documentation on monit files for more information. Note, however, that Windows monit files are JSON config files for Windows service wrapper, not config files for the monit Unix utility.

{
  "processes": [
    {
      "name": "say-hello",
      "executable": "powershell",
      "args": [ "/var/vcap/jobs/say-hello/bin/start.ps1" ],
      "env": {
        "FOO": "BAR"
      }
    }
  ]
}

start.ps1

The start.ps1 script executed by the service-wrapper loops indefintely while printing out a message:

while ($true)
{
  Write-Host "I am executing a BOSH job. FOO=${Env:FOO}"
  Start-Sleep 1.0
}

Creating and Deploying the Sample Release

If you have the Director with a Windows stemcell uploaded, you can create the above described release with an empty blobs.yml and final.yml, then try deploying it:

$ cd sample-windows-release
$ bosh create-release --force
$ bosh upload-release
$ bosh -d sample-windows-deployment deploy manifest.yml

For information about deployment basics, see the Basic Workflow documenation.

Here is a sample manifest. For information on manifest basics, see the Deployment Manifest documentation.

name: sample-windows-deployment

releases:
- name: sample-windows-release
  version: latest

stemcells:
- alias: windows
  os: windows2012R2
  version: latest

update:
  canaries: 1
  max_in_flight: 1
  canary_watch_time: 30000-300000
  update_watch_time: 30000-300000

instance_groups:
- name: hello
  azs: [z1]
  instances: 1
  jobs:
  - name: say-hello
    release: sample-windows-release
  stemcell: windows
  vm_type: default
  networks:
  - name: default

Contribute changes to this page