Google openrefine role.

This commit is contained in:
Andrea Dell'Amico 2018-11-08 13:32:59 +01:00
parent 19b8a60071
commit ce0e66391f
5 changed files with 99 additions and 0 deletions

View File

@ -0,0 +1,17 @@
---
openrefine_enabled: True
openrefine_major_version: 3
openrefine_minor_version: 0
openrefine_file_extension: 'tar.gz'
openrefine_distribution_prefix: 'openrefine'
openrefine_dist_file: '{{ openrefine_distribution_prefix }}-linux-{{ openrefine_version }}.{{ openrefine_file_extension }}'
openrefine_version: '{{ openrefine_major_version }}.{{ openrefine_minor_version }}'
openrefine_download_url: 'https://github.com/OpenRefine/OpenRefine/releases/download/{{ openrefine_version }}/{{ openrefine_dist_file }}'
openrefine_user: openrefine
openrefine_user_home: /srv/google-openrefine
openrefine_data_dir: '{{ openrefine_user_home }}/data'
openrefine_log_dir: '{{ openrefine_user_home }}/logs'
openrefine_base_dir: '{{ openrefine_user_home }}/{{ openrefine_distribution_prefix }}-{{ openrefine_version }}'
openrefine_http_port: 3333
openrefine_java_heap: 2048m

View File

@ -0,0 +1,4 @@
---
- name: Restart openrefine
service: name=openrefine state=restarted

View File

@ -0,0 +1,40 @@
---
- block:
- name: Create the openrefine user
user: name={{ openrefine_user }} home={{ openrefine_user_home }} createhome=no shell=/usr/sbin/nologin system=yes
- name: Create the openrefine home, if it does not already exist.
file: dest={{ openrefine_user_home }} owner=root group=root state=directory recurse=yes
- name: Create the openrefine data and logs directories
file: dest={{ item }} owner={{ openrefine_user }} group={{ openrefine_user }} state=directory recurse=yes
with_items:
- '{{ openrefine_data_dir }}'
- '{{ openrefine_log_dir }}'
- name: Download openrefine
unarchive: remote_src=yes src={{ openrefine_download_url }} dest={{ openrefine_user_home }}
args:
creates: '{{ openrefine_user_home }}/{{ openrefine_distribution_prefix }}-{{ openrefine_version }}'
- name: Install the openrefine configuration
template: src=refine.ini dest={{ openrefine_user_home }}/{{ openrefine_distribution_prefix }}-{{ openrefine_version }}/refine.ini owner=root group=root mode=0644
notify: Restart openrefine
- name: Install the openrefine upstart init script
template: src=openrefine.conf.j2 dest=/etc/init/openrefine.conf owner=root group=root mode=0644
when: ansible_service_mgr != 'systemd'
- name: Ensure that the service is running and enabled
service: name=openrefine state=started enabled=yes
when: openrefine_enabled
tags: [ 'openrefine', 'google_openrefine' ]
- block:
- name: Ensure that the service is running and enabled
service: name=openrefine state=stopped enabled=no
when: not openrefine_enabled
tags: [ 'openrefine', 'google_openrefine' ]

View File

@ -0,0 +1,13 @@
description "Google OpenRefine server"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [016]
respawn
respawn limit 10 5
setuid {{ openrefine_user }}
setgid {{ openrefine_user }}
script
chdir {{ openrefine_base_dir }}
exec ./refine > {{ openrefine_log_dir }}/openrefine.log 2>&1
end script

View File

@ -0,0 +1,25 @@
# NOTE: This file is not read if you run the Refine executable directly
# It is only read of you use the refine shell script or refine.bat
no_proxy="localhost,127.0.0.1"
REFINE_PORT={{ openrefine_http_port }}
#REFINE_HOST=127.0.0.1
#REFINE_WEBAPP=main\webapp
# Memory and max form size allocations
#REFINE_MAX_FORM_CONTENT_SIZE=1048576
REFINE_MEMORY=1400M
# Set initial java heap space (default: 256M) for better performance with large datasets
REFINE_MIN_MEMORY=1400M
# Some sample configurations. These have no defaults.
#ANT_HOME=C:\grefine\tools\apache-ant-1.8.1
#JAVA_HOME=C:\Program Files\Java\jdk1.8.0_151
#JAVA_OPTIONS=-XX:+UseParallelGC -verbose:gc -Drefine.headless=true
#JAVA_OPTIONS=-Drefine.data_dir=C:\Users\user\AppData\Roaming\OpenRefine
JAVA_HOME={{ jdk_java_home }}
JAVA_OPTIONS="-server -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Xms{{ openrefine_java_heap }} -Xmx{{ openrefine_java_heap }} -Drefine.data_dir={{ openrefine_data_dir }}"
# Uncomment to increase autosave period to 60 mins (default: 5 minutes) for better performance of long-lasting transformations
#REFINE_AUTOSAVE_PERIOD=60