mediawiki.yml 5.48 KB
Newer Older
rgaudin's avatar
rgaudin committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
---
- import_tasks: clean_apt.yml
  tags: setup

- name: Get nodejs repository installer
  get_url:
    url: https://deb.nodesource.com/setup_10.x
    dest: /tmp/setup_10.x
    mode: 0755
  tags: setup

- name: Run nodejs repository installer
  command: /tmp/setup_10.x
  tags: setup

- name: Install nodejs
  environment:
    RUNLEVEL: 1
  apt:
    name: nodejs
    state: latest
    autoremove: yes
    autoclean: yes
  tags: setup

- name: Install dependencies (tex, for MathRenderer)
  apt:
28
    name: texlive,texlive-fonts-recommended,texlive-lang-greek,texlive-latex-recommended,texlive-latex-extra,build-essential,dvipng,ocaml,cjk-latex
rgaudin's avatar
rgaudin committed
29
30
31
32
33
34
35
36
37
38
39
40
    state: latest
    autoremove: yes
    autoclean: yes
  tags: setup

- import_tasks: clean_apt.yml
  tags: setup

- name: Install dependencies (PHP)
  environment:
    RUNLEVEL: 1
  apt:
rgaudin's avatar
rgaudin committed
41
    name: php{{ php_version }}-fpm,php{{ php_version }}-sqlite3,php{{ php_version }}-intl,php{{ php_version }}-mbstring,php{{ php_version }}-xml,php{{ php_version }}-curl
rgaudin's avatar
rgaudin committed
42
43
44
45
46
    state: latest
    autoremove: yes
    autoclean: yes
  tags: setup

rgaudin's avatar
rgaudin committed
47
- include_tasks: disable_service.yml service=php{{ php_version }}-fpm
rgaudin's avatar
rgaudin committed
48
49
50
51
52
  tags: setup

- name: change PHP7 settings to allow file uploads up to 5MiB
  copy:
    src: 90-wikifundi.ini
rgaudin's avatar
rgaudin committed
53
    dest: /etc/php/{{ php_version }}/fpm/conf.d/90-wikifundi.ini
rgaudin's avatar
rgaudin committed
54
55
56
57
58
59
60
61
62
  tags: setup

- import_tasks: clean_apt.yml
  tags: setup

- name: Install dependencies (others)
  environment:
    RUNLEVEL: 1
  apt:
rgaudin's avatar
rgaudin committed
63
    name: git,vim,unzip,imagemagick,libicu-dev,ffmpeg,librsvg2-bin,poppler-utils,memcached,redis-server,lua5.1,python3,locales
rgaudin's avatar
rgaudin committed
64
65
66
67
68
69
70
71
    state: latest
    autoremove: yes
    autoclean: yes
  tags: setup

- include_tasks: disable_service.yml service=memcached
  tags: setup

72
73
74
- include_tasks: disable_service.yml service=redis-server
  tags: setup

rgaudin's avatar
rgaudin committed
75
76
77
78
79
- import_tasks: clean_apt.yml
  tags: setup

# locale en_US.UTF-8 already installed on system role

80
81
82
83
- name: hack to avoid thumbs generation error for PDF with errors
  shell: mv /usr/bin/gs /usr/bin/gs9-20 ; echo '/usr/bin/gs9-20 -sstdout=%stderr $@' > /usr/bin/gs ; chmod a+x /usr/bin/gs
  tags: setup

rgaudin's avatar
rgaudin committed
84
85
86
87
88
89
90
- name: make sure directories exists
  file:
    dest: "{{ item }}"
    state: directory
  with_items:
    - "{{ wikifundi_root }}"
    - "{{ mediawiki_root }}"
91
    - "{{ parsoid_root }}"
rgaudin's avatar
rgaudin committed
92
93
94
95
  tags: setup

- name: download mediawiki
  get_url:
96
    url: "{{ mirror }}/dev/mediawiki-1.31.0-rc.0__with-extensions.tar.gz"
rgaudin's avatar
rgaudin committed
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
    dest: /tmp/mediawiki.tar.gz
  tags: setup

- name: extract mediawiki
  command: tar -C {{ mediawiki_root }} -xz --strip-components=1 -f /tmp/mediawiki.tar.gz
  tags: setup

- name: change ownership of folders
  file:
    path: "{{ mediawiki_root }}/{{ item }}"
    owner: www-data
    group: www-data
    state: directory
    recurse: yes
  with_items:
    - skins
    - cache
  tags: setup

- name: download parsoid
117
118
  unarchive:
    remote_src: yes
119
    src: "{{ mirror }}/dev/parsoid_0.9.0.tar.gz"
120
    dest: "{{ parsoid_root }}"
rgaudin's avatar
rgaudin committed
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
  tags: setup

- name: downgrade npm first
  command: npm install -g npm@4
  tags: setup

- name: install node dependencies for parsoid
  command: npm install
  args:
    chdir: "{{ parsoid_root }}"
  ignore_errors: yes
  tags: setup

- name: clean npm cache
  command: npm cache clean -f
  args:
    chdir: "{{ mediawiki_root }}"
  tags: setup

- name: install n for parsoid
  command: npm install -g n
  args:
    chdir: "{{ mediawiki_root }}"
  tags: setup

- name: upgrade npm back
  command: npm install -g npm
  tags: setup

- name: updating node to lastest stable
  command: n stable
  args:
    chdir: "{{ mediawiki_root }}"
  tags: setup

- name: download composer
  get_url:
158
    url: "{{ mirror }}/dev/composer_1.6.5.phar"
rgaudin's avatar
rgaudin committed
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
    dest: "{{ mediawiki_root }}/composer.phar"
  tags: setup

- name: copy our composer config
  copy:
    src: composer.json
    dest: "{{ mediawiki_root }}/composer.json"
  tags: setup

- name: install composer
  command: php composer.phar update --no-dev
  args:
    chdir: "{{ mediawiki_root }}"
  tags: setup

- name: clean Math extensions
  command: make -C extensions/Math/{{ item }} clean all
  args:
    chdir: "{{ mediawiki_root }}"
  with_items:
    - math
    - texvccheck
  tags: setup

183
184
185
186
187
188
189
190
191
192
193
194
- name: fix math extension paths
  replace:
    name: "{{ mediawiki_root }}/extensions/Math/math/render.ml"
    regexp: '"{{ item }} '
    replace: '"/usr/bin/{{ item }} '
  with_items:
    - latex
    - dvips
    - convert
    - dvipng
  tags: setup

rgaudin's avatar
rgaudin committed
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
- name: fix permission on folder
  file:
    path: "{{ mediawiki_root }}/extensions"
    owner: www-data
    group: www-data
    state: directory
    recurse: yes
  tags: setup

- name: Copy image assets
  copy:
    src: "{{ item }}"
    dest: "{{ wikifundi_root }}/{{ item }}"
  with_items:
    - cc-by-sa.png
210
    - A_WikiAfrica_project.png
rgaudin's avatar
rgaudin committed
211
212
213
214
215
216
    - favicon.ico
    - logo.png
    - logo-sq.png
  tags: setup

- name: copy php conf for nginx
rgaudin's avatar
rgaudin committed
217
218
  template:
    src: php.conf.j2
rgaudin's avatar
rgaudin committed
219
220
221
222
223
224
225
226
227
228
    dest: /etc/nginx/conf.d/php.conf
  tags: setup

# Configuration files
- name: set mediawiki main config file
  copy:
    src: LocalSettings.php
    dest: "{{ mediawiki_root }}/LocalSettings.php"
  tags: setup

229
230
231
232
233
234
235
236
237
- name: copy blank debug and mirroring config files
  copy:
    src: empty.php
    dest: "{{ mediawiki_root }}/LocalSettings.{{ item }}.php"
  with_items:
    - debug
    - mirroring
  tags: setup

rgaudin's avatar
rgaudin committed
238
239
240
241
242
243
244
245
246
247
248
249
250
- name: set parsoid config
  template:
    src: config.yaml.j2
    dest: "{{ parsoid_root }}/config.yaml"
  tags: ['setup', 'rename']

- name: Setup parsoid service
  template:
    src: parsoid.service.j2
    dest: /etc/systemd/system/parsoid.service
  notify: reload systemd
  tags: setup