The Chef cookbook is no longer under active development and is not officially supported by Alteryx. This post is preserved for interested parties as an example of one of the ways to automate Alteryx Server deployments.
Here at Alteryx, we've been using Chef to automate deployments of our many Alteryx Server installations. Chef cookbooks have enabled us to transition from a manual update process, taking multiple man hours, to a push-button deployment that runs in less than 10 minutes. With the release of Alteryx 10.6, we're proud to be rolling out our first release of the Alteryx Server cookbook. This means that the Alteryx community can now leverage Chef to make Alteryx Server management that much easier.
In this post, we'll go over how to use Chef to provision a stand-alone Alteryx Server. If you just want to dig into the code, check out our repo on GitHub.
Chef is an automation framework that eases the burdens of configuration management, node provisioning, and application deployments. It's one of a handful of popular automation frameworks such as Ansible, Puppet, and SaltStack.
To put it simply, using automation frameworks like Chef make environments predictable, quick to configure, and repeatable.
Admins like predictable servers. By having Chef do your configuration, there's no worry that something's been forgotten in the setup of a server.
Admins also don't like wasting time. Chef allows nodes to be configured programmatically, greatly reducing the amount of time needed to bring a server up.
Admins also like to be able to revert to a good state when things go wrong. And things always go wrong. Chef makes it so we can treat servers as cattle rather than pets. Has something gone horribly awry with a server? Tear it down and bring up a new one in minutes instead of hours.
You'll most likely want to run both the default and license recipes. This will install Alteryx Server, Alteryx R Predictive Tools, license the installation, and start the Alteryx Service.
Replace these items in the command below:
$HOST: The node's host name or IP address.
$ADMIN_USER: A user on the Windows server that has administrative rights.
$PASSWORD: The $ADMIN_USER's password.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX: Your license key.
YOU@EXAMPLE.COM: The e-mail address associated with the license key.
$ knife bootstrap windows winrm $HOST -x $ADMIN_USER -P $PASSWORD -r 'recipe[alteryx-server::default],recipe[alteryx-server::license]' -j '{"alteryx":{"license":{"key":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","email":"YOU@EXAMPLE.COM"}}}' -N alteryx-server-cookbook-blog Creating new client for alteryx-server-cookbook-blog Creating new node for alteryx-server-cookbook-blog Waiting for remote response before bootstrap.10.10.10.10 . 10.10.10.10 Response received. Remote node responded after 0.01 minutes. Bootstrapping Chef on 10.10.10.10 ... 10.10.10.10 Checking for existing directory "C:\chef"... 10.10.10.10 Existing directory found, skipping creation. 10.10.10.10 ... 10.10.10.10 Attempting to download client package using PowerShell if available... 10.10.10.10 powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File C:\chef\wget.ps1 "https://www.chef.io/chef/download?p=windows&pv=2012&m=x86_64&DownloadContext=PowerShell&v=12" "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi" 10.10.10.10 Download via PowerShell succeeded. 10.10.10.10 Installing downloaded client package... 10.10.10.10 10.10.10.10 C:\Users\Administrator>msiexec /qn /log "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-msi19486.log" /i "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi" 10.10.10.10 Successfully installed Chef Client package. 10.10.10.10 A subdirectory or file C:\chef\trusted_certs already exists. 10.10.10.10 Installation completed successfully 10.10.10.10 Writing validation key... 10.10.10.10 Validation key written. 10.10.10.10 ... 10.10.10.10 C:\Users\Administrator>(echo.{"alteryx":{"license":{"key":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","email":"YOU@EXAMPLE.COM"}}} ) 1>C:\chef\first-boot.json 10.10.10.10 Starting chef to bootstrap the node... 10.10.10.10 10.10.10.10 C:\Users\Administrator>SET "PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Amazon\cfn-bootstrap\;C:\opscode\chef\bin\;C:\ruby\bin;C:\opscode\chef\bin;C:\opscode\chef\embedded\bin" 10.10.10.10 10.10.10.10 C:\Users\Administrator>chef-client -c c:/chef/client.rb -j c:/chef/first-boot.json 10.10.10.10 INFO: *** Chef 12.11.18 *** 10.10.10.10 INFO: Platform: x64-mingw32 10.10.10.10 INFO: Chef-client pid: 2888 10.10.10.10 INFO: Setting the run_list to ["recipe[alteryx-server::default]", "recipe[alteryx-server::license]"] from CLI options 10.10.10.10 INFO: Run List is [recipe[alteryx-server::default], recipe[alteryx-server::license]] 10.10.10.10 INFO: Run List expands to [alteryx-server::default, alteryx-server::license] 10.10.10.10 INFO: Starting Chef Run for alteryx-server-cookbook-blog 10.10.10.10 INFO: Running start handlers 10.10.10.10 INFO: Start handlers complete. 10.10.10.10 INFO: HTTP Request Returned 404 Not Found: 10.10.10.10 INFO: Loading cookbooks [alteryx-server@0.11.1] 10.10.10.10 WARN: Cloning resource attributes for alteryx_server_service[AlteryxService] from prior resource (CHEF-3694) 10.10.10.10 WARN: Previous alteryx_server_service[AlteryxService]: c:/chef/cache/cookbooks/alteryx-server/recipes/default.rb:11:in `from_file' 10.10.10.10 WARN: Current alteryx_server_service[AlteryxService]: c:/chef/cache/cookbooks/alteryx-server/recipes/license.rb:9:in `from_file' 10.10.10.10 INFO: Processing alteryx_server_package[Alteryx Server] action install (alteryx-server::default line 7) 10.10.10.10 INFO: Processing windows_package[Alteryx 10.5 x64] action install (c:/chef/cache/cookbooks/alteryx-server/resources/package.rb line 18) 10.10.10.10 INFO: Processing remote_file[c:\chef\cache\package\AlteryxServerInstallx64_10.5.9.15014.exe] action create (dynamically defined) 10.10.10.10 INFO: windows_package[Alteryx 10.5 x64] installed Alteryx 10.5 x64 at 10.5.9.15014 10.10.10.10 INFO: Processing alteryx_server_r_package[R Predictive Tools] action install (alteryx-server::default line 9) 10.10.10.10 INFO: Processing windows_package[Alteryx Predictive Tools with R 3.2.3] action install (c:/chef/cache/cookbooks/alteryx-server/resources/r_package.rb line 29) 10.10.10.10 INFO: windows_package[Alteryx Predictive Tools with R 3.2.3] installed Alteryx Predictive Tools with R 3.2.3 at latest 10.10.10.10 INFO: Processing alteryx_server_service[AlteryxService] action enable (alteryx-server::default line 11) 10.10.10.10 INFO: Processing windows_service[AlteryxService] action enable (dynamically defined) 10.10.10.10 INFO: Processing alteryx_server_runtimesettings[RuntimeSettings.xml] action manage (alteryx-server::default line 13) 10.10.10.10 INFO: Processing template[C:\ProgramData\Alteryx\RuntimeSettings.xml] action create (c:/chef/cache/cookbooks/alteryx-server/resources/runtimesettings.rb line 49) 10.10.10.10 INFO: template[C:\ProgramData\Alteryx\RuntimeSettings.xml] backed up to c:/chef/backup\ProgramData\Alteryx\RuntimeSettings.xml.chef-20160614173804.691694 10.10.10.10 INFO: template[C:\ProgramData\Alteryx\RuntimeSettings.xml] updated file contents C:\ProgramData\Alteryx\RuntimeSettings.xml 10.10.10.10 INFO: Processing ruby_block[Generate secrets] action run (c:/chef/cache/cookbooks/alteryx-server/resources/runtimesettings.rb line 61) 10.10.10.10 INFO: Processing alteryx_server_license[XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX] action activate (alteryx-server::license line 7) 10.10.10.10 INFO: Processing execute[Activate License] action run (c:/chef/cache/cookbooks/alteryx-server/resources/license.rb line 30) 10.10.10.10 INFO: execute[Activate License] ran successfully 10.10.10.10 INFO: Processing alteryx_server_service[AlteryxService] action start (alteryx-server::license line 9) 10.10.10.10 INFO: Processing windows_service[AlteryxService] action start (dynamically defined) 10.10.10.10 INFO: windows_service[AlteryxService] configured with {:service_name=>"AlteryxService"} 10.10.10.10 INFO: windows_service[AlteryxService] started 10.10.10.10 INFO: Chef Run complete in 151.656322 seconds 10.10.10.10 INFO: Running report handlers 10.10.10.10 INFO: Report handlers complete
Looking at the log above, we went from a new Windows server to one running Alteryx Server in 2 and a half minutes!
The recipes included in the cookbook are a great place to start, but the power of Chef cookbooks lies in customization. For example, what if you didn't want to install the Alteryx R Predictive Tools? Maybe you want to resolve those WARN messages from the last run. (Those warnings were generated because we'd called the alteryx_server_service twice with the same name.) Perhaps you want to enable logging. Let's create a wrapper cookbook to check off those three items.
$ chef generate cookbook alteryx-server-cookbook-blog Compiling Cookbooks... Recipe: code_generator::cookbook ... $ cd alteryx-server-cookbook-blog $ ls -la total 48 drwxr-xr-x 12 user users 408 Jun 14 12:54 . drwxr-xr-x 35 user users 1190 Jun 14 12:54 .. drwxr-xr-x 9 user users 306 Jun 14 12:56 .git -rw-r--r-- 1 user users 126 Jun 14 12:54 .gitignore -rw-r--r-- 1 user users 643 Jun 14 12:54 .kitchen.yml -rw-r--r-- 1 user users 591 Jun 14 12:54 Policyfile.rb -rw-r--r-- 1 user users 76 Jun 14 12:54 README.md -rw-r--r-- 1 user users 1029 Jun 14 12:54 chefignore -rw-r--r-- 1 user users 264 Jun 14 12:54 metadata.rb drwxr-xr-x 3 user users 102 Jun 14 12:54 recipes drwxr-xr-x 4 user users 136 Jun 14 12:54 spec drwxr-xr-x 3 user users 102 Jun 14 12:54 test
Awesome. We've got the skeleton laid out. Now let's edit our metadata.rb and add the line depends 'alteryx-server', '>= 0.11.3':
name 'alteryx-server-cookbook-blog' maintainer 'The Authors' maintainer_email 'you@example.com' license 'all_rights' description 'Installs/Configures alteryx-server-cookbook-blog' long_description 'Installs/Configures alteryx-server-cookbook-blog' version '0.1.0' depends 'alteryx-server', '>= 0.11.3'
Now we can write our recipe. Let's go ahead and edit recipes/default.rb.
alteryx_server_package 'Alteryx Server' alteryx_server_runtimesettings 'RuntimeSettings.xml' do config( controller: { logging_enabled: true } ) end alteryx_server_license node['alteryx']['license']['key'] alteryx_server_service 'AlteryxService' do action :start end
Nice. Now we've got a recipe that will install Alteryx Server, run the configuration, license our installation, and start the Alteryx Service. We've left out the alteryx_server_r_package call, passed a new configuration option to enable logging, and removed the second call to alteryx_server_service. That takes care of not installing the Alteryx R Predictive Tools, enables logging, and won't trigger those WARN messages.
Note: It's a better idea in the long run to put RuntimeSettings config options into an attributes file. For an example post like this, it's just easier to put it in the recipe. To enable logging through attributes, put the line default['alteryx']['runtimesettings']['controller']['logging_enabled'] = true in attributes/default.rb.
Then delete everything from do to end in the alteryx_server_runtimesettings 'RuntimeSettings.xml' call.
You'll need to have a Hosted Chef account or a Chef server configured for this bit. We'll use Berkshelf to manage our dependencies and to upload our new cookbook. Make sure you have a Berksfile that looks like this.
source 'https://supermarket.chef.io' cookbook 'alteryx-server-cookbook-blog', path: '.'
Now that we've got that taken care of, run berks install && berks upload.
Let's run the command below. Again, substitute values as necessary.
$ knife bootstrap windows winrm $HOST -x $ADMIN -P $PASSWORD -r 'recipe[alteryx-server-cookbook-blog::default]' -j '{"alteryx":{"license":{"key":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","email":"YOU@EXAMPLE.COM"}}}' -N alteryx-server-cookbook-blog Creating new client for alteryx-server-cookbook-blog Creating new node for alteryx-server-cookbook-blog Waiting for remote response before bootstrap.10.10.10.10 . 10.10.10.10 Response received. Remote node responded after 0.01 minutes. Bootstrapping Chef on 10.10.10.10 ... 10.10.10.10 Checking for existing directory "C:\chef"... 10.10.10.10 Existing directory found, skipping creation. 10.10.10.10 ... 10.10.10.10 Attempting to download client package using PowerShell if available... 10.10.10.10 powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File C:\chef\wget.ps1 "https://www.chef.io/chef/download?p=windows&pv=2012&m=x86_64&DownloadContext=PowerShell&v=12" "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi" 10.10.10.10 Download via PowerShell succeeded. 10.10.10.10 Installing downloaded client package... 10.10.10.10 10.10.10.10 C:\Users\Administrator>msiexec /qn /log "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-msi30134.log" /i "C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi" 10.10.10.10 Successfully installed Chef Client package. 10.10.10.10 A subdirectory or file C:\chef\trusted_certs already exists. 10.10.10.10 Installation completed successfully 10.10.10.10 Writing validation key... 10.10.10.10 Validation key written. 10.10.10.10 ... 10.10.10.10 C:\Users\Administrator>(echo.{"alteryx":{"license":{"key":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","email":"YOU@EXAMPLE.COM"},"runtimesettings":{"engine":{"gallery_url":"http://devgallery.alteryx.com/"},"portfolio":{"authorization_server":"devgallery.alteryx.com","authorization_url":"api/licenseserver/authenticate/"}}},"run_list":["recipe[alteryx-server-cookbook-blog::default]"]} ) 1>C:\chef\first-boot.json 10.10.10.10 Starting chef to bootstrap the node... 10.10.10.10 10.10.10.10 C:\Users\Administrator>SET "PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Amazon\cfn-bootstrap\;C:\opscode\chef\bin\;C:\ruby\bin;C:\opscode\chef\bin;C:\opscode\chef\embedded\bin" 10.10.10.10 10.10.10.10 C:\Users\Administrator>chef-client -c c:/chef/client.rb -j c:/chef/first-boot.json 10.10.10.10 INFO: *** Chef 12.11.18 *** 10.10.10.10 INFO: Platform: x64-mingw32 10.10.10.10 INFO: Chef-client pid: 3196 10.10.10.10 INFO: Setting the run_list to ["recipe[alteryx-server-cookbook-blog::default]"] from CLI options 10.10.10.10 INFO: Run List is [recipe[alteryx-server-cookbook-blog::default]] 10.10.10.10 INFO: Run List expands to [alteryx-server-cookbook-blog::default] 10.10.10.10 INFO: Starting Chef Run for alteryx-server-cookbook-blog 10.10.10.10 INFO: Running start handlers 10.10.10.10 INFO: Start handlers complete. 10.10.10.10 INFO: HTTP Request Returned 404 Not Found: 10.10.10.10 INFO: Loading cookbooks [alteryx-server-cookbook-blog@0.1.0, alteryx-server@0.11.2] 10.10.10.10 INFO: Processing alteryx_server_package[Alteryx Server] action install (alteryx-server-cookbook-blog::default line 6) 10.10.10.10 INFO: Processing windows_package[Alteryx 10.5 x64] action install (c:/chef/cache/cookbooks/alteryx-server/resources/package.rb line 18) 10.10.10.10 INFO: Processing remote_file[c:\chef\cache\package\AlteryxServerInstallx64_10.5.9.15014.exe] action create (dynamically defined) 10.10.10.10 INFO: remote_file[c:\chef\cache\package\AlteryxServerInstallx64_10.5.9.15014.exe] created file c:\chef\cache\package\AlteryxServerInstallx64_10.5.9.15014.exe 10.10.10.10 INFO: remote_file[c:\chef\cache\package\AlteryxServerInstallx64_10.5.9.15014.exe] updated file contents c:\chef\cache\package\AlteryxServerInstallx64_10.5.9.15014.exe 10.10.10.10 INFO: windows_package[Alteryx 10.5 x64] installed Alteryx 10.5 x64 at 10.5.9.15014 10.10.10.10 INFO: Processing alteryx_server_runtimesettings[RuntimeSettings.xml] action manage (alteryx-server-cookbook-blog::default line 8) 10.10.10.10 INFO: Processing template[C:\ProgramData\Alteryx\RuntimeSettings.xml] action create (c:/chef/cache/cookbooks/alteryx-server/resources/runtimesettings.rb line 62) 10.10.10.10 INFO: template[C:\ProgramData\Alteryx\RuntimeSettings.xml] backed up to c:/chef/backup\ProgramData\Alteryx\RuntimeSettings.xml.chef-20160614211839.964107 10.10.10.10 INFO: template[C:\ProgramData\Alteryx\RuntimeSettings.xml] removed backup at c:/chef/backup\ProgramData\Alteryx/RuntimeSettings.xml.chef-20160614201209.493305 10.10.10.10 INFO: template[C:\ProgramData\Alteryx\RuntimeSettings.xml] updated file contents C:\ProgramData\Alteryx\RuntimeSettings.xml 10.10.10.10 INFO: Processing ruby_block[Generate secrets] action run (c:/chef/cache/cookbooks/alteryx-server/resources/runtimesettings.rb line 75) 10.10.10.10 INFO: Processing alteryx_server_license[XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX] action activate (alteryx-server-cookbook-blog::default line 16) 10.10.10.10 INFO: Processing execute[Activate License] action run (c:/chef/cache/cookbooks/alteryx-server/resources/license.rb line 30) 10.10.10.10 INFO: execute[Activate License] ran successfully 10.10.10.10 INFO: Processing alteryx_server_service[AlteryxService] action start (alteryx-server-cookbook-blog::default line 18) 10.10.10.10 INFO: Processing windows_service[AlteryxService] action start (dynamically defined) 10.10.10.10 INFO: windows_service[AlteryxService] configured with {:service_name=>"AlteryxService"} 10.10.10.10 INFO: windows_service[AlteryxService] started 10.10.10.10 INFO: Chef Run complete in 94.781296 seconds 10.10.10.10 INFO: Running report handlers 10.10.10.10 INFO: Report handlers complete
There you have it. We've converged a fresh installation in about a minute and a half. The run with Alteryx R Predictive Tools takes a bit longer, so that's why we're seeing the speed-up here. And we've gotten rid of those annoying WARN messages.
Now let's take a look at our overrides file at C:\ProgramData\Alteryx\RuntimeSettings.xml to confirm our logging setting.
<?xml version="1.0" encoding="UTF-8"?> <SystemSettings> <Controller> <LoggingEnabled>True</LoggingEnabled> <ServerSecretEncrypted>REDACTED</ServerSecretEncrypted> <StorageKeysEncrypted>REDACTED</StorageKeysEncrypted> </Controller> <Engine> <NumThreads>3</NumThreads> <SortJoinMemory>1092</SortJoinMemory> </Engine> </SystemSettings>
We're good to go. The Alteryx Server is up and running, no WARN messages were logged, we didn't install the Alteryx R Predictive Tools package, and logging is enabled.
As you can see, using Chef to configure Alteryx Server results in some huge gains. We save time and ensure predictable and repeatable results. For all of you Chefs out there, go ahead and clone the cookbook from GitHub. Poke around and let us know if you find any issues or submit a pull request.
Not a ninja. Not a rock star. Just a guy who likes to automate stuff.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.