README.rst 3.86 KB
Newer Older
Denis Laxalde's avatar
Denis Laxalde committed
1
2
3
.. image:: https://travis-ci.org/logilab/saemref-formula.svg?branch=master
    :target: https://travis-ci.org/logilab/saemref-formula

Philippe Pepiot's avatar
init  
Philippe Pepiot committed
4
5
6
7
===============
saemref-formula
===============

8
9
A saltstack formula handling installation of `saem_ref`_.

Philippe Pepiot's avatar
init  
Philippe Pepiot committed
10
11
12
13
14
15
Available states
================

.. contents::
    :local:

Philippe Pepiot's avatar
Philippe Pepiot committed
16
17
18
19
20
``saemref``
-----------

Equivalent to ``saemref.install`` and ``saemref.config``.

21
22
23
``saemref.install``
-------------------

Philippe Pepiot's avatar
Philippe Pepiot committed
24
25
26
27
28
29
30
31
32
Installs the saemref package from logilab repositories and create an instance
for user ``saemref``.

Cubicweb config files are located in ``~saemref/etc/cubicweb.d/saemref`` and
``cubicweb-ctl`` can be invoked as user ``saemref`` with environment variable
``CW_MODE=user``.

The state require the installation of `epel-formula`_ and `postgres-formula`_
with ``postgres.lookup.version: 9.4`` (see ``pillar.example``).
33
34
35
36

``saemref.config``
------------------

Philippe Pepiot's avatar
Philippe Pepiot committed
37
38
39
40
41
Only manage instance configuration files.

``saemref.db-create``
---------------------

42
43
44
45
46
47
Create instance database with ``cubicweb-ctl db-create`` (call implicitly ``db-init``).

``saemref.db-init``
---------------------

Initialize instance database schema with ``cubicweb-ctl db-init``.
48
49
50
51
52
53

``saemref.supervisor``
----------------------

Install and manage `supervisor`_ configuration for the saemref installation.

Philippe Pepiot's avatar
Philippe Pepiot committed
54
55
56
57
58
59
60
+--------------------------+-----------------------------------------------------+-------------------------------------+
| OS                       | Restart instance                                    | Restart supervisor                  |
+==========================+=====================================================+=====================================+
| Centos 6                 | ``su - saemref -c 'supervisorctl restart saemref'`` | ``/etc/init.d/supervisord restart`` |
+--------------------------+-----------------------------------------------------+-------------------------------------+
| Centos 7 / Debian Jessie | ``supervisorctl restart saemref``                   | ``systemctl restart supervisord``   |
+--------------------------+-----------------------------------------------------+-------------------------------------+
Philippe Pepiot's avatar
Philippe Pepiot committed
61

62
63
64
65
66
Requirements
============

If using postgres as database driver, ensure the `postgres contrib`_ package is
installed on server side.
Philippe Pepiot's avatar
Philippe Pepiot committed
67

68
69
70
71
72
73
74

Testing
=======

The script `run-test.py` can help to develop and test the formula using
`docker`_ and `testinfra`_.

Sylvain Thenault's avatar
Sylvain Thenault committed
75
76
The command ``./run-test.py dev centos7`` will build image from
``test/centos7.Dockerfile`` and span a shell in a new container with mounted
77
78
79
volumes from the host (so you can develop formula on the host and test it in
the container with ``salt-call``).

Sylvain Thenault's avatar
Sylvain Thenault committed
80
The command ``./run-test.py dev centos7 --salt`` is the same as above but will
81
82
provision the container (eg. calling ``salt-call state.highstate``)

Sylvain Thenault's avatar
Sylvain Thenault committed
83
The command ``./run-test.py test centos7`` built a provisioned image
84
85
86
(highstate) and run testinfra tests on it.

Note that you can add any parameters that testinfra (pytest) accept, for
Sylvain Thenault's avatar
Sylvain Thenault committed
87
instance ``./run-test.py test centos7 -- -k idempotence --pdb``.
88

Philippe Pepiot's avatar
init  
Philippe Pepiot committed
89

Philippe Pepiot's avatar
Philippe Pepiot committed
90
91
92
93
94
95
96
97
98
99
100
101
Testing migration
=================

Add dumps generated by ``cubicweb-ctl db-dump`` in the ``test/dumps`` directory, then::

    # To test upgrade against latest public changeset of http://hg.logilab.org/master/cubes/saem_ref
    ./run-tests.py test centos7 -- test/test_migration.py --upgrade-revision master

    # To test against any revision from http://hg.logilab.org/review/cubes/saem_ref
    ./run-tests.py test centos7 -- test/test_migration.py --upgrade-revision REV


102
103
104
105
.. _saem_ref: https://www.cubicweb.org/project/cubicweb-saem_ref
.. _supervisor: http://supervisord.org
.. _docker: https://www.docker.com/
.. _testinfra: https://testinfra.readthedocs.org/
Philippe Pepiot's avatar
Philippe Pepiot committed
106
107
.. _epel-formula: https://github.com/saltstack-formulas/epel-formula
.. _postgres-formula: https://github.com/saltstack-formulas/postgres-formula
108
.. _postgres contrib: https://www.postgresql.org/docs/current/static/contrib.html