2015-02-23 23:40:07 +05:30
|
|
|
========
|
|
|
|
postgres
|
|
|
|
========
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
See the full `Salt Formulas installation and usage instructions
|
|
|
|
<http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html>`_.
|
|
|
|
|
|
|
|
Available states
|
|
|
|
================
|
|
|
|
|
|
|
|
.. contents::
|
|
|
|
:local:
|
|
|
|
|
|
|
|
``postgres``
|
|
|
|
------------
|
|
|
|
|
2017-01-09 16:05:48 +02:00
|
|
|
Installs and configures both PostgreSQL server and client with creation of various DB objects in
|
2018-03-08 11:41:19 +00:00
|
|
|
the cluster. This state applies to both Linux and MacOS.
|
2015-02-23 23:40:07 +05:30
|
|
|
|
2016-09-20 15:44:49 +03:00
|
|
|
``postgres.client``
|
2015-02-23 23:40:07 +05:30
|
|
|
-------------------
|
|
|
|
|
2018-03-08 11:41:19 +00:00
|
|
|
Installs the PostgreSQL client binaries and libraries on Linux.
|
2016-10-20 12:23:40 +03:00
|
|
|
|
|
|
|
``postgres.manage``
|
|
|
|
-------------------
|
|
|
|
|
2017-01-09 16:05:48 +02:00
|
|
|
Creates such DB objects as: users, tablespaces, databases, schemas and extensions.
|
|
|
|
See ``pillar.example`` file for details.
|
2015-02-23 23:40:07 +05:30
|
|
|
|
2016-09-20 15:44:49 +03:00
|
|
|
``postgres.python``
|
2015-04-21 13:40:01 -07:00
|
|
|
-------------------
|
|
|
|
|
2018-03-08 11:41:19 +00:00
|
|
|
Installs the PostgreSQL adapter for Python on Linux.
|
2016-09-20 15:44:49 +03:00
|
|
|
|
2016-10-04 14:38:21 +03:00
|
|
|
``postgres.server``
|
|
|
|
-------------------
|
|
|
|
|
2018-03-08 11:41:19 +00:00
|
|
|
Installs the PostgreSQL server package on Linux, prepares the DB cluster and starts the server using
|
2017-01-09 16:05:48 +02:00
|
|
|
packaged init script, job or unit.
|
|
|
|
|
|
|
|
``postgres.server.image``
|
|
|
|
-------------------------
|
|
|
|
|
2018-03-08 11:41:19 +00:00
|
|
|
Installs the PostgreSQL server package on Linux, prepares the DB cluster and starts the server by issuing
|
2017-01-09 16:05:48 +02:00
|
|
|
raw ``pg_ctl`` command. The ``postgres:bake_image`` Pillar toggles this behaviour. For example:
|
|
|
|
|
|
|
|
.. code:: yaml
|
|
|
|
|
|
|
|
postgres:
|
|
|
|
bake_image: True
|
|
|
|
|
|
|
|
If set ``True``, then it becomes possible to fully provision PostgreSQL with all supported entities
|
|
|
|
from ``postgres.manage`` state during the build ("baking") of AMI / VM / Container images (using
|
|
|
|
Packer, Docker or similar tools), i.e. when OS ``init`` process is not available to start the
|
|
|
|
service and enable it on "boot" of resulting appliance.
|
|
|
|
|
|
|
|
Also it allows to make Docker images with PostgreSQL using functionality being available since Salt
|
|
|
|
2016.11.0 release:
|
|
|
|
|
|
|
|
.. code:: console
|
|
|
|
|
|
|
|
salt 'minion.with.docker' dockerng.sls_build my-postgres base=centos/systemd mods=postgres
|
|
|
|
|
|
|
|
If a lookup dictionary or Pillar has ``postgres:bake_image`` set ``False`` (this is default), it is
|
|
|
|
equivalent of applying ``postgres.server`` state.
|
2016-10-04 14:38:21 +03:00
|
|
|
|
2016-09-20 15:44:49 +03:00
|
|
|
``postgres.upstream``
|
|
|
|
---------------------
|
|
|
|
|
|
|
|
Configures the PostgreSQL Official (upstream) repository on target system if
|
|
|
|
applicable.
|
|
|
|
|
2017-01-09 16:05:48 +02:00
|
|
|
The state relies on the ``postgres:use_upstream_repo`` Pillar value which could be set as following:
|
2016-09-20 15:44:49 +03:00
|
|
|
|
2016-09-23 17:50:57 +03:00
|
|
|
* ``True`` (default): adds the upstream repository to install packages from
|
|
|
|
* ``False``: makes sure that the repository configuration is absent
|
2018-03-08 11:41:19 +00:00
|
|
|
* ``postgresapp`` (MacOS) uses upstream PostgresApp package repository.
|
2016-09-20 15:44:49 +03:00
|
|
|
|
2017-01-09 16:05:48 +02:00
|
|
|
The ``postgres:version`` Pillar controls which version of the PostgreSQL packages should be
|
2018-03-08 11:41:19 +00:00
|
|
|
installed from the upstream Linux repository. Defaults to ``9.5``.
|
2015-04-21 13:40:01 -07:00
|
|
|
|
2015-02-23 23:40:07 +05:30
|
|
|
Testing
|
|
|
|
=======
|
2018-03-08 11:41:19 +00:00
|
|
|
The postgres state was tested on MacOS (El Capitan 10.11.6)
|
2015-02-23 23:40:07 +05:30
|
|
|
|
2016-09-20 15:44:49 +03:00
|
|
|
Testing is done with the ``kitchen-salt``.
|
2015-02-23 23:40:07 +05:30
|
|
|
|
|
|
|
``kitchen converge``
|
|
|
|
--------------------
|
|
|
|
|
2016-09-20 15:44:49 +03:00
|
|
|
Runs the ``postgres`` main state.
|
2015-02-23 23:40:07 +05:30
|
|
|
|
|
|
|
``kitchen verify``
|
|
|
|
------------------
|
|
|
|
|
2016-09-20 15:44:49 +03:00
|
|
|
Runs ``serverspec`` tests on the actual instance.
|
2015-02-23 23:40:07 +05:30
|
|
|
|
|
|
|
``kitchen test``
|
|
|
|
----------------
|
|
|
|
|
2016-09-20 15:44:49 +03:00
|
|
|
Builds and runs tests from scratch.
|
2015-02-23 23:40:07 +05:30
|
|
|
|
|
|
|
``kitchen login``
|
|
|
|
-----------------
|
|
|
|
|
2016-09-20 15:44:49 +03:00
|
|
|
Gives you ssh to the vagrant machine for manual testing.
|
2017-01-09 16:05:48 +02:00
|
|
|
|
|
|
|
.. vim: fenc=utf-8 spell spl=en cc=100 tw=99 fo=want sts=2 sw=2 et
|