Skip to content

Commit

Permalink
Issue-268: Changes needed to allow RHEL based builds via Islandora-pl…
Browse files Browse the repository at this point in the history
…aybook #268 (#273)
  • Loading branch information
bdgregg authored Jan 19, 2024
1 parent eaf133e commit d4002ac
Show file tree
Hide file tree
Showing 44 changed files with 435 additions and 59 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ roles/external
.project
.github
islandora_base
!inventory/vagrant
inventory/*
3 changes: 3 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ deprecation_warnings = False

[ssh_connection]
pipelining = True

[colors]
verbose = bright blue
4 changes: 3 additions & 1 deletion bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@

# Change Selinux to permissive
- name: change selinux enforcement to permissive
command: setenforce permissive
selinux:
policy: targeted
state: permissive
when: "ansible_os_family == 'RedHat' and disable_selinux and selinux_permissive == 'enforcing' and islandora_build_base_box|bool == True"

# Check if we may be re-running
Expand Down
18 changes: 9 additions & 9 deletions crayfish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
become: yes

roles:
- name: geerlingguy.repo-remi
when: "ansible_os_family == 'RedHat' and islandora_build_box|bool == True"
- name: geerlingguy.apache # Include apache to get the handlers
- name: geerlingguy.php-versions
- role: geerlingguy.repo-remi
when: "ansible_os_family == 'RedHat' and islandora_build_base_box|bool == True"
- role: geerlingguy.apache # Include apache to get the handlers
- role: geerlingguy.php-versions
when: islandora_build_base_box|bool == True
- name: geerlingguy.php
- role: geerlingguy.php
when: islandora_build_base_box|bool == True
- name: geerlingguy.php-mysql
- role: geerlingguy.php-mysql
when: islandora_build_base_box|bool == True
- name: geerlingguy.git
- role: geerlingguy.git
when: islandora_build_base_box|bool == True
- name: geerlingguy.composer
- role: geerlingguy.composer
when: islandora_build_base_box|bool == True

- name: Islandora-Devops.crayfish
- role: Islandora-Devops.crayfish
when: islandora_build_base_box|bool == False
2 changes: 2 additions & 0 deletions post-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
regexp: 'var/cache/cantaloupe/$'
line: 'ReadWritePaths=/var/cache/cantaloupe/'
insertafter: EOF
when: "ansible_os_family == 'Debian'"

- name: Add Cantaloupe log to Tomcat writable paths
lineinfile:
path: "/etc/systemd/system/tomcat9.service.d/override.conf"
regexp: 'var/log/cantaloupe/$'
line: 'ReadWritePaths=/var/log/cantaloupe'
insertafter: EOF
when: "ansible_os_family == 'Debian'"

- name: restart daemon service
ansible.builtin.systemd:
Expand Down
6 changes: 3 additions & 3 deletions requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
version: 1.2.4

- src: geerlingguy.repo-remi
version: 1.2.0
version: 2.0.1

- src: geerlingguy.apache
version: 3.3.0

- src: geerlingguy.php-versions
version: 5.0.0
version: 5.0.1

- src: geerlingguy.php
version: 4.8.0
Expand All @@ -29,7 +29,7 @@
version: 1.4.3

- src: geerlingguy.solr
version: 5.4.1
version: 5.5.0

- src: geerlingguy.java
version: 2.2.0
Expand Down
31 changes: 23 additions & 8 deletions roles/internal/Islandora-Devops.activemq/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
---

- name: Download and unarchive
- name: Download ActiveMQ
get_url:
url: http://archive.apache.org/dist/activemq/{{ activemq_version }}/apache-activemq-{{ activemq_version }}-bin.tar.gz
dest: "{{ activemq_install_root }}"
owner: "{{ activemq_user }}"
timeout: 300

- name: Expand ActiveMQ
unarchive:
remote_src: yes
src: http://archive.apache.org/dist/activemq/{{ activemq_version }}/apache-activemq-{{ activemq_version }}-bin.tar.gz
src: "{{ activemq_install_root }}/apache-activemq-{{ activemq_version }}-bin.tar.gz"
dest: "{{ activemq_install_root }}"
copy: false
owner: "{{ activemq_user }}"
creates: "{{ activemq_install_root }}/activemq"
group: "{{ activemq_user }}"

- name: Cleanup ActiveMQ archive file
file:
path: "{{ activemq_install_root }}/apache-activemq-{{ activemq_version }}-bin.tar.gz"
state: absent

- name: Move activemq
command: mv "{{ activemq_install_root }}/apache-activemq-{{ activemq_version }}" "{{ activemq_install_root }}/activemq"
args:
creates: "{{ activemq_install_root }}/activemq"
- name: Make ActiveMQ symlink
file:
src: "{{ activemq_install_root }}/apache-activemq-{{ activemq_version }}"
dest: "{{ activemq_install_root }}/activemq"
owner: "{{ activemq_user }}"
group: "{{ activemq_user }}"
state: link

# Transitional removal of old-style init.d symlink
# This task can be removed in the future.
Expand Down
27 changes: 17 additions & 10 deletions roles/internal/Islandora-Devops.alpaca/templates/startup.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
#!/bin/sh
#!/bin/bash

if [ -z "$JAVA_HOME" ]; then
if [ -d "/usr/lib/jvm/java-11-openjdk-amd64" ]; then
# Make a guess because this is only for Ubuntu
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
else
echo "Cannot locate JAVA, please define JAVA_HOME."
exit 1
fi
if [ "$(grep -Ei 'debian|buntu|mint' /etc/*release)" ]; then
if [ -d "/usr/lib/jvm/java-11-openjdk-amd64" ]; then
# Make a guess for Debian based systems.
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
fi
elif [ "$(grep -Ei 'fedora|redhat' /etc/*release)" ]; then
if [ -d "/usr/lib/jvm/jre" ] || [ -f "/usr/lib/jvm/jre" ] || [ -L "/usr/lib/jvm/jre" ]; then
# Make a guess for RHEL based systems.
export JAVA_HOME=/usr/lib/jvm/jre
fi
else
echo "Cannot locate JAVA, please define JAVA_HOME."
fi
fi

# Source the config file.
. ${ALPACA_HOME}/${ALPACA_CONFIG}
source ${ALPACA_HOME}/${ALPACA_CONFIG}

${JAVA_HOME}/bin/java -Dislandora.alpaca.log=${ALPACA_LOG_LEVEL} -Xmx${ALPACA_HEAP} -jar ${ALPACA_JAR} -c ${ALPACA_PROPERTIES} > ${ALPACA_LOG_DIR}/alpaca.log &
${JAVA_HOME}/bin/java -Dislandora.alpaca.log=${ALPACA_LOG_LEVEL} -Xmx${ALPACA_HEAP} -jar ${ALPACA_JAR} -c ${ALPACA_PROPERTIES} > ${ALPACA_LOG_DIR}/alpaca.log &
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ blazegraph_user: tomcat
blazegraph_home_dir: /opt/blazegraph
blazegraph_war_path: "{{ tomcat9_home }}/webapps/bigdata.war"
blazegraph_log4j_template: log4j.properties
blazegraph_log_dir: /var/log/tomcat9/blazegraph
#blazegraph_log_dir: /var/log/tomcat9/blazegraph -- Moved to vars to allow OS differences.
blazegraph_log4j_path: "{{ tomcat9_home }}/webapps/bigdata/WEB-INF/classes/log4j.properties"
blazegraph_webxml_path: "{{ tomcat9_home }}/webapps/bigdata/WEB-INF/web.xml"
blazegraph_webxml_template: yes
Expand Down
46 changes: 46 additions & 0 deletions roles/internal/Islandora-Devops.blazegraph/tasks/config-RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---

- name: Copy templated blazegraph config files
template:
src: "{{ item }}"
dest: "{{ blazegraph_home_dir }}/conf/{{ item }}"
owner: "{{ blazegraph_user }}"
group: "{{ blazegraph_user }}"
with_items:
- RWStore.properties
notify: restart tomcat9

- name: Copy blazegraph config files
copy:
src: "{{ item }}"
dest: "{{ blazegraph_home_dir }}/conf/{{ item }}"
owner: "{{ blazegraph_user }}"
group: "{{ blazegraph_user }}"
with_items:
- blazegraph.properties
- inference.nt
notify: restart tomcat9

- name: Drop in templated web.xml file
template:
src: web.xml.j2
dest: "{{ blazegraph_webxml_path }}"
owner: "{{ blazegraph_user }}"
group: "{{ blazegraph_user }}"
notify: restart tomcat9
when: blazegraph_webxml_template

- name: Reload systemd daemon
systemd:
daemon-reload: yes

- name: Stop tomcat9 service
service:
name: tomcat9
state: stopped

- name: Start tomcat9 service
service:
name: tomcat9
state: started

11 changes: 11 additions & 0 deletions roles/internal/Islandora-Devops.blazegraph/tasks/define-home.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---

# Include variables and define needed variables.
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yml"

- name: Define blazegraph_log_dir
set_fact:
blazegraph_log_dir: "{{ __blazegraph_log_dir }}"
when: blazegraph_log_dir is not defined

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---

- name: Create blazegraph home directory
file:
path: "{{ blazegraph_home_dir }}"
state: directory
owner: "{{ blazegraph_user }}"
group: "{{ blazegraph_user }}"

- name: Create blazegraph conf directory
file:
path: "{{ blazegraph_home_dir }}/conf"
state: directory
owner: "{{ blazegraph_user }}"
group: "{{ blazegraph_user }}"

- name: Create blazegraph data directory
file:
path: "{{ blazegraph_home_dir }}/data"
state: directory
owner: "{{ blazegraph_user }}"
group: "{{ blazegraph_user }}"

- name: Create file with sandbox overrides
copy:
dest: "/etc/systemd/system/tomcat9.service.d/override.conf"
content: |
[Service]
ReadWritePaths={{ blazegraph_home_dir }}/data/
mode: '0644'

9 changes: 7 additions & 2 deletions roles/internal/Islandora-Devops.blazegraph/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
---
- include: "define-home.yml"
tags:
- blazegraph
- blazegraph-config
- blazegraph-install

- include: install.yml
- include: "install-{{ ansible_os_family }}.yml"
tags:
- blazegraph
- blazegraph-install
Expand All @@ -15,7 +20,7 @@
- blazegraph
- blazegraph-logging

- include: config.yml
- include: "config-{{ ansible_os_family }}.yml"
tags:
- blazegraph
- blazegraph-config
Expand Down
5 changes: 5 additions & 0 deletions roles/internal/Islandora-Devops.blazegraph/vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#
# Set variables for Debian
#
__blazegraph_log_dir: /var/log/tomcat9/blazegraph

5 changes: 5 additions & 0 deletions roles/internal/Islandora-Devops.blazegraph/vars/RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#
# Set variables for RedHat
#
__blazegraph_log_dir: /opt/tomcat/logs/blazegraph

6 changes: 3 additions & 3 deletions roles/internal/Islandora-Devops.cantaloupe/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cantaloupe_install_root: /opt
# Target of a symlink from the extracted cantaloupe archive
cantaloupe_symlink: /opt/cantaloupe
# Path to cantaloupe logs
cantaloupe_log_path: /var/log/cantaloupe
#cantaloupe_log_path: /var/log/cantaloupe -- Moved to vars to allow OS differences.
# Cantaloupe user
cantaloupe_user: cantaloupe
# Cantaloupe group
Expand Down Expand Up @@ -753,7 +753,7 @@ cantaloupe_log_application_SyslogAppender_facility: LOCAL0

# N.B.: Don't enable FileAppender and RollingFileAppender simultaneously!
cantaloupe_log_error_FileAppender_enabled: "true"
cantaloupe_log_error_FileAppender_pathname: /var/log/cantaloupe/error.log
#cantaloupe_log_error_FileAppender_pathname: /var/log/cantaloupe/error.log -- Moved to vars to allow OS differences.

cantaloupe_log_error_RollingFileAppender_enabled: "false"
cantaloupe_log_error_RollingFileAppender_pathname: /path/to/logs/error.log
Expand All @@ -768,7 +768,7 @@ cantaloupe_log_error_RollingFileAppender_TimeBasedRollingPolicy_max_history: 30
cantaloupe_log_access_ConsoleAppender_enabled: "false"

cantaloupe_log_access_FileAppender_enabled: "true"
cantaloupe_log_access_FileAppender_pathname: /var/log/cantaloupe/access.log
#cantaloupe_log_access_FileAppender_pathname: /var/log/cantaloupe/access.log -- Moved to vars to allow OS differences.

# RollingFileAppender is an alternative to using something like
# FileAppender + logrotate.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---

- name: Install Cantaloupe
unarchive:
remote_src: yes
src: https://github.com/medusa-project/cantaloupe/releases/download/v{{ cantaloupe_version }}/cantaloupe-{{ cantaloupe_version }}.zip
dest: "{{ cantaloupe_install_root }}"
owner: "{{ cantaloupe_user }}"
group: "{{ cantaloupe_group }}"
creates: "{{ cantaloupe_install_root }}/cantaloupe-{{ cantaloupe_version }}"

- name: Create Cantaloupe symlink
file:
state: link
src: "{{ cantaloupe_install_root }}/cantaloupe-{{ cantaloupe_version }}"
dest: "{{ cantaloupe_symlink }}"
owner: "{{ cantaloupe_user }}"
group: "{{ cantaloupe_group }}"

- name: Create Cantaloupe log path
file:
state: directory
path: "{{ cantaloupe_log_path }}"
owner: "{{ cantaloupe_user }}"
group: "{{ cantaloupe_group }}"
8 changes: 7 additions & 1 deletion roles/internal/Islandora-Devops.cantaloupe/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---

- include: install.yml
- include: os-vars.yml
tags:
- cantaloupe
- cantaloupe-config
- cantaloupe-install

- include: "install-{{ ansible_os_family }}.yml"
tags:
- cantaloupe
- cantaloupe-install
Expand Down
22 changes: 22 additions & 0 deletions roles/internal/Islandora-Devops.cantaloupe/tasks/os-vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---

# Include variables and define needed variables.
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yml"

- name: Define cantaloupe_log_path
set_fact:
cantaloupe_log_path: "{{ __cantaloupe_log_path }}"
when: cantaloupe_log_path is not defined

- name: Define cantaloupe_log_error_FileAppender_pathname
set_fact:
cantaloupe_log_error_FileAppender_pathname: "{{ __cantaloupe_log_error_FileAppender_pathname }}"
when: cantaloupe_log_error_FileAppender_pathname is not defined

- name: Define cantaloupe_log_access_FileAppender_pathname
set_fact:
cantaloupe_log_access_FileAppender_pathname: "{{ __cantaloupe_log_access_FileAppender_pathname }}"
when: cantaloupe_log_access_FileAppender_pathname is not defined


Loading

0 comments on commit d4002ac

Please sign in to comment.