apache.pp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #
  2. # Copyright (C) 2015 eNovance SAS <licensing@enovance.com>
  3. #
  4. # Author: Emilien Macchi <emilien.macchi@enovance.com>
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  7. # not use this file except in compliance with the License. You may obtain
  8. # a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  14. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  15. # License for the specific language governing permissions and limitations
  16. # under the License.
  17. #
  18. # Deprecated Class to serve Nova API and EC2 with apache mod_wsgi in place of nova-api and nova-api-ec2 services.
  19. # Use ::nova::wsgi::apache::api.
  20. #
  21. # Serving Nova API and Nova API EC2 from apache is the recommended way to go for production
  22. # because of limited performance for concurrent accesses.
  23. #
  24. # When using this class you should disable your nova-api and nova-api-ec2 service.
  25. #
  26. # == Parameters
  27. #
  28. # [*servername*]
  29. # The servername for the virtualhost.
  30. # Optional. Defaults to $::fqdn
  31. #
  32. # [*api_port*]
  33. # The port for Nova API service.
  34. # Optional. Defaults to 8774
  35. #
  36. # [*bind_host*]
  37. # The host/ip address Apache will listen on.
  38. # Optional. Defaults to undef (listen on all ip addresses).
  39. #
  40. # [*path*]
  41. # The prefix for the endpoint.
  42. # Optional. Defaults to '/'
  43. #
  44. # [*ssl*]
  45. # Use ssl ? (boolean)
  46. # Optional. Defaults to true
  47. #
  48. # [*workers*]
  49. # Number of WSGI workers to spawn.
  50. # Optional. Defaults to 1
  51. #
  52. # [*priority*]
  53. # (optional) The priority for the vhost.
  54. # Defaults to '10'
  55. #
  56. # [*threads*]
  57. # (optional) The number of threads for the vhost.
  58. # Defaults to $::os_workers
  59. #
  60. # [*wsgi_process_display_name*]
  61. # (optional) Name of the WSGI process display-name.
  62. # Defaults to undef
  63. #
  64. # [*ssl_cert*]
  65. # [*ssl_key*]
  66. # [*ssl_chain*]
  67. # [*ssl_ca*]
  68. # [*ssl_crl_path*]
  69. # [*ssl_crl*]
  70. # [*ssl_certs_dir*]
  71. # apache::vhost ssl parameters.
  72. # Optional. Default to apache::vhost 'ssl_*' defaults.
  73. #
  74. # == Dependencies
  75. #
  76. # requires Class['apache'] & Class['nova'] & Class['nova::api']
  77. #
  78. # == Examples
  79. #
  80. # include apache
  81. #
  82. # class { 'nova::wsgi::apache': }
  83. #
  84. # Note: we can't transform this class in a define for backward compatibility.
  85. # though this class might become a define in the future.
  86. class nova::wsgi::apache (
  87. $servername = $::fqdn,
  88. $api_port = 8774,
  89. $bind_host = undef,
  90. $path = '/',
  91. $ssl = true,
  92. $workers = 1,
  93. $ssl_cert = undef,
  94. $ssl_key = undef,
  95. $ssl_chain = undef,
  96. $ssl_ca = undef,
  97. $ssl_crl_path = undef,
  98. $ssl_crl = undef,
  99. $ssl_certs_dir = undef,
  100. $wsgi_process_display_name = undef,
  101. $threads = $::os_workers,
  102. $priority = '10',
  103. ) {
  104. include ::nova::params
  105. include ::apache
  106. include ::apache::mod::wsgi
  107. if $ssl {
  108. include ::apache::mod::ssl
  109. }
  110. if ! defined(Class[::nova::api]) {
  111. fail('::nova::api class must be declared in composition layer.')
  112. }
  113. warning('nova::wsgi::apache is deprecated and will be removed in a future release, please use nova::wsgi::apache_api')
  114. class { '::nova::wsgi::apache_api':
  115. servername => $servername,
  116. api_port => $api_port,
  117. bind_host => $bind_host,
  118. path => $path,
  119. ssl => $ssl,
  120. workers => $workers,
  121. ssl_cert => $ssl_cert,
  122. ssl_key => $ssl_key,
  123. ssl_chain => $ssl_chain,
  124. ssl_ca => $ssl_ca,
  125. ssl_crl_path => $ssl_crl_path,
  126. ssl_crl => $ssl_crl,
  127. ssl_certs_dir => $ssl_certs_dir,
  128. wsgi_process_display_name => $wsgi_process_display_name,
  129. threads => $threads,
  130. priority => $priority,
  131. }
  132. }