Skip to content

Commit

Permalink
Allow pool recycle after N requests
Browse files Browse the repository at this point in the history
Set Changelog to ## Unreleased

Update sous-chefs/.github action to v2.0.6 (sous-chefs#516)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update changelog for 8.0.20

Update metadata for 8.0.20

Set Changelog to ## Unreleased

fix bug with setting no_managed_code

Signed-off-by jmschu02@gmail.com

**Description**
had to recreate
Fixes a bug in iis_pool that causes an issue with resetting to no_managed_code runtime versions

**Issues Resolved**

**Check List**
  All tests pass. See https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/TESTING.MD
  New functionality includes testing.
  New functionality has been documented in the README if applicable
  All commits have been signed for the Developer Certificate of Origin. See https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD

[sous-chefsGH-476] Allow specifying install method for windows_feature resources (sous-chefs#477)

* [sous-chefsGH-476] Allow specifying install method for internal windows_feature resources

- Introduces new attribute ['iis']['windows_feature_install_method']
the value of this vode is passed to any calls to the windows_feature resource
as the resources install_method property

- feature names are translated into powershell format when install
method is powershell

  - Using powershell to install features requires passing in a
    different feature name
  - added library method to translate any feature names into the powershell
    format if the install mode is powershell
  - the look up handles the scenario where someone has already
    provided the feature name in the powershell format

Signed-off-by: dave-q <24652224+dave-q@users.noreply.github.com>

* [sous-chefsGH-476] Allow specifying install method for internal windows_feature resources

install resource refactored to do the feature name translation if required
by just adding the helper method in the action_class.

Also refactored the install resource to enable and start the W3WVC service
since every other recipe in the cookbook used to call the default recipe
that did that anyway

starting the W3WVC is optional and defaults to false, so that the
current behaviour of that resource that doesn't change for down stream users

This makes a much cleaner implemenation, no helper module monkey patched
into recipe, no extra resources and to all users of the cookbook there are
no breaking changes just new options if desired.

Added a unit test for all the mod recipes just to check they converge,
I think this just gives some confidence things are breaking

Spec tests for the install resource

* Update README.md

Co-authored-by: Jason Field <Jason@avon-lea.co.uk>

* [sous-chefsGH-476] Raise an error if the feature name cannot be translated

---------

Signed-off-by: dave-q <24652224+dave-q@users.noreply.github.com>
Co-authored-by: Jason Field <Jason@avon-lea.co.uk>
Co-authored-by: Dan Webb <dan.webb@damacus.io>

Update changelog for 8.1.0

Update metadata for 8.1.0

Set Changelog to ## Unreleased

Allow pool recycle after N requests

Add inspec test

Update changelog for 8.1.0

Update metadata for 8.1.0

Set Changelog to ## Unreleased
  • Loading branch information
rjhornsby committed Oct 3, 2023
1 parent c909d28 commit e7cf89b
Show file tree
Hide file tree
Showing 52 changed files with 922 additions and 106 deletions.
26 changes: 14 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,20 @@ jobs:
os:
- "windows-2019"
suite:
- "default"
- "disable-default"
- "app"
- "config-property"
- "manager"
- "manager-permission"
- "module"
- "pool"
- "root"
- "section"
- "site"
- "vdir"
- 'default'
- 'disable-default'
- 'app'
- 'config-property'
- 'manager'
- 'manager-permission'
- 'module'
- 'pool'
- 'root'
- 'section'
- 'site'
- 'vdir'
- 'default-windowsfeatures-powershell'
- 'site-windowsfeatures-powershell'
fail-fast: false

steps:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ This file is used to list changes made in each version of the iis cookbook.

## Unreleased

## 8.1.0 - *2023-10-03*

- Add support for IIS pool setting `recycling.periodicRestart.requests`

## 8.1.0 - *2023-10-03*

- Allow specifying install method for windows_feature resources

## 8.0.20 - *2023-09-28*

## 8.0.19 - *2023-09-04*
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of
- `node['iis']['pubroot']` - . default is `%SYSTEMDRIVE%\inetpub`
- `node['iis']['docroot']` - IIS web site home directory. default is `%SYSTEMDRIVE%\inetpub\wwwroot`
- `node['iis']['cache_dir']` - location of cached data. default is `%SYSTEMDRIVE%\inetpub\temp`
- `node['iis']['windows_feature_install_method']` - specify the install method that will be used by any windows_feature resources. If ommitted it will not be specified and will use `windows_feature_dism` by default. Valid options are `:windows_feature_dism`, `:windows_feature_powershell`, `:windows_feature_servermanagercmd`. Default is `:windows_feature_dism`

## Resources

Expand Down
2 changes: 2 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@
default['iis']['source'] = nil

default['iis']['recycle']['log_events'] = 'Time, Requests, Schedule, Memory, IsapiUnhealthy, OnDemand, ConfigChange, PrivateMemory'

default['iis']['windows_feature_install_method'] = :windows_feature_dism
10 changes: 6 additions & 4 deletions documentation/iis_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ Simple resource to install the IIS feature

## Properties

| Name | Type | Required| Description |
| ----------------------- | -------- | -------- | ------------------------------------ |
| `source` | String | No | Source to install the features from. |
| `additional_components` | Array | No | Features of IIS to install |
| Name | Type | Required| Description |
| ----------------------- | -------------- | -------- | ------------------------------------ |
| `source` | String | No | Source to install the features from. |
| `additional_components` | String,Array | No | Features of IIS to install |
| `install_method` | String, Symbol| No | install_method to be used to any windows_features resources. Default is :windows_feature_dism. Options are :windows_feature_dism, :windows_feature_powershell |
| `start_iis` | true, false | No | Controls whether the W3WVC service is enabled and started. Default is false

## Examples

Expand Down
11 changes: 6 additions & 5 deletions documentation/iis_manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ Configures the IIS Manager service

## Properties

| Name | Type | Default | Description |
| --------------------------- | ------------- | ------- | ------------------------------------ |
| `enable_remote_management` | true, false | `true` | If remote access allowed |
| `log_directory` | String | | Optional. The directory to write log files to |
| `port` | Integer | `8172` | The port the service listens on. |
| Name | Type | Default | Description |
| --------------------------- | --------------- | ------- | ------------------------------------ |
| `enable_remote_management` | true, false | `true` | If remote access allowed |
| `log_directory` | String | | Optional. The directory to write log files to |
| `port` | Integer | `8172` | The port the service listens on. |
| `install_method` | String, Symbol | `:windows_feature_dism` | Optional. install_method to be used to any windows_features resources. Valid options are :windows_feature_dism, :windows_feature_powershell |

## Examples

Expand Down
21 changes: 11 additions & 10 deletions documentation/iis_pool.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,17 @@ Creates an application pool in IIS.

### Recycling Items

| Name | Type | Default | Required | Description | Allowed Values |
| ------------------------------------- | --------------- | ----------- | --------- | ------------------------------------ |---------------- |
| `disallow_rotation_on_config_change` | true, false | `false` | No | The DisallowRotationOnConfigChange property specifies whether or not the World Wide Web Publishing Service (WWW Service) should rotate worker processes in an application pool when the configuration has changed. | |
| `disallow_overlapping_rotation` | true, false | `false` | No | Specifies whether the WWW Service should start another worker process to replace the existing worker process while that process | |
| `recycle_schedule_clear` | String | `false` | No | specifies a pool to clear all scheduled recycle times. | |
| `log_event_on_recycle` | true, false | `node['iis']['recycle']['log_events']`| No | configure IIS to log an event when one or more of the following configured events cause an application pool to recycle (for additional information about [logging events] (<https://technet.microsoft.com/en-us/library/cc771318%28v=ws.10%29.aspx>). | |
| `recycle_after_time` | String | | No | specifies a pool to recycle at regular time intervals, d.hh:mm:ss. | |
| `periodic_restart_schedule` | Array, String | | No | schedule a pool to recycle at specific times. | |
| `private_memory` | Integer | | No | specifies the amount of private memory (in kilobytes) after which you want the pool to recycle. | |
| `virtual_memory` | Integer | | No | specifies the amount of virtual memory (in kilobytes) after which you want the pool to recycle. | |
| Name | Type | Default | Required | Description | Allowed Values |
|--------------------------------------|---------------| ----------- | --------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------- |
| `disallow_rotation_on_config_change` | true, false | `false` | No | The DisallowRotationOnConfigChange property specifies whether or not the World Wide Web Publishing Service (WWW Service) should rotate worker processes in an application pool when the configuration has changed. | |
| `disallow_overlapping_rotation` | true, false | `false` | No | Specifies whether the WWW Service should start another worker process to replace the existing worker process while that process | |
| `recycle_schedule_clear` | String | `false` | No | specifies a pool to clear all scheduled recycle times. | |
| `log_event_on_recycle` | true, false | `node['iis']['recycle']['log_events']`| No | configure IIS to log an event when one or more of the following configured events cause an application pool to recycle (for additional information about [logging events] (<https://technet.microsoft.com/en-us/library/cc771318%28v=ws.10%29.aspx>). | |
| `recycle_after_time` | String | | No | specifies a pool to recycle at regular time intervals, d.hh:mm:ss. | |
| `recycle_after_requests` | Integer | | No | specifies the number of requests after which you want the pool to recycle. | |
| `periodic_restart_schedule` | Array, String | | No | schedule a pool to recycle at specific times. | |
| `private_memory` | Integer | | No | specifies the amount of private memory (in kilobytes) after which you want the pool to recycle. | |
| `virtual_memory` | Integer | | No | specifies the amount of virtual memory (in kilobytes) after which you want the pool to recycle. | |

### Failure Items

Expand Down
18 changes: 18 additions & 0 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,21 @@ suites:
- name: vdir
run_list:
- recipe[test::vdir]
- name: default-windowsfeatures-powershell
run_list:
- recipe[iis::default]
verifier:
inspec_tests:
- test/integration/default/spec
attributes:
iis:
windows_feature_install_method: windows_feature_powershell
- name: site-windowsfeatures-powershell
run_list:
- recipe[test::site]
verifier:
inspec_tests:
- test/integration/site
attributes:
iis:
windows_feature_install_method: windows_feature_powershell
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
source_url 'https://github.com/sous-chefs/iis'
issues_url 'https://github.com/sous-chefs/iis/issues'
chef_version '>= 15.3'
version '8.0.20'
version '8.1.0'

supports 'windows'
7 changes: 2 additions & 5 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
iis_install 'install IIS' do
additional_components node['iis']['components']
source node['iis']['source']
end

service 'iis' do
service_name 'W3SVC'
action [:enable, :start]
install_method node['iis']['windows_feature_install_method']
start_iis true
end
9 changes: 6 additions & 3 deletions recipes/mod_application_initialization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature 'IIS-ApplicationInit'
iis_install 'install IIS, ApplicationInit' do
additional_components 'IIS-ApplicationInit'
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
14 changes: 7 additions & 7 deletions recipes/mod_aspnet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
# limitations under the License.
#

include_recipe 'iis'
include_recipe 'iis::mod_isapi'

windows_feature %w(IIS-NetFxExtensibility IIS-ASPNET) do
action :install
all !IISCookbook::Helper.older_than_windows2012?
source node['iis']['source'] unless node['iis']['source'].nil?
iis_install 'install IIS, ASPNET' do
additional_components %w(IIS-NetFxExtensibility IIS-ASPNET)
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end

include_recipe 'iis::mod_isapi'
10 changes: 7 additions & 3 deletions recipes/mod_aspnet45.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
# limitations under the License.
#

include_recipe 'iis'
include_recipe 'iis::mod_isapi'
iis_install 'install IIS, ASPNET45' do
additional_components %w(NetFx4Extended-ASPNET45 IIS-NetFxExtensibility45 IIS-ASPNET45)
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end

windows_feature %w(NetFx4Extended-ASPNET45 IIS-NetFxExtensibility45 IIS-ASPNET45)
include_recipe 'iis::mod_isapi'
6 changes: 5 additions & 1 deletion recipes/mod_auth_anonymous.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
# limitations under the License.
#

include_recipe 'iis'
iis_install 'install IIS' do
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end

iis_section 'unlocks anonymous authentication control in web.config' do
section 'system.webServer/security/authentication/anonymousAuthentication'
Expand Down
9 changes: 6 additions & 3 deletions recipes/mod_auth_basic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature 'IIS-BasicAuthentication'
iis_install 'install IIS, BasicAuth' do
additional_components 'IIS-BasicAuthentication'
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end

iis_section 'unlocks basic authentication control in web.config' do
section 'system.webServer/security/authentication/basicAuthentication'
Expand Down
9 changes: 6 additions & 3 deletions recipes/mod_auth_digest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature 'IIS-DigestAuthentication'
iis_install 'install IIS, DigestAuth' do
additional_components 'IIS-DigestAuthentication'
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end

iis_section 'unlocks digest authentication control in web.config' do
section 'system.webServer/security/authentication/digestAuthentication'
Expand Down
9 changes: 6 additions & 3 deletions recipes/mod_auth_windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature 'IIS-WindowsAuthentication'
iis_install 'install IIS, WindowsAuth' do
additional_components 'IIS-WindowsAuthentication'
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end

iis_section 'unlocks windows authentication control in web.config' do
section 'system.webServer/security/authentication/windowsAuthentication'
Expand Down
9 changes: 6 additions & 3 deletions recipes/mod_cgi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature 'IIS-CGI'
iis_install 'install IIS, CGI' do
additional_components 'IIS-CGI'
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
9 changes: 6 additions & 3 deletions recipes/mod_compress_dynamic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature 'IIS-HttpCompressionDynamic'
iis_install 'install IIS, HttpCompressionDynamic' do
additional_components 'IIS-HttpCompressionDynamic'
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
9 changes: 6 additions & 3 deletions recipes/mod_compress_static.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature 'IIS-HttpCompressionStatic'
iis_install 'install IIS, HttpCompressionStatic' do
additional_components 'IIS-HttpCompressionStatic'
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
9 changes: 6 additions & 3 deletions recipes/mod_ftp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature %w(IIS-FTPServer IIS-FTPSvc IIS-FTPExtensibility)
iis_install 'install IIS, FTP' do
additional_components %w(IIS-FTPServer IIS-FTPSvc IIS-FTPExtensibility)
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
9 changes: 6 additions & 3 deletions recipes/mod_iis6_metabase_compat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature %w(IIS-IIS6ManagementCompatibility IIS-Metabase)
iis_install 'install IIS, Compatability, Metabase' do
additional_components %w(IIS-IIS6ManagementCompatibility IIS-Metabase)
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
9 changes: 6 additions & 3 deletions recipes/mod_isapi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature %w(IIS-ISAPIFilter IIS-ISAPIExtensions)
iis_install 'install IIS, ISAPI' do
additional_components %w(IIS-ISAPIFilter IIS-ISAPIExtensions)
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
9 changes: 6 additions & 3 deletions recipes/mod_logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature 'IIS-CustomLogging'
iis_install 'install IIS, CustomLogging' do
additional_components 'IIS-CustomLogging'
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
10 changes: 5 additions & 5 deletions recipes/mod_management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature %w(IIS-ManagementConsole IIS-ManagementService) do
action :install
all !IISCookbook::Helper.older_than_windows2012?
iis_install 'install IIS, Management' do
additional_components %w(IIS-ManagementConsole IIS-ManagementService)
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
9 changes: 6 additions & 3 deletions recipes/mod_security.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# limitations under the License.
#

include_recipe 'iis'

windows_feature %w(IIS-URLAuthorization IIS-RequestFiltering IIS-IPSecurity)
iis_install 'install IIS, Security' do
additional_components %w(IIS-URLAuthorization IIS-RequestFiltering IIS-IPSecurity)
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
start_iis true
end
Loading

0 comments on commit e7cf89b

Please sign in to comment.