Skip to content

Commit 52d57d3

Browse files
committed
Describe postgres.server.image state in README
1 parent b7771fe commit 52d57d3

File tree

3 files changed

+42
-14
lines changed

3 files changed

+42
-14
lines changed

README.rst

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Available states
1616
``postgres``
1717
------------
1818

19-
Installs and configures both PostgreSQL server and client with creation of
20-
various DB objects in the cluster.
19+
Installs and configures both PostgreSQL server and client with creation of various DB objects in
20+
the cluster.
2121

2222
``postgres.client``
2323
-------------------
@@ -27,8 +27,8 @@ Installs the PostgreSQL client binaries and libraries.
2727
``postgres.manage``
2828
-------------------
2929

30-
Creates such DB objects as: users, tablespaces, databases, schemas and
31-
extensions. See ``pillar.example`` file for details.
30+
Creates such DB objects as: users, tablespaces, databases, schemas and extensions.
31+
See ``pillar.example`` file for details.
3232

3333
``postgres.python``
3434
-------------------
@@ -38,22 +38,48 @@ Installs the PostgreSQL adapter for Python.
3838
``postgres.server``
3939
-------------------
4040

41-
Installs the PostgreSQL server package and prepares the DB cluster.
41+
Installs the PostgreSQL server package, prepares the DB cluster and starts the server using
42+
packaged init script, job or unit.
43+
44+
``postgres.server.image``
45+
-------------------------
46+
47+
Installs the PostgreSQL server package, prepares the DB cluster and starts the server by issuing
48+
raw ``pg_ctl`` command. The ``postgres:bake_image`` Pillar toggles this behaviour. For example:
49+
50+
.. code:: yaml
51+
52+
postgres:
53+
bake_image: True
54+
55+
If set ``True``, then it becomes possible to fully provision PostgreSQL with all supported entities
56+
from ``postgres.manage`` state during the build ("baking") of AMI / VM / Container images (using
57+
Packer, Docker or similar tools), i.e. when OS ``init`` process is not available to start the
58+
service and enable it on "boot" of resulting appliance.
59+
60+
Also it allows to make Docker images with PostgreSQL using functionality being available since Salt
61+
2016.11.0 release:
62+
63+
.. code:: console
64+
65+
salt 'minion.with.docker' dockerng.sls_build my-postgres base=centos/systemd mods=postgres
66+
67+
If a lookup dictionary or Pillar has ``postgres:bake_image`` set ``False`` (this is default), it is
68+
equivalent of applying ``postgres.server`` state.
4269

4370
``postgres.upstream``
4471
---------------------
4572

4673
Configures the PostgreSQL Official (upstream) repository on target system if
4774
applicable.
4875

49-
The state relies on the ``postgres:use_upstream_repo`` Pillar value which could
50-
be set as following:
76+
The state relies on the ``postgres:use_upstream_repo`` Pillar value which could be set as following:
5177

5278
* ``True`` (default): adds the upstream repository to install packages from
5379
* ``False``: makes sure that the repository configuration is absent
5480

55-
The ``postgres:version`` Pillar controls which version of the PostgreSQL
56-
packages should be installed from the upstream repository. Defaults to ``9.5``.
81+
The ``postgres:version`` Pillar controls which version of the PostgreSQL packages should be
82+
installed from the upstream repository. Defaults to ``9.5``.
5783

5884
Testing
5985
=======
@@ -79,3 +105,5 @@ Builds and runs tests from scratch.
79105
-----------------
80106

81107
Gives you ssh to the vagrant machine for manual testing.
108+
109+
.. vim: fenc=utf-8 spell spl=en cc=100 tw=99 fo=want sts=2 sw=2 et

pillar.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ postgres:
5252

5353
# If Salt is unable to detect init system running in the scope of state run,
5454
# probably we are trying to bake a container/VM image with PostgreSQL.
55-
# Use ``service`` setting to contol how PostgreSQL will be started: if set to
56-
# ``True`` the raw ``pg_ctl`` will be utilized instead of packaged init
55+
# Use ``bake_image`` setting to contol how PostgreSQL will be started: if set
56+
# to ``True`` the raw ``pg_ctl`` will be utilized instead of packaged init
5757
# script, job or unit run with Salt ``service`` state.
5858
bake_image: True
5959

postgres/server/image.sls

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{%- from "postgres/map.jinja" import postgres with context -%}
22
3-
# This state is used to launch PostgreSQL and enable it on "boot" with `pg_ctl`
4-
# during an image (Docker, Virtual Appliance, AMI) preparation
3+
# This state is used to launch PostgreSQL with ``pg_ctl`` command and enable it
4+
# on "boot" during an image (Docker, Virtual Appliance, AMI) preparation
55
66
{%- if postgres.bake_image %}
77
@@ -40,6 +40,6 @@ postgresql-enable:
4040
4141
postgresql-start:
4242
test.show_notification:
43-
- text: The 'postgres.bake_image' Pillar is disabled (set to 'False').
43+
- text: The 'postgres:bake_image' Pillar is disabled (set to 'False').
4444
4545
{%- endif %}

0 commit comments

Comments
 (0)