diff --git a/stanford-corenlp/defaults/main.yml b/stanford-corenlp/defaults/main.yml new file mode 100644 index 00000000..14d6ef44 --- /dev/null +++ b/stanford-corenlp/defaults/main.yml @@ -0,0 +1,23 @@ +--- +# https://stanfordnlp.github.io/CoreNLP/ +stanford_corenlp_version: latest +stanford_corenlp_name: stanford-corenlp +stanford_corenlp_extension: war +stanford_corenlp_file: '{{ stanford_corenlp_name }}-{{ stanford_corenlp_version }}.{{ stanford_corenlp_extension }}' +stanford_corenlp_group_id: edu.stanford.nlp +stanford_corenlp_languages: + - arabic + - chinese + - english + - english_kbp + - french + - german + - spanish + +stanford_corenlp_user: corenlp +stanford_corenlp_base_dir: /opt/corenlp +stanford_corenlp_dist_dir: '{{ stanford_corenlp_base_dir }}/stanford-corenlp' +stanford_corenlp_log_dir: '{{ stanford_corenlp_base_dir }}/logs' +stanford_corenlp_cmd: 'java -cp "*" -mx4g edu.stanford.nlp.pipeline.StanfordCoreNLPServer -props StanfordCoreNLP-english.properties -port 9000 -timeout 60000' + +tint_service_cmd: './tint-server.sh -p 9001' diff --git a/stanford-corenlp/tasks/main.yml b/stanford-corenlp/tasks/main.yml new file mode 100644 index 00000000..08b592b6 --- /dev/null +++ b/stanford-corenlp/tasks/main.yml @@ -0,0 +1,18 @@ +--- +- block: + - name: Create the CoreNLP logs directory + file: dest={{ stanford_corenlp_log_dir }} state=directory owner={{ stanford_corenlp_user }} + + - name: Install the CoreNLP startup script + template: src=stanford-corenlp.upstart.j2 dest=/etc/init/stanford-corenlp.conf owner=root group=root mode=0644 + + - name: Ensure that CoreNLP is enabled and running + service: name=stanford-corenlp state=started enabled=yes + + - name: Install the tint service startup script + template: src=tint.upstart.j2 dest=/etc/init/tint.conf owner=root group=root mode=0644 + + - name: Ensure that the tint service is enabled and running + service: name=tint state=started enabled=yes + + tags: [ 'corenlp', 'stanford_corenlp' ] diff --git a/stanford-corenlp/templates/stanford-corenlp.upstart.j2 b/stanford-corenlp/templates/stanford-corenlp.upstart.j2 new file mode 100644 index 00000000..f2f34aac --- /dev/null +++ b/stanford-corenlp/templates/stanford-corenlp.upstart.j2 @@ -0,0 +1,12 @@ +description "Stanford CoreNLP" +start on (local-filesystems and net-device-up IFACE!=lo) +stop on runlevel [016] + +respawn +respawn limit 10 5 +setuid {{ stanford_corenlp_user }} +setgid {{ stanford_corenlp_user }} + +script + exec cd {{ stanford_corenlp_dist_dir }} {{ stanford_corenlp_cmd }} > {{ stanford_corenlp_log_dir }}/corenlp.log 2>&1 +end script diff --git a/stanford-corenlp/templates/tint.upstart.j2 b/stanford-corenlp/templates/tint.upstart.j2 new file mode 100644 index 00000000..48798252 --- /dev/null +++ b/stanford-corenlp/templates/tint.upstart.j2 @@ -0,0 +1,12 @@ +description "TINT service" +start on (local-filesystems and net-device-up IFACE!=lo) +stop on runlevel [016] + +respawn +respawn limit 10 5 +setuid {{ stanford_corenlp_user }} +setgid {{ stanford_corenlp_user }} + +script + exec cd {{ stanford_corenlp_dist_dir }}/tint {{ tint_service_cmd }} > {{ stanford_corenlp_log_dir }}/tint.log 2>&1 +end script