install.sls 3.74 KB
Newer Older
1
# -*- coding: utf-8 -*-
2
{% from "saemref/map.jinja" import saemref with context %}
3
4

include:
5
6
7
8
9
{% if grains['os_family'] == 'RedHat' %}
  - epel
  - postgres.upstream
{% endif %}

10
11
12
13
14
15
16
17
18
19
20
pip-setuptools:
  pkg.latest:
    - pkgs:
    {% if grains['os_family'] == 'Debian' %}
      - python-pip
    {% else %}{# RedHat #}
      - python2-pip
    {% endif %}
  pip.installed:
    - name: setuptools
    - ignore_installed: true
21

Philippe Pepiot's avatar
Philippe Pepiot committed
22
cube-packages:
23
  pkg.latest:
Philippe Pepiot's avatar
Philippe Pepiot committed
24
25
    - pkgs:
    {% if grains['os_family'] == 'Debian' %}
26
      - postgresql-client
27
      - graphviz
28
29
      - python-all-dev
      - libgecode-dev
30
      - g++
Philippe Pepiot's avatar
Philippe Pepiot committed
31
    {% else %}{# RedHat #}
32
      - postgresql94
33
      - graphviz-gd
34
35
      - python-devel
      - gecode-devel
36
      - gcc-c++
Philippe Pepiot's avatar
Philippe Pepiot committed
37
    {% endif %}
38
      - gettext
39
      - python-virtualenv
40
41
      - python-lxml
      - python-psycopg2
42
    - require:
43
      - pip: pip-setuptools
44

45
46
47
48
create-saemref-user:
  user.present:
    - name: {{ saemref.instance.user }}

Sylvain Thenault's avatar
Sylvain Thenault committed
49
50
51
52
53
54
55
56
57
58
59
60
61
62
legacy cleanup:
  pkg.removed:
    - pkgs:
      - cubicweb-saem-ref
      - cubicweb
      - python-logilab-common
      - python-logilab-mtconverter
      - python-rql
      - python-yams
      - python-logilab-database
      - python-passlib
      - python-twisted-web
      - python-markdown
      - pytz
63
64
      - uwsgi
      - uwsgi-plugin-python
Sylvain Thenault's avatar
Sylvain Thenault committed
65

66
67
68
69
70
71
{% if pillar.get('upgrade', False) %}
drop old virtualenv:
  file.absent:
    - name: /home/{{ saemref.instance.user }}/venv
{% endif %}

72
73
74
75
76
venv:
  virtualenv.managed:
    - name: /home/{{ saemref.instance.user }}/venv
    - system_site_packages: true
    - user: {{ saemref.instance.user }}
Sylvain Thenault's avatar
Sylvain Thenault committed
77
78
    - require:
      - pkg: legacy cleanup
79
80
81
      {% if pillar.get('upgrade', False) %}
      - file: drop old virtualenv
      {% endif %}
82
83
84
85
86
87
88
89
90

cubicweb in venv:
  pip.installed:
    - name: cubicweb
    - bin_env: /home/{{ saemref.instance.user }}/venv
    - user: {{ saemref.instance.user }}
    - require:
      - virtualenv: venv

91
92
93
94
95
96
97
98
99
100
cubicweb-saem_ref:
  pip.installed:
    - name: cubicweb-saem_ref
    - user: {{ saemref.instance.user }}
    - bin_env: /home/{{ saemref.instance.user }}/venv
    - require:
      - pip: cubicweb in venv
      - user: {{ saemref.instance.user }}
      - virtualenv: venv

101
102
103
104
105
106
107
{% if saemref.install.dev %}

dev dependencies:
  pkg.installed:
    - pkgs:
      - mercurial

108
109
110
111
112
113
114
cubicweb-saem_ref from hg:
  pip.installed:
    - name: hg+http://hg.logilab.org/review/cubes/saem_ref#egg=cubicweb-saem_ref
    - user: {{ saemref.instance.user }}
    - bin_env: /home/{{ saemref.instance.user }}/venv
    - require:
      - pkg: dev dependencies
115
116
117
118
      - pip: cubicweb in venv
      - user: {{ saemref.instance.user }}
      - virtualenv: venv

119
120
{% endif %}

121
122
123
124
125
126
127
128
129
130
{% if saemref.instance.test_mode -%}
{% for fname in ['languages.csv', 'mime_types.csv'] %}
{{ ['/home', saemref.instance.user, 'venv', 'share', 'cubicweb', 'cubes', 'seda', 'migration', 'data', fname]|join('/') }}:
  file.managed:
    - source: salt://saemref/files/test/{{ fname }}
    - user: {{ saemref.instance.user }}
    - show_changes: false
{% endfor %}
{%- endif %}

131
132
cubicweb-create:
  cmd.run:
133
    - name: /home/{{ saemref.instance.user }}/venv/bin/cubicweb-ctl create --no-db-create -a saem_ref {{ saemref.instance.name }}
134
135
136
137
138
    - creates: /home/{{ saemref.instance.user }}/etc/cubicweb.d/{{ saemref.instance.name }}
    - user: {{ saemref.instance.user }}
    - env:
        CW_MODE: user
    - require:
Philippe Pepiot's avatar
Philippe Pepiot committed
139
        - pkg: cube-packages
140
        - user: {{ saemref.instance.user }}
Philippe Pepiot's avatar
Philippe Pepiot committed
141
142
143

{% if saemref.instance.wsgi %}

144
145
gunicorn in venv:
  pip.installed:
Philippe Pepiot's avatar
Philippe Pepiot committed
146
    - pkgs:
147
148
149
150
      - gunicorn
      - futures
    - bin_env: /home/{{ saemref.instance.user }}/venv
    - user: {{ saemref.instance.user }}
Philippe Pepiot's avatar
Philippe Pepiot committed
151
    - require:
152
      - virtualenv: venv
Philippe Pepiot's avatar
Philippe Pepiot committed
153

154
155
156
157
158
{% if grains['os_family'] == 'RedHat' %}
crontabs installed:
  pkg.installed:
    - name: crontabs
{% endif %}
Philippe Pepiot's avatar
Philippe Pepiot committed
159
{% endif %}