Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

Adds microservice to connect Islandora to FITS webservice #3

Merged
merged 32 commits into from
Jan 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
---

fits_download_dir: /usr/local/src
fits_version: 1.1.1
fits_ws_version: 1.1.3
fits_version: 1.4.1
fits_ws_version: 1.2.0
fits_install_root: /opt
fits_install_symlink: /opt/fits
fits_user: tomcat8
fits_group: tomcat8
fits_ws: yes
crayfits_home: /var/www/html
fits_src_url: "https://github.com/harvard-lts/fits/releases/download/{{ fits_version }}/fits-{{ fits_version }}.zip"
fits_zip_md5sum: "md5: 670dd59b1369548cd478ce5acb5d7579"
fits_ws_md5sum: "md5: 1d5cc215e0e8f4809cfb2d41a63ba4b8"
webserver_app_user: "{% if ansible_os_family == 'RedHat' %}apache{% else %}www-data{% endif %}"
vagrant_user: "{% if ansible_os_family == 'RedHat' %}vagrant{% else %}ubuntu{% endif %}"
81 changes: 81 additions & 0 deletions tasks/build-fits-site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
- name: Build site for FITS microservice
blockinfile:
path: "{{ httpd_conf_directory }}/conf-available/CrayFits.conf"
create: yes
block: |
Alias "/crayfits" "{{ crayfits_home }}/CrayFits/public"
<Directory "{{ crayfits_home }}/CrayFits/public">
FallbackResource /crayfits/index.php
Require all granted
DirectoryIndex index.php
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
</Directory>

- name: Enable FITS site
file:
src: "{{ httpd_conf_directory }}/conf-available/CrayFits.conf"
dest: "{{ httpd_conf_directory_enabled}}/CrayFits.conf"
state: link

- name: Change owner on html dir
file:
path: "{{ crayfits_home }}"
owner: "{{ webserver_app_user }}"
group: "{{ webserver_app_user }}"

- name: Install FITS Microservice from Github
git:
repo: https://github.com/roblib/CrayFits.git
dest: "{{ crayfits_home }}/CrayFits"
force: yes

- name: Clean Directory (Failure okay)
file:
path: "{{ crayfits_home }}/CrayFits/vendor/symfony/monolog-bundle"
with_items:
- absent
- directory
ignore_errors: yes

- name: Change CrayFits directory ownership, group and permissions
file:
path: "{{ crayfits_home }}/CrayFits"
owner: "{{ webserver_app_user }}"
group: "{{ webserver_app_user }}"
mode: '0755'
recurse: True

- name: Open file for logging
file:
path: "{{ crayfits_home }}/CrayFits/var"
owner: "{{ webserver_app_user }}"
group: "{{ webserver_app_user }}"
mode: '0777'
recurse: True

- name: restart apache
service:
name: "{{ apache_service }}"
state: restarted

- name: Check for Existing microservice
stat:
path: "{{ crayfits_home }}/CrayFits/vendor"
register: crayfits

- name: Run Composer On Fits Microservice
composer:
command: update
working_dir: "{{ crayfits_home }}/CrayFits"
ignore_errors: yes
when: crayfits.stat.exists == False
become: true

- name: Download Islandora FITS
composer:
command: require
arguments: islandora-rdm/islandora_fits
working_dir: "{{ drupal_core_path }}/.."

- name: Enable Islansdora FITS
command: "{{ drush_path }} --root {{ drupal_core_path }} -y en islandora_fits"
6 changes: 5 additions & 1 deletion tasks/install-ws.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
---

- name: Install FITS web service
- name: "Install FITS web service {{ansible_os_family}}"
get_url:
url: http://projects.iq.harvard.edu/files/fits/files/fits-{{ fits_ws_version }}.war
dest: "{{ tomcat8_home }}/webapps/fits.war"
owner: "{{ fits_user }}"
group: "{{ fits_group }}"
checksum: "{{fits_ws_md5sum}}"
retries: 5
register: result
until: result is succeeded
29 changes: 22 additions & 7 deletions tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
---

- name: Install FITS
- name: create Fits destination dir
file:
path: "{{ fits_install_root }}/fits-{{ fits_version }}"
state: directory
owner: tomcat8
group: tomcat8
mode: 0700

- name: Downloading FITS executables
get_url:
url: "{{ fits_src_url }}"
dest: "{{ fits_install_root }}/fits-{{ fits_version }}"
mode: 0755
checksum: "{{ fits_zip_md5sum }}"
retries: 5
register: result
until: result is succeeded

- name: Unzip FITS
unarchive:
remote_src: yes
src: https://projects.iq.harvard.edu/files/fits/files/fits-{{ fits_version }}.zip
dest: "{{ fits_install_root }}"
owner: "{{ fits_user }}"
group: "{{ fits_group }}"
creates: "{{ fits_install_root }}/fits-{{ fits_version }}"
src: "{{ fits_install_root }}/fits-{{ fits_version }}/fits-{{ fits_version }}.zip"
dest: "{{ fits_install_root }}/fits-{{ fits_version }}"
remote_src: True

- name: Move FITS into place
file:
Expand Down
6 changes: 6 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@
- fits-ws
- fits-ws-config
when: fits_ws

- include: build-fits-site.yml
tags:
- fits
- fits-install

5 changes: 5 additions & 0 deletions vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---

httpd_conf_directory_enabled: "{{httpd_conf_directory}}/conf-enabled"
apache_service: apache2
apache_restart_state
5 changes: 5 additions & 0 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---

httpd_conf_directory_enabled: "{{httpd_conf_directory}}/conf.d"
apache_service: httpd
vagrant_ssh_user: apache