Giter Club home page Giter Club logo

saemref-formula's Introduction

https://travis-ci.org/logilab/saemref-formula.svg?branch=master

saemref-formula

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.4 (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

Requirements

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

Recommended usage

Given target minion_id is 'srv'.

/srv/salt/top.sls:

base:
    'srv':
        - saemref
        - saemref.supervisor

/srv/pillar/top.sls:

base:
    'srv':
        - saemref

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

Example of reverse proxy configuration for nginx:

server {
    listen 80;
    server_name saemref.example.com;
    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.

Upgrades

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

[root@minion] % supervisorctl stop all
[root@minion] % salt-call state.sls saemref.install pillar='{"upgrade": true}'
# be patient
[root@minion] % su - saemref
[saemref@minion] % . venv/bin/activate
(venv) [saemref@minion] % cubicweb-ctl upgrade saemref
# proceed to the cubicweb upgrade process
(venv) [saemref@minion] % exit
[root@minion] % supervisorctl start all

Testing

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

The command ./run-test.py 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 ./run-test.py dev centos7 --salt is the same as above but will provision the container (eg. calling salt-call state.highstate)

The command ./run-test.py 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 ./run-test.py 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 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

saemref-formula's People

Contributors

philpep avatar dlax avatar sthenault avatar arthurzenika avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.