Salt formula to install cubicweb-saem_ref
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



A saltstack formula handling installation of saem_ref.

The formula will run two web application server, one dedicated to OAIPMH request to serve /oai on port 8081 and one for other requests on port 8080.

To use them in a single port you may configure a reverse proxy, such as apache2 or nginx, on front of the instances.

Available states


Equivalent to saemref.install and saemref.config.


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 version 9.6 (see pillar.example).


Only manage instance configuration files.


Create instance database with cubicweb-ctl db-create (call implicitly db-init).

WARNING: this will destroy existing database if exists.


Initialize instance database schema with cubicweb-ctl db-init.


Install and manage supervisor configuration for the saemref installation. Here is some useful commands:

  • restart instance: supervisorctl restart saemref
  • restart supervisor: systemctl restart supervisord


If using postgres as database driver, ensure the postgres contrib package is installed on server side.

Recommended usage

Given target minion_id is 'srv'.


        - saemref
        - saemref.supervisor


        - saemref

/srv/pillar/saemref.sls: see pillar.example

Example of reverse proxy configuration for nginx:

server {
    listen 80;
    location / {
        proxy_pass http://srv:8080;
    location /oai {
        proxy_pass http://srv:8081;

For the first installation run salt srv state.sls db-create to create the database (WARNING: this will destroy existing database if exists).

Then run: salt srv state.highstate to finish the installation.


To force an upgrade to the latest version of saem-ref, connect to the minion as root, then run:

[root@minion] % salt-call state.sls saemref.upgrade

If upgrade process fails, a backup is created in /home/saemref/etc/cubicweb.d/saemref/backup


The script can help to develop and test the formula using docker and testinfra.

The command ./ dev centos7 will build image from test/centos7.Dockerfile and span a shell in a new container with mounted volumes from the host (so you can develop formula on the host and test it in the container with salt-call).

The command ./ dev centos7 --salt is the same as above but will provision the container (eg. calling salt-call state.highstate)

The command ./ test centos7 -- test built a provisioned image (highstate) and run testinfra tests on it.

Note that you can add any parameters that testinfra (pytest) accept, for instance ./ test centos7 -- -k idempotence --pdb test.

Testing migration

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

# To test upgrade against latest public changeset of
./ test centos7 -- test/ --upgrade-revision master

# To test against any revision from
./ test centos7 -- test/ --upgrade-revision REV