-
Notifications
You must be signed in to change notification settings - Fork 1
/
stage.yaml
163 lines (150 loc) · 5.33 KB
/
stage.yaml
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
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
158
159
160
161
162
- hosts: all
vars_files:
- vars.yaml
- docker-vars.yaml
- s3-vars.yaml
- ssl-vars.yaml
- qos-vars.yaml
tasks:
- name: Create stage directories
file:
path: '{{ stage_dir }}/{{ item }}'
state: directory
with_items:
- conf
- barista
- httpd-confs
- credentials
- name: Check if repo is staged
stat:
path: '{{ stage_dir }}/{{ item.key }}'
get_checksum: False
get_md5: False
register: staged_repos_results
loop: '{{ staged_repos|dict2items }}'
- name: Clone repos that are not staged
git:
repo: 'https://github.com/geneontology/{{ item.item.key }}.git'
dest: '{{ stage_dir }}/{{ item.item.key }}'
version: '{{ item.item.value }}'
loop: '{{ staged_repos_results.results }}'
when: not item.stat.exists
- name: Handle production mode ...
block:
- name: install production config from templates directory
template:
src: '{{ item.file }}'
dest: '{{ stage_dir }}/{{ item.dir }}'
with_items:
- { file: 'docker-compose-production.yaml', dir: 'docker-compose.yaml' }
- { file: 'httpd-vhosts-prod-barista.conf', dir: 'httpd-confs' }
- { file: 'httpd-vhosts-prod-noctua.conf', dir: 'httpd-confs' }
- { file: 'github.yaml', dir: 'barista' }
- { file: 'startup.yaml', dir: 'conf' }
- name: install ssl configs from templates directory
template:
src: '{{ item.file }}'
dest: '{{ stage_dir }}/{{ item.dir }}'
with_items:
- { file: 'httpd-vhosts-prod-barista-ssl.conf', dir: 'httpd-confs' }
- { file: 'httpd-vhosts-prod-noctua-ssl.conf', dir: 'httpd-confs' }
when: USE_SSL | bool
- name: install qos config from templates directory
template:
src: qos.conf
dest: '{{ stage_dir }}/qos.conf'
when: USE_QOS | bool
- name: copy s3cfg
copy:
src: "{{ S3_CRED_FILE }}"
dest: "{{ stage_dir }}/credentials/s3cfg"
- name: copy noop qos.conf
copy:
src: "files/qos-noop.conf"
dest: '{{ stage_dir }}/qos.conf'
when: not USE_QOS | bool
- name: copy robots.txt
copy:
src: "files/robots.txt"
dest: "{{ stage_dir }}/robots.txt"
- name: Check if journal exists
stat:
path: '{{ stage_dir }}/blazegraph.jnl'
get_checksum: False
get_md5: False
register: journal_result
- name: copy blazegraph.jnl
copy:
src: "{{ BLAZEGRAPH_JOURNAL }}"
dest: "{{ stage_dir }}/blazegraph.jnl"
when: not journal_result.stat.exists
when: PROD_MODE | bool
- name: Handle non production mode ...
block:
- name: Create solr index stage directory
file:
path: '{{ stage_dir }}/srv-solr-data'
state: directory
- name: install amigo/golr/barista config from templates directory
template:
src: '{{ item.file }}'
dest: '{{ stage_dir }}/{{ item.dir }}'
with_items:
- { file: 'docker-compose-amigo.yaml', dir: '' }
- { file: 'docker-compose-golr.yaml', dir: '' }
- { file: 'local.yaml', dir: 'barista' }
- { file: 'httpd-vhosts-amigo.conf', dir: 'httpd-confs' }
- { file: 'httpd-vhosts-golr.conf', dir: 'httpd-confs' }
- { file: 'httpd-vhosts-barista.conf', dir: 'httpd-confs' }
- { file: 'httpd-vhosts-noctua.conf', dir: 'httpd-confs' }
- { file: 'startup.yaml', dir: 'conf' }
- name: Check if index exists
stat:
path: '{{ stage_dir }}/srv-solr-data/index'
get_checksum: False
get_md5: False
register: index_result
- name: Create Solr Index
shell: |
docker run --rm \
-e GOLR_SOLR_MEMORY=4G \
-e GOLR_LOADER_MEMORY=8G \
-e GOLR_INPUT_ONTOLOGIES=http://purl.obolibrary.org/obo/ncbitaxon/subsets/taxslim.owl \
-v '{{ stage_dir }}/srv-solr-data:/srv/solr/data' \
-t geneontology/golr-autoindex-ontology
args:
executable: /bin/bash
when: not index_result.stat.exists
rescue:
- name: Remove index directory
file:
path: '{{ stage_dir }}/srv-solr-data/index'
state: absent
- name: Failed to create index
command: /bin/false
when: not PROD_MODE | bool
- name: Create journal non production mode
block:
- name: Check if journal exists
stat:
path: '{{ stage_dir }}/blazegraph.jnl'
get_checksum: False
get_md5: False
register: journal_result
- name: Create journal blazegraph.jnl
shell: |
export CMD="java -Xmx4G -jar minerva-cli.jar --import-owl-models -j /sdir/blazegraph.jnl -f /sdir/noctua-models/models"
docker run --rm \
-v '{{ stage_dir }}:/sdir' \
-t '{{ docker_hub_user }}/minerva:{{ tag }}' $CMD
args:
executable: /bin/bash
when: not journal_result.stat.exists
rescue:
- name: Remove journal
file:
path: '{{ stage_dir }}/blazegraph.jnl'
state: absent
- name: Failed to create blazegraph journal
command: /bin/false
when: not PROD_MODE | bool