Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

Commit

Permalink
Add Windows build instruction with Chef
Browse files Browse the repository at this point in the history
  • Loading branch information
repeatedly committed Jan 25, 2018
1 parent 3ba22c1 commit 9266a2b
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions td-agent-on-windows-with-chef.md
@@ -0,0 +1,82 @@
td-agent-build with Chef on Windows 2012 R2

# Install Chef

Install `Chef Development Kit 2.2.1`. Latest versions have a problem with `bundle exec` so use 2.2.1 for now.

If you use latest version, e.g. 2.4.x, you hit `block in replace_bin_path': can't find executable omnibus for gem omnibus` error.

# Init chef-repo

Run Chef Powershell and type commands:

```
$ gem install knife-solo --no-document --pre # 0.6.x doesn't work so need pre version for avoiding gem mismatch.
$ knife solo init chef-repo
$ cd chef-repo
$ git init . ; git add . ; git commit -m "first" # Need git repo for "knife cookbook site install"
```

# Install omnibus cookbook

```
$ knife cookbook site install omnibus
# $ chef generate cookbook cookbooks/tdagent
```

# Clone omnibus-td-agent

This is in git shell, not chef PowerShell because `gem_downloader` uses `wget`.

```
$ git clone https://github.com/treasure-data/omnibus-td-agent
$ PATH=/c/optscode/chefdk/embedded/bin:$PATH
$ ruby -Ilib ./bin/gem_downloader core_gems.rb
$ ruby -Ilib ./bin/gem_downloader plugin_gems.rb
```

# Setup files

## chef-repo/solo.rb

```
cookbook_path ["C:/Users/Administrator/chef-repo/cookbooks"]
```

## chef-repo/chef.json

```
{
"run_list":[
"recipe[omnibus::default]"
]
}
```

Run `chef-solo` in chef-repo in Chef PowerShell. This will install omnibus-toolchain. omnibus-toolchain includes compilers and some tools for omnibus projet build.

```
$ chef-solo -c .\solo.rb -j .\chef.json
```

## Windows SDK

There is no mention about Windows SDK in the document of Omnibus, but SDK tools, `makeappx` command, are required by Omnibus when creating MSI.

Download [Windows SDK](https://developer.microsoft.com/windows/downloads/windows-10-sdk) and install it.

The installer does not set bin directory to `PATH` environment variable.
Therefore, you have to set `C:\Program Files (x86)\Windows Kits\10\bin\x64` or similar to `PATH`.

## Build td-agent3

After installed omnibus-toolchain and related tools, use `cmd.exe` to build td-agent3. Don't use PowerShell because omnibus-toolchain assumes `cmd.exe`.


```
# Load env settings
$ C:\omnibus\load-omnibus-toolchain.bat
$ bundle install
$ bundle exec omnibus build td-agent3
```

0 comments on commit 9266a2b

Please sign in to comment.