cvent / octopus-deploy-cookbook Goto Github PK
View Code? Open in Web Editor NEWChef cookbook for configuring Octopus Deploy.
Home Page: https://supermarket.chef.io/cookbooks/octopus-deploy
License: Apache License 2.0
Chef cookbook for configuring Octopus Deploy.
Home Page: https://supermarket.chef.io/cookbooks/octopus-deploy
License: Apache License 2.0
Cannot specify both default and name_property/name_attribute together on property path of resource octopus_deploy_tools
chef_version=13.0.118
platform=windows
platform_version=6.3.9600
ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x64-mingw32]
program_name=C:/opscode/chef/bin/chef-client
executable=C:/opscode/chef/bin/chef-client
Hi, looks like the tentacle configure option is always skipped due to the fact that the windows service is already created before this. Or am I doing something wrong here?
Love to fix this with another check not_if check if this is actually the case.
Regards,
Jeroen
This is more of a feature request. You currently have the provider for service_name set to service_name(instance) which yields the result "OctopusDeploy Tentacle - Machine Name" as the actual windows service name. The issue arises when this configuration attempts to perform a service name check (or not if block) and because I cannot override this value it causes my wrapper to error out. This is due to inconsistencies in how you define the service name and how the service has been deployed in my environment.
The cookbook runs this command which will be deprecated in 4.x
.\Octopus.Server.exe configure --webAuthenticationMode "Domain"
--webAuthenticationMode has been deprecated and will be removed in Octopus 4.0. Please enable and configure the individu
al authentication providers you wish to use. See http://g.octopushq.com/AuthenticationProviders
This currently is not supported but it needs to be in order to setup another HA node and any DR nodes
.\Octopus.Server.exe configure --masterkey="<Master Key>"
The admin_user
property only takes a string
It would be nice if you could pass in multiple admins
admin_user ['foo','bar']
Additionally it would be nice if the admin_user could take a hash that included email and password options
https://octopus.com/docs/api-and-integration/octopus.server.exe-command-line/admin
admin_user [
{
"name": "foo",
"email": "[email protected]",
"password": "correct-horse-battery-staple"
}
]
The fancy_bool function is used in an awkward spot and is not named very appropriately. It should probably be called powershell_boolean
since that is what its purpose is for.
The goals of this should be that the register functionality should be able to be tested in appveyor so that we can verify the service started up and that the tentacle registered successfully.
I think this can be achieved because appveyor has sql server installed on the machines already and we can configure our tests cases to create and setup our sql server instance and start up the server instance. Then we could write a custom powershell script to connect via basic auth and setup a simple test environment with roles and whatnot to verify that we can register a tentacle. There would be some sort of hacking to inject the generated auth key into the tentacle chef-client run, but having this path tested would be more powerful. THe appveyor build would go something like this:
chef exec kitchen converge server
(instead of just a global converge)chef exec kitchen converge tentacle
I think this approach could work long term.
If you define admin_user
on a machine that isn't part of an active directory domain, and you don't specify password, you will get error The LDAP server is unavailable
* octopus_deploy_server[OctopusServer] action configure[2017-09-21T21:26:34+00:00] WARN: Please use the package resource available in Chef Client 12.6.
windows_package will be removed in the next major version release
of the Windows cookbook.
* remote_file[C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/octopus-server.msi] action create
* windows_package[Octopus Deploy Server] action install
* powershell_script[create-instance-OctopusServer] action run (skipped due to not_if)
* powershell_script[configure-server-OctopusServer] action run
================================================================================
Error executing action `run` on resource 'powershell_script[configure-server-OctopusServer]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Windows/Temp/chef-script20170921-2604-15ivxwd.ps1" ----
STDOUT:
STDERR: ===============================================================================The server could not be contacted.
System.DirectoryServices.AccountManagement.PrincipalServerDownException
at System.DirectoryServices.AccountManagement.PrincipalContext.ReadServerConfig(String serverName, ServerProperties& properties)
at System.DirectoryServices.AccountManagement.PrincipalContext.DoServerVerifyAndPropRetrieval()
at System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType, String name, String container, ContextOptions options, String userName, String password)
at System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType, String name, String container)
at Octopus.Server.Extensibility.Authentication.DirectoryServices.DirectoryServices.DirectoryServicesContextProvider.GetContext(String domain)
at Octopus.Server.Extensibility.Authentication.DirectoryServices.DirectoryServices.UserMatcher.Match(String name, CancellationToken cancellationToken)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Octopus.Server.Commands.AdminCommand.Start()
at Octopus.Shared.Startup.AbstractCommand.Start(String[] commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions)
at Octopus.Shared.Startup.ConsoleHost.Run(Action`1 start, Action shutdown)
at Octopus.Shared.Startup.OctopusProgram.Run()
--Inner Exception--
The LDAP server is unavailable.
System.DirectoryServices.Protocols.LdapException
at System.DirectoryServices.Protocols.LdapConnection.Connect()
at System.DirectoryServices.Protocols.LdapConnection.SendRequestHelper(DirectoryRequest request, Int32& messageID)
at System.DirectoryServices.Protocols.LdapConnection.SendRequest(DirectoryRequest request, TimeSpan requestTimeout)
at System.DirectoryServices.AccountManagement.PrincipalContext.ReadServerConfig(String serverName, ServerProperties& properties)
-------------------------------------------------------------------------------
Should have some sort of code quality checking.
Trying to deploy octopus in mass. I find polling tentacles are installed properly, however they always fail their health check until I manually restart the service.
This is strange because the configure tentacle resource notifies the windows service to restart with a :delayed
timer, yet it looks like the restart happens before the register action happens.
Recipe: nd-octopus::tentacle
* octopus_deploy_tentacle[Tentacle] action install
* remote_file[C:\chef\cache/octopus-tentacle.msi] action create (up to date)
* windows_package[Octopus Deploy Tentacle] action install (up to date)
(up to date)
* octopus_deploy_tentacle[Tentacle] action configure
* windows_firewall_rule[Octopus Deploy Tentacle] action create (skipped due to only_if)
* octopus_deploy_tentacle[Tentacle] action install
* remote_file[C:\chef\cache/octopus-tentacle.msi] action create (up to date)
* windows_package[Octopus Deploy Tentacle] action install (up to date)
(up to date)
* directory[C:\Octopus] action create (up to date)
* powershell_script[generate-tentacle-cert] action run
- execute "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/sowen/AppData/Local/Temp/2/chef-script20160817-2116-176koe7.ps1"
* powershell_script[create-instance-Tentacle] action run
- execute "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/sowen/AppData/Local/Temp/2/chef-script20160817-2116-1h1q6d6.ps1"
* powershell_script[configure-tentacle-Tentacle] action run
- execute "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/sowen/AppData/Local/Temp/2/chef-script20160817-2116-qnlanm.ps1"
* windows_service[OctopusDeploy Tentacle] action enable (up to date)
* windows_service[OctopusDeploy Tentacle] action start (up to date)
* windows_service[OctopusDeploy Tentacle] action restart
- restart service windows_service[OctopusDeploy Tentacle]
* octopus_deploy_tentacle[Tentacle] action register
* powershell_script[register-Tentacle-tentacle] action run
- execute "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/sowen/AppData/Local/Temp/2/chef-script20160817-2116-1913boz.ps1"
Starting audit phase�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
The logical progression of testing has now moved away from audit mode to that of inspec (which is based on server spec). The inspec documentation is pretty awesome and it is already installed on newer versions of chef.
The new resources in 12.5+ are great and before a 1.0.0 release we should move to this style. We can use compat resource to help solve backwards compatible issues but I believe a 1.0.0 release would make more sense to support 12.5+ only
Currently we are using an internal test box that no one else has access to but we should change this to use something public.
The octopus logs warn that this command will be deprecated in 4.0
WARN 'Octopus.Server.exe configure --storageConnectionString' has been deprecated and will be removed in Octopus 4.0. Please use the 'Octopus.Server.exe database --connectionString' command instead.
If you call option_list on a nil or undefined object, it throws an error.
================================================================================
Error executing action `register` on resource 'octopus_deploy_tentacle[Tentacle]'
================================================================================
NoMethodError
-------------
undefined method `map' for nil:NilClass
Resource Declaration:
option_list is only currently used in a couple of places, and those are all required attributes.
Make it so that option_list can handle optional attributes (nil)
Travis CI started failing because of rake 11.0.1
Recently Octopus Deploy started to support different authentication providers. We should probably come up with a way to define these authentication providers at server setup time.
https://octopus.com/docs/administration/authentication-providers
Don't use windows_package
anymore since it is deprecated in favor of the built in package
resource as of chef 12
* octopus_deploy_tentacle[Tentacle] action install[2016-08-02T19:31:17+00:00] WARN: Please use the package resource available in Chef Client 12.6.
windows_package will be removed in the next major version release
of the Windows cookbook.
Currently if you run the tools script it will put files somewhere on the filesystem, but that will not be accessible to scripts. The tools resource should have an option to include the installed path to the system path.
Octopus 3.4 adds support for tenants.
Allow the cookbook to register a machine as part of a tenant.
A machine can be part of 0 to many tenants.
The following error is occuring for older versions of chef-client (12.2.1) is an example
undefined local variable or method `home_path' for Chef::Resource::OctopusDeployTentacle:Class
Cleanup some of the duplicated code for the tentacle register action. Currently there are two resources on for each type of setup. It should be cleaned up to use the same join script.
The server resource is really hard to debug if there is an error, thanks sensitive variable. We should have a way to debug it by not making it sensitive anymore.
There is a use case to include installers on hosts with no internet access. I think we could include a way to install via a local path to start out.
reported by @bdevenney in #100
I find that every time I try and use test kitchen to install a tentacle, I get this error
* powershell_script[generate-tentacle-cert] action run
================================================================================
Error executing action `run` on resource 'powershell_script[generate-tentacle-cert]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/ADMINI~1/AppData/Local/Temp/chef-script20160804-1440-10ljeji.ps1" ----
STDOUT:
STDERR: C:\Users\Administrator\AppData\Local\Temp\chef-script20160804-1440-10ljeji.ps1
: ERROR: Command returned 100 Generating Cert for the machine
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExcep
tion
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
n,chef-script20160804-1440-10ljeji.ps1
---- End output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/ADMINI~1/AppData/Local/Temp/chef-script20160804-1440-10ljeji.ps1" ----
Ran "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/ADMINI~1/AppData/Local/Temp/chef-script20160804-1440-10ljeji.ps1" returned 1
Resource Declaration:
---------------------
# In C:/Users/ADMINI~1/AppData/Local/Temp/kitchen/cache/cookbooks/octopus-deploy/providers/tentacle.rb
83: generate_cert = powershell_script 'generate-tentacle-cert' do
84: action :run
85: cwd tentacle_install_location
86: code <<-EOH
87: .\\Tentacle.exe new-certificate -e "#{cert_file}" --console
88: #{catch_powershell_error('Generating Cert for the machine')}
89: EOH
90: not_if { cert_file.nil? || ::File.exist?(cert_file) }
91: end
92:
Compiled Resource:
------------------
# Declared in C:/Users/ADMINI~1/AppData/Local/Temp/kitchen/cache/cookbooks/octopus-deploy/providers/tentacle.rb:83:in `block in class_from_file'
powershell_script("generate-tentacle-cert") do
action [:run]
retries 0
retry_delay 2
default_guard_interpreter :powershell_script
command "generate-tentacle-cert"
backup 5
cwd "C:\\Program Files\\Octopus Deploy\\Tentacle"
returns 0
code " .\\Tentacle.exe new-certificate -e \"c:\\Octopus\\tentacle_cert.txt\" --console\n if ( ! $? ) { throw \"ERROR: Command returned $LastExitCode Generating Cert for the machine\" }\n"
interpreter "powershell.exe"
declared_type :powershell_script
cookbook_name "nd-octopus"
not_if { #code block }
end
Platform:
---------
x64-mingw32
Questions:
Tentacle.exe create-instance --instance "Tentacle" --config "C:\Octopus\Tentacle.config" --console
Tentacle.exe new-certificate --instance "Tentacle" --if-blank --console
http://docs.octopusdeploy.com/display/OD/Automating+Tentacle+installation
Why does the new cert generation not use --if-blank
Tentacle.exe new-certificate --if-blank --console
generate_cert = powershell_script 'generate-tentacle-cert' do
action :run
cwd tentacle_install_location
code <<-EOH
.\\Tentacle.exe new-certificate -e "#{cert_file}" --console
#{catch_powershell_error('Generating Cert for the machine')}
EOH
not_if { cert_file.nil? || ::File.exist?(cert_file) }
end
If you uninstall the tentacle and delete the cert, then try and run chef, the installation/registration will fail with error: See this gist for full chef error
Octopus logs
2016-08-16 20:09:47.2058 7 FATAL No certificate has been generated for this Tentacle. Please run the new-certificate command before starting.
The octopus logs are a bit misleading since the cert has been generated, it just wasn't imported because the cert was generated with the -e
flag.
-e, --export-file=VALUE Exports a new certificate to the specified file
as unprotected base64 text, but does not save it
to the Tentacle configuration; for use with the
import-certificate command
There are multiple factors that create the code path that causes this problem
not_if { ::Win32::Service.exists?(service_name) }
https://github.com/cvent/octopus-deploy-cookbook/blob/master/providers/tentacle.rb#L131
Manually delete windows service before attempting to run chef
Removing the firewall functionality from #33 and splitting into its own enhancement.
In metadata.rb
depends 'windows_firewall', '~> 3.0.2'
In providers/tentacle.rb
firewall = windows_firewall_rule 'Octopus Deploy Tentacle' do
localport lazy { port.to_s }
dir :in
protocol 'TCP'
firewall_action :allow
action :create
only_if { polling == false }
end
and
new_resource.updated_by_last_action(actions_updated?([firewall, register_listening_instance, register_polling_instance]))
From what I can tell, it appears that this cookbook does not automate the registering of the tentacle with the octopus server.
http://docs.octopusdeploy.com/display/OD/Automating+Tentacle+installation
"netsh" advfirewall firewall add rule "name=Octopus Deploy Tentacle" dir=in action=allow protocol=TCP localport=10933
Tentacle.exe register-with --instance "Tentacle" --server "http://YOUR_OCTOPUS" --apiKey="API-YOUR_API_KEY" --role "web-server" --environment "Staging" --comms-style TentaclePassive --console
Tentacle.exe service --instance "Tentacle" --install --start --console
Am I reading the documentation correctly? If so, how would you then register tentacles with the server? Do you use powershell?
Need to polish some of the documentation for the bump to 1.0.0
You will get an error if you don't specify the node name when creating an octopus server
ERROR: Command returned 100 Configuring Cluster Node Name
-----> Starting Kitchen (v1.16.0)
-----> Converging <server-netdocuments-windows-2012r2>...
Preparing files for transfer
Preparing dna.json
Resolving cookbook dependencies with Berkshelf 5.6.4...
Removing non-cookbook files before transfer
Preparing validation.pem
Preparing client.rb
-----> Chef Omnibus installation detected (install only if missing)
Transferring files to <server-netdocuments-windows-2012r2>
Starting Chef Client, version 12.16.42
resolving cookbooks for run list: ["nd-octopus::server"]
Synchronizing Cookbooks:
- nd-octopus (0.8.1)
- windows (1.43.0)
- windows_firewall (3.0.2)
- octopus-deploy (0.12.0)
- chef_handler (3.0.2)
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 2 resources
Recipe: nd-octopus::server
* chocolatey_package[MsSqlServer2014Express] action install (up to date)
* octopus_deploy_server[OctopusServer] action install[2017-09-21T03:22:19+00:00] WARN: Please use the package resource available in Chef Client 12.6.
windows_package will be removed in the next major version release
of the Windows cookbook.
* remote_file[C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/octopus-server.msi] action create (up to date)
* windows_package[Octopus Deploy Server] action install (up to date)
(up to date)
* octopus_deploy_server[OctopusServer] action configure[2017-09-21T03:22:21+00:00] WARN: Please use the package resource available in Chef Client 12.6.
windows_package will be removed in the next major version release
of the Windows cookbook.
* remote_file[C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/octopus-server.msi] action create (up to date)
* windows_package[Octopus Deploy Server] action install (up to date)
* powershell_script[create-instance-OctopusServer] action run (skipped due to not_if)
* powershell_script[configure-server-OctopusServer] action run
================================================================================
Error executing action `run` on resource 'powershell_script[configure-server-OctopusServer]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20170921-768-bsxbyt.ps1" ----
STDOUT:
STDERR: ===============================================================================Missing required value for option '--serverNodeName'.
Octopus.Shared.Internals.Options.OptionException
at Octopus.Shared.Internals.Options.OptionValueCollection.AssertValid(Int32 index)
at Octopus.Shared.Internals.Options.OptionSet.<>c__DisplayClass16_0.<Add>b__0(OptionValueCollection v)
at Octopus.Shared.Internals.Options.Option.Invoke(OptionContext c)
at Octopus.Shared.Internals.Options.OptionSet.Parse(IEnumerable`1 arguments)
at Octopus.Shared.Startup.AbstractCommand.Start(String[] commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions)
at Octopus.Shared.Startup.ConsoleHost.Run(Action`1 start, Action shutdown)
at Octopus.Shared.Startup.OctopusProgram.Run()
-------------------------------------------------------------------------------
Terminating process with exit code 100
Full error details are available in the log files at:
C:\Octopus\Logs
C:\Users\vagrant\AppData\Local\Octopus\Logs
If you need help, please send these log files to https://octopus.com/support
-------------------------------------------------------------------------------
C:\Users\vagrant\AppData\Local\Temp\chef-script20170921-768-bsxbyt.ps1 :
ERROR: Command returned 100 Configuring Cluster Node Name
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExcep
tion
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
n,chef-script20170921-768-bsxbyt.ps1
---- End output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20170921-768-bsxbyt.ps1" ----
Ran "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20170921-768-bsxbyt.ps1" returned 1
Resource Declaration:
---------------------
# In C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/octopus-deploy/resources/server.rb
76: powershell_script "configure-server-#{instance}" do # ~FC009
77: action :run
78: cwd server_install_location
79: sensitive new_resource.sensitive
80: code <<-EOH
81: .\\Octopus.Server.exe configure --instance "#{instance}" --home "#{home_path}" --console
82: #{catch_powershell_error('Configuring Home Dir')}
83: .\\Octopus.Server.exe configure --instance "#{instance}" --storageConnectionString "#{connection_string}" --console
84: #{catch_powershell_error('Configuring Database Connection')}
85: .\\Octopus.Server.exe configure --instance "#{instance}" --upgradeCheck "True" --upgradeCheckWithStatistics "True" --console
86: #{catch_powershell_error('Configuring Upgrade Checks')}
87: .\\Octopus.Server.exe configure --instance "#{instance}" --webAuthenticationMode "Domain" --console
88: #{catch_powershell_error('Configuring authentication')}
89: .\\Octopus.Server.exe configure --instance "#{instance}" --serverNodeName "#{node_name}" --console
90: #{catch_powershell_error('Configuring Cluster Node Name')}
91: .\\Octopus.Server.exe configure --instance "#{instance}" --webForceSSL "False" --webListenPrefixes "http://localhost:80/" --commsListenPort "10943" --console
92: #{catch_powershell_error('Configuring Listen Ports')}
93: #{".\\Octopus.Server.exe configure --instance \"#{instance}\" --masterkey \"#{master_key}\" --console; #{catch_powershell_error('Configuring Master Key')}" if master_key}
94: #{".\\Octopus.Server.exe database --instance \"#{instance}\" --create --console; #{catch_powershell_error('Create Database')}" if create_database}
95: .\\Octopus.Server.exe service --instance "#{instance}" --stop --console
96: #{catch_powershell_error('Stop Service')}
97: #{".\\Octopus.Server.exe admin --instance \"#{instance}\" --username \"#{admin_user}\" --console; #{catch_powershell_error('Set administrator')}" if admin_user}
98: #{".\\Octopus.Server.exe license --instance \"#{instance}\" --licenseBase64 \"#{Base64.encode64(license)}\" --console; #{catch_powershell_error('Configuring License')}" if license}
99: .\\Octopus.Server.exe service --instance "#{instance}" --install --reconfigure --console
100: #{catch_powershell_error('Create Service')}
101: EOH
102: not_if { ::Win32::Service.exists?(service_name) }
103: end
104:
Compiled Resource:
------------------
# Declared in C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/octopus-deploy/resources/server.rb:76:in `block in class_from_file'
powershell_script("configure-server-OctopusServer") do
action [:run]
retries 0
retry_delay 2
default_guard_interpreter :powershell_script
command "configure-server-OctopusServer"
backup 5
cwd "C:\\Program Files\\Octopus Deploy\\Octopus"
returns 0
code " .\\Octopus.Server.exe configure --instance \"OctopusServer\" --home \"C:\\Octopus\" --console\n if ( ! $? ) { throw \"ERROR: Command returned $LastExitCode Configuring Home Dir\" }\n .\\Octopus.Server.exe configure --instance \"OctopusServer\" --storageConnectionString \"Server=(local)\\SQLExpress;Database=OnlineStore;Integrated Security=SSPI\" --console\n if ( ! $? ) { throw \"ERROR: Command returned $LastExitCode Configuring Database Connection\" }\n .\\Octopus.Server.exe configure --instance \"OctopusServer\" --upgradeCheck \"True\" --upgradeCheckWithStatistics \"True\" --console\n if ( ! $? ) { throw \"ERROR: Command returned $LastExitCode Configuring Upgrade Checks\" }\n .\\Octopus.Server.exe configure --instance \"OctopusServer\" --webAuthenticationMode \"Domain\" --console\n if ( ! $? ) { throw \"ERROR: Command returned $LastExitCode Configuring authentication\" }\n .\\Octopus.Server.exe configure --instance \"OctopusServer\" --serverNodeName \"\" --console\n if ( ! $? ) { throw \"ERROR: Command returned $LastExitCode Configuring Cluster Node Name\" }\n .\\Octopus.Server.exe configure --instance \"OctopusServer\" --webForceSSL \"False\" --webListenPrefixes \"http://localhost:80/\" --commsListenPort \"10943\" --console\n if ( ! $? ) { throw \"ERROR: Command returned $LastExitCode Configuring Listen Ports\" }\n \n .\\Octopus.Server.exe database --instance \"OctopusServer\" --create --console; if ( ! $? ) { throw \"ERROR: Command returned $LastExitCode Create Database\" }\n .\\Octopus.Server.exe service --instance \"OctopusServer\" --stop --console\n if ( ! $? ) { throw \"ERROR: Command returned $LastExitCode Stop Service\" }\n \n \n .\\Octopus.Server.exe service --instance \"OctopusServer\" --install --reconfigure --console\n if ( ! $? ) { throw \"ERROR: Command returned $LastExitCode Create Service\" }\n"
interpreter "powershell.exe"
declared_type :powershell_script
cookbook_name "nd-octopus"
not_if { #code block }
end
Platform:
---------
x64-mingw32
Should be able to configure a server with the octopus_deploy_server
resource. The scope of this is the following:
Currently the server resource is missing a lot of documentation , this should be added to catch it up with whats currently so.
When configuring the octopus deploy server instance I am getting a timeout error because of the restart service command that happens immediately after configuration. BEcause we only support configuring a fresh service install this should be able to be removed.
Before registering a tentacle, verify that the environment exists.
I think it makes sense to include a resource to install Octo.exe tool to a configurable location on disk. It should just have an :install action for now which could be expanded to remove later.
Here is what needs to happen from a high level:
Recently we added the tools resource however no documentation was ever added.
Hi all, I am trying to provision some Windows 2012 servers but I can't get the Octopus Tentacle install step through.
If fails on the first Chef run with:
ERROR: Command returned
100 Generating Cert for the machine
Recipe
octopus_deploy_tentacle 'Tentacle' do
version node['octopus_server']['version']
trusted_cert node['tentacle']['trusted_cert']
configure_firewall true
action [:install, :configure]
end
Stack trace
Message=Failed Chef Client run eaba2e43-6477-49d4-b122-434cc56155c2 in 69.342504 seconds.
Exception type: Mixlib::ShellOut::ShellCommandFailed
Exception message: octopus_deploy_tentacle[Tentacle] (temp_octopus_deploy::tentacle line 19) had an error: Mixlib::ShellOut::ShellCommandFailed: powershell_script[generate-tentacle-cert-Tentacle] (C:/chef/cache/cookbooks/octopus-deploy/resources/tentacle.rb line 84) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Windows/Temp/chef-script20170629-3004-1c1mrwb.ps1" ----
STDOUT:
STDERR: C:\Windows\Temp\chef-script20170629-3004-1c1mrwb.ps1 : ERROR: Command returned
100 Generating Cert for the machine
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExcep
tion
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
n,chef-script20170629-3004-1c1mrwb.ps1
---- End output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Windows/Temp/chef-script20170629-3004-1c1mrwb.ps1" ----
Ran "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Windows/Temp/chef-script20170629-3004-1c1mrwb.ps1" returned 1
Exception backtrace: C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/mixlib-shellout-2.2.7-universal-mingw32/lib/mixlib/shellout.rb:289:in invalid!' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/mixlib-shellout-2.2.7-universal-mingw32/lib/mixlib/shellout.rb:276:in
error!'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/mixin/shell_out.rb:120:in shell_out!' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/provider/execute.rb:58:in
block in action_run'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/mixin/why_run.rb:52:in add_action' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/provider.rb:202:in
converge_by'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/provider/execute.rb:56:in action_run' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/provider/script.rb:64:in
action_run'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/provider/windows_script.rb:57:in action_run' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/provider/powershell_script.rb:35:in
action_run'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/provider.rb:171:in run_action' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/resource.rb:591:in
run_action'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/runner.rb:69:in run_action' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/runner.rb:97:in
block (2 levels) in converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/runner.rb:97:in each' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/runner.rb:97:in
block in converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/resource_collection/resource_list.rb:94:in block in execute_each_resource' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:114:in
call_iterator_block'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:85:in step' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:103:in
iterate'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:55:in each_with_index' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/resource_collection/resource_list.rb:92:in
execute_each_resource'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/runner.rb:96:in converge' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/provider.rb:212:in
compile_and_converge_action'
(eval):2:in action_configure' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/provider.rb:171:in
run_action'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/resource.rb:591:in run_action' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/runner.rb:69:in
run_action'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/runner.rb:97:in block (2 levels) in converge' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/runner.rb:97:in
each'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/runner.rb:97:in block in converge' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/resource_collection/resource_list.rb:94:in
block in execute_each_resource'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:114:in call_iterator_block' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:85:in
step'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:103:in iterate' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:55:in
each_with_index'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/resource_collection/resource_list.rb:92:in execute_each_resource' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/runner.rb:96:in
converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/client.rb:715:in block in converge' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/client.rb:710:in
catch'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/client.rb:710:in converge' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/client.rb:749:in
converge_and_save'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/client.rb:286:in run' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/application.rb:273:in
run_with_graceful_exit_option'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/application.rb:249:in block in run_chef_client' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/local_mode.rb:44:in
with_server_connectivity'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/application.rb:232:in run_chef_client' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/application/client.rb:464:in
sleep_then_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/application/client.rb:451:in block in interval_run_chef_client' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/application/client.rb:450:in
loop'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/application/client.rb:450:in interval_run_chef_client' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/application/client.rb:434:in
run_application'
C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/lib/chef/application.rb:59:in run' C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.118-universal-mingw32/bin/chef-client:26:in
<top (required)>'
C:/opscode/chef/bin/chef-client:69:in load' C:/opscode/chef/bin/chef-client:69:in
The other change I needed to make was to fork the octopus-deploy cookbook to change the installer_url so that it can pick up the file locally. (Our servers don't have access to the internet)
Any pointers appreciated. I noticed #32 but I am not using TestKitchen and wish to avoid running anything manually on the server itself.
Update: This is using version 0.12.0 of the octopus-deploy cookbook.
Cheers,
Barry.
The service tries to notify the service to restart but its already going to be off, so we should not do this if the start_service is set to false.
Using the cookbook to download tentacle from https://octopus.com/downloads:
https://download.octopusdeploy.com/octopus/Octopus.Tentacle.3.5.2-x64.msi
MD5 checksum taken from same website:
8b0ca3cfa5ecde120081aeb070c8b585
Chef::Exceptions::ChecksumMismatch: Checksum on resource (8b0ca3) does not match checksum on content (706bcc)
Either Octopus got it wrong, or the MD5 checksum provided isn't right?
We should look at the sensitive variable and set it to be on some of the powershell scripts if it is set. On the main octopus-deploy-server resource people should also set this value.
I'm a bit confused on how the database is set up. The readme shows that you can use create_database
property to setup the database, but it assumes a database sever is already installed.
Looking at appvoyer and travis, I don't see how you are testing the octopus server. The connection string is
'Data Source=localhostdba;Initial Catalog=octo;Integrated Security=False;User ID=octo;Password=password'
Yet nowhere is sql installed. Are you using a golden image with sql express already installed? I can't get the server cookbook to converge without an actual database to point to.
I've found 3 cookbooks to deploy octopus tentacles
https://github.com/cvent/octopus-deploy-cookbook
https://github.com/burnzy/octopus-cookbook
https://github.com/ashmere/octopusdeploy-chef
Why this one? Whats different from the others?
Currently the environment attribute must be a string.
In Chef each machine can only be part of 1 environment. In Octopus Deploy a machine can be part of multiple environments.
Change environment to an array.
This isn't a high priority, and is would probably be a breaking change.
The example I added to the readme for creating an octopus server has a major limitation: It will not grant db_owner rights to the SYSTEM account for the database
I've spent many many hours trying to automate this with powershell with no luck.
https://stackoverflow.com/questions/18468637/powershell-user-mapping-sql-server-2012
Warn users that this cookbook wont give you a 100% working octopus server.
Install sql server managment studio
chocolatey_package 'sql-server-management-studio' do
action :install
end
Click 'Security'-> 'Logins' -> 'NT AUTHORITY\SYSTEM' -> 'properties'
Click "User Mappings' and grant db_owner rights to the OctopusDeploy database
If you use the octopus_server resource, you must provide a connection string if you wish to use the :configure
action
================================================================================
Error executing action `configure` on resource 'octopus_deploy_server[OctopusServer]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
powershell_script[configure-server-OctopusServer] (C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/octopus-deploy/resources/server.rb line 76) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20170920-2732-b3ylnp.ps1" ----
STDOUT:
STDERR: ===============================================================================Missing required value for option '--storageConnectionString'.
Octopus.Shared.Internals.Options.OptionException
at Octopus.Shared.Internals.Options.OptionValueCollection.AssertValid(Int32 index)
at Octopus.Shared.Internals.Options.OptionSet.<>c__DisplayClass16_0.<Add>b__0(OptionValueCollection v)
at Octopus.Shared.Internals.Options.Option.Invoke(OptionContext c)
at Octopus.Shared.Internals.Options.OptionSet.Parse(IEnumerable`1 arguments)
at Octopus.Shared.Startup.AbstractCommand.Start(String[] commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions)
at Octopus.Shared.Startup.ConsoleHost.Run(Action`1 start, Action shutdown)
at Octopus.Shared.Startup.OctopusProgram.Run()
Enhancement
Add a powershell_script resource that attempts to call the octopus server api.
If the octopus api is unavailable, log a warning and continue with the chef run.
When you run chef-client and install the tentacle, the msi pops open a progress bar.
The fix is to add the /quiet
parameter to the msi
msiexec /i Octopus.Tentacle.<version>.msi /quiet
http://docs.octopusdeploy.com/display/OD/Automating+Tentacle+installation
Add changelog and include rake generator to create changelog with magic
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.