Saltstack Official Nginx Formula
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

hace 7 años
hace 7 años
hace 7 años
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. .. _readme:
  2. nginx-formula
  3. =============
  4. |img_travis| |img_sr|
  5. .. |img_travis| image:: https://travis-ci.com/saltstack-formulas/nginx-formula.svg?branch=master
  6. :alt: Travis CI Build Status
  7. :scale: 100%
  8. :target: https://travis-ci.com/saltstack-formulas/nginx-formula
  9. .. |img_sr| image:: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
  10. :alt: Semantic Release
  11. :scale: 100%
  12. :target: https://github.com/semantic-release/semantic-release
  13. Formula to set up and configure `NGINX <https://www.nginx.com/>`_.
  14. .. list-table::
  15. :name: banner-breaking-changes-v1.0.0
  16. :header-rows: 1
  17. :widths: 1
  18. * - WARNING: BREAKING CHANGES SINCE ``v1.0.0``
  19. * - Prior to
  20. `v1.0.0 <https://github.com/saltstack-formulas/nginx-formula/releases/tag/v1.0.0>`_,
  21. this formula provided two methods for managing NGINX;
  22. the old method under ``nginx`` and the new method under ``nginx.ng``.
  23. The old method has now been removed and ``nginx.ng`` has been promoted to
  24. be ``nginx`` in its place.
  25. If you are not in a position to migrate, please pin your repo to the final
  26. release tag before
  27. `v1.0.0 <https://github.com/saltstack-formulas/nginx-formula/releases/tag/v1.0.0>`_,
  28. i.e.
  29. `v0.56.1 <https://github.com/saltstack-formulas/nginx-formula/releases/tag/v0.56.1>`_.
  30. To migrate from ``nginx.ng``, simply modify your pillar to promote the
  31. entire section under ``nginx:ng`` so that it is under ``nginx`` instead.
  32. So with the editor of your choice, highlight the entire section and then
  33. unindent one level. Finish by removing the ``ng:`` line.
  34. To migrate from the old ``nginx``, first convert to ``nginx.ng`` under
  35. `v0.56.1 <https://github.com/saltstack-formulas/nginx-formula/releases/tag/v0.56.1>`_
  36. and then follow the steps laid out in the paragraph directly above.
  37. .. contents:: **Table of Contents**
  38. General notes
  39. -------------
  40. See the full `SaltStack Formulas installation and usage instructions
  41. <https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html>`_.
  42. If you are interested in writing or contributing to formulas, please pay attention to the `Writing Formula Section
  43. <https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#writing-formulas>`_.
  44. If you want to use this formula, please pay attention to the ``FORMULA`` file and/or ``git tag``,
  45. which contains the currently released version. This formula is versioned according to `Semantic Versioning <http://semver.org/>`_.
  46. See `Formula Versioning Section <https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#versioning>`_ for more details.
  47. Contributing to this repo
  48. -------------------------
  49. **Commit message formatting is significant!!**
  50. Please see `How to contribute <https://github.com/saltstack-formulas/.github/blob/master/CONTRIBUTING.rst>`_ for more details.
  51. Available states
  52. ----------------
  53. .. contents::
  54. :local:
  55. ``nginx``
  56. ^^^^^^^^^
  57. Meta-state for inclusion of all states.
  58. **Note:** nginx requires the merge parameter of salt.modules.pillar.get(),
  59. first available in the Helium release.
  60. ``nginx.pkg``
  61. ^^^^^^^^^^^^^
  62. Installs nginx from package, from the distribution repositories, the official nginx repo or the ppa from Launchpad.
  63. ``nginx.src``
  64. ^^^^^^^^^^^^^
  65. Builds and installs nginx from source.
  66. ``nginx.certificates``
  67. ^^^^^^^^^^^^^^^^^^^^^^
  68. Manages the deployment of nginx certificates.
  69. ``nginx.config``
  70. ^^^^^^^^^^^^^^^^
  71. Manages the nginx main server configuration file.
  72. ``nginx.service``
  73. ^^^^^^^^^^^^^^^^^
  74. Manages the startup and running state of the nginx service.
  75. ``nginx.servers_config``
  76. ^^^^^^^^^^^^^^^^^^^^^^^^
  77. Manages virtual host files. This state only manages the content of the files
  78. and does not bind them to service calls.
  79. ``nginx.servers``
  80. ^^^^^^^^^^^^^^^^^
  81. Manages nginx virtual hosts files and binds them to service calls.
  82. ``nginx.passenger``
  83. ^^^^^^^^^^^^^^^^^^^
  84. Installs and configures Phusion Passenger module for nginx. You need to enable
  85. the upstream phusion passenger repository with `install_from_phusionpassenger: true`.
  86. Nginx will also be installed from that repository, as it needs to be modified to
  87. allow the passenger module to work.
  88. Testing
  89. -------
  90. Linux testing is done with ``kitchen-salt``.
  91. Requirements
  92. ^^^^^^^^^^^^
  93. * Ruby
  94. * Docker
  95. .. code-block:: bash
  96. $ gem install bundler
  97. $ bundle install
  98. $ bin/kitchen test [platform]
  99. Where ``[platform]`` is the platform name defined in ``kitchen.yml``,
  100. e.g. ``debian-9-2019-2-py3``.
  101. ``bin/kitchen converge``
  102. ^^^^^^^^^^^^^^^^^^^^^^^^
  103. Creates the docker instance and runs the ``nginx`` main state, ready for testing.
  104. ``bin/kitchen verify``
  105. ^^^^^^^^^^^^^^^^^^^^^^
  106. Runs the ``inspec`` tests on the actual instance.
  107. ``bin/kitchen destroy``
  108. ^^^^^^^^^^^^^^^^^^^^^^^
  109. Removes the docker instance.
  110. ``bin/kitchen test``
  111. ^^^^^^^^^^^^^^^^^^^^
  112. Runs all of the stages above in one go: i.e. ``destroy`` + ``converge`` + ``verify`` + ``destroy``.
  113. ``bin/kitchen login``
  114. ^^^^^^^^^^^^^^^^^^^^^
  115. Gives you SSH access to the instance for manual testing.
  116. Testing with Vagrant
  117. --------------------
  118. Windows/FreeBSD/OpenBSD testing is done with ``kitchen-salt``.
  119. Requirements
  120. ^^^^^^^^^^^^
  121. * Ruby
  122. * Virtualbox
  123. * Vagrant
  124. Setup
  125. ^^^^^
  126. .. code-block:: bash
  127. $ gem install bundler
  128. $ bundle install --with=vagrant
  129. $ bin/kitchen test [platform]
  130. Where ``[platform]`` is the platform name defined in ``kitchen.vagrant.yml``,
  131. e.g. ``windows-81-latest-py3``.
  132. Note
  133. ^^^^
  134. When testing using Vagrant you must set the environment variable ``KITCHEN_LOCAL_YAML`` to ``kitchen.vagrant.yml``. For example:
  135. .. code-block:: bash
  136. $ KITCHEN_LOCAL_YAML=kitchen.vagrant.yml bin/kitchen test # Alternatively,
  137. $ export KITCHEN_LOCAL_YAML=kitchen.vagrant.yml
  138. $ bin/kitchen test
  139. Then run the following commands as needed.
  140. ``bin/kitchen converge``
  141. ^^^^^^^^^^^^^^^^^^^^^^^^
  142. Creates the Vagrant instance and runs the ``nginx`` main state, ready for testing.
  143. ``bin/kitchen verify``
  144. ^^^^^^^^^^^^^^^^^^^^^^
  145. Runs the ``inspec`` tests on the actual instance.
  146. ``bin/kitchen destroy``
  147. ^^^^^^^^^^^^^^^^^^^^^^^
  148. Removes the Vagrant instance.
  149. ``bin/kitchen test``
  150. ^^^^^^^^^^^^^^^^^^^^
  151. Runs all of the stages above in one go: i.e. ``destroy`` + ``converge`` + ``verify`` + ``destroy``.
  152. ``bin/kitchen login``
  153. ^^^^^^^^^^^^^^^^^^^^^
  154. Gives you RDP/SSH access to the instance for manual testing.