Skip to content

Commit

Permalink
Merge pull request #84 from icatproject-contrib/payara6
Browse files Browse the repository at this point in the history
Upgrade to Payara 6 & Allow Installations of Snapshot Versions
  • Loading branch information
ajkyffin authored Sep 8, 2023
2 parents 40a0605 + 04b4d8b commit aeea97b
Show file tree
Hide file tree
Showing 67 changed files with 416 additions and 718 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@ on:
jobs:
run_all_roles:
name: Run all ICAT Ansible roles
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
java_version: [11, 17]

steps:
- name: Checkout ICAT Ansible
uses: actions/checkout@v2

- name: Run apt update
run: sudo apt-get update

- name: Install requirements
run: pip install -r requirements.txt

Expand All @@ -40,5 +47,5 @@ jobs:
- name: Run ICAT Ansible Playbook
run: |
ansible-playbook hosts_all.yml -i hosts --vault-password-file vault_pass.txt -vv
ansible-playbook hosts_all.yml -i hosts --vault-password-file vault_pass.txt -e java_version=${{ matrix.java_version }} -vv
7 changes: 2 additions & 5 deletions group_vars/all/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,8 @@ icat_url: "{{ ansible_fqdn }}"
# IDS server URL
ids_url: "{{ ansible_fqdn }}"

# TopCat server URL
topcat_url: "{{ ansible_fqdn }}"

# TopCat database hostname, database name, username and password
# DataGateway Download API database hostname, database name, username and password
db_topcat_hostname: "localhost"
topcat_database: "{{ vault_topcat_database }}"
db_topcat_username: "{{ vault_db_topcat_username }}"
db_topcat_password: "{{ vault_db_topcat_password }}"
db_topcat_password: "{{ vault_db_topcat_password }}"
2 changes: 1 addition & 1 deletion hosts_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
- role: icat_server
- role: ids_storage_file
- role: ids_server
- role: topcat
- role: datagateway_download_api
- role: dev_common
2 changes: 1 addition & 1 deletion icat_test_hosts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
- role: icat_server
- role: ids_storage_file
- role: ids_server
- role: topcat
- role: datagateway_download_api
2 changes: 1 addition & 1 deletion roles/authn_anon/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
authn_anon_version: "2.0.1"
authn_anon_version: "3.0.0"
17 changes: 11 additions & 6 deletions roles/authn_anon/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
register: packageResult

- name: "Download authn_anon"
get_url:
url: https://repo.icatproject.org/repo/org/icatproject/authn.anon/{{ authn_anon_version }}/authn.anon-{{ authn_anon_version }}-distro.zip
dest: /home/{{ payara_user }}/downloads
community.general.maven_artifact:
repository_url: "https://repo.icatproject.org/repo"
group_id: "org.icatproject"
artifact_id: "authn.anon"
version: "{{ authn_anon_version }}"
classifier: "distro"
extension: "zip"
dest: "/home/{{ payara_user }}/downloads/authn.anon-{{ authn_anon_version }}-distro.zip"
owner: "{{ payara_user }}"
group: "{{ payara_user }}"
mode: 0664
Expand All @@ -26,7 +31,7 @@
find:
paths: /home/{{ payara_user }}/install/authn.anon/
use_regex: yes
patterns: "^.*-(?!{{ authn_anon_version }}).*\\.war$"
patterns: "^.*(?<!{{ authn_anon_version }})\\.war$"
register: warFilesResult

- name: "Remove war files not matching the current version"
Expand Down Expand Up @@ -82,9 +87,9 @@
notify:
- "authn_anon-handler"

- name: "Setup authn_anon if not setup"
- name: "Setup authn_anon if not setup or a different version is found"
import_tasks: tasks/installation.yml
when: (ansible_local is not defined) or (ansible_local.local is not defined) or (ansible_local.local.instantiations is not defined) or (ansible_local.local.instantiations.authn_anon is not defined) or (ansible_local.local.instantiations.authn_anon != 'true')
when: (ansible_local is not defined) or (ansible_local.local is not defined) or (ansible_local.local.instantiations is not defined) or (ansible_local.local.instantiations.authn_anon is not defined) or (ansible_local.local.instantiations.authn_anon != 'true') or (ansible_local.local.versions.authn_anon != authn_anon_version)

- name: "Set temporary fact to indicate authn_anon is installed within play"
set_fact:
Expand Down
2 changes: 1 addition & 1 deletion roles/authn_db/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---

authn_db_version: '2.0.1'
authn_db_version: '3.0.0'
17 changes: 11 additions & 6 deletions roles/authn_db/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
register: packageResult

- name: "Download authn_db"
get_url:
url: https://repo.icatproject.org/repo/org/icatproject/authn.db/{{ authn_db_version }}/authn.db-{{ authn_db_version }}-distro.zip
dest: /home/{{ payara_user }}/downloads
community.general.maven_artifact:
repository_url: "https://repo.icatproject.org/repo"
group_id: "org.icatproject"
artifact_id: "authn.db"
version: "{{ authn_db_version }}"
classifier: "distro"
extension: "zip"
dest: "/home/{{ payara_user }}/downloads/authn.db-{{ authn_db_version }}-distro.zip"
owner: "{{ payara_user }}"
group: "{{ payara_user }}"
mode: 0664
Expand All @@ -26,7 +31,7 @@
find:
paths: /home/{{ payara_user }}/install/authn.db/
use_regex: yes
patterns: "^.*-(?!{{ authn_db_version }}).*\\.war$"
patterns: "^.*(?<!{{ authn_db_version }})\\.war$"
register: warFilesResult

- name: "Remove war files not matching the current version"
Expand Down Expand Up @@ -110,9 +115,9 @@
notify:
- "authn_db-handler"

- name: "Setup authn_db if not setup"
- name: "Setup authn_db if not setup or a different version is found"
import_tasks: tasks/installation.yml
when: (ansible_local is not defined) or (ansible_local.local is not defined) or (ansible_local.local.instantiations is not defined) or (ansible_local.local.instantiations.authn_db is not defined) or (ansible_local.local.instantiations.authn_db != 'true')
when: (ansible_local is not defined) or (ansible_local.local is not defined) or (ansible_local.local.instantiations is not defined) or (ansible_local.local.instantiations.authn_db is not defined) or (ansible_local.local.instantiations.authn_db != 'true') or (ansible_local.local.versions.authn_db != authn_db_version)

- name: "Setup default database users"
import_tasks: create_default_users.yml
Expand Down
6 changes: 3 additions & 3 deletions roles/authn_db/templates/mariadb.setup.properties.j2
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Glassfish
secure = true
container = Glassfish
home = /home/{{ payara_user }}/{{ payara_directory }}
home = {{ payara_dir }}
port = 4848

# MySQL
db.driver = com.mysql.jdbc.jdbc2.optional.MysqlDataSource
db.driver = com.mysql.cj.jdbc.MysqlDataSource
db.url = jdbc:mysql://{{ db_icat_hostname }}:{{ db_icat_mariadb_port }}/{{ icat_database }}
db.username = {{ db_icat_username }}
db.password = {{ db_icat_password }}
db.password = {{ db_icat_password }}
2 changes: 1 addition & 1 deletion roles/authn_db/templates/oracle.setup.properties.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Glassfish
secure = true
container = Glassfish
home = /home/{{ payara_user }}/{{ payara_directory }}
home = {{ payara_dir }}
port = 4848

# Oracle
Expand Down
6 changes: 3 additions & 3 deletions roles/authn_db/templates/setup.properties.j2
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Glassfish
secure = true
container = Glassfish
home = /home/{{ payara_user }}/{{ payara_directory }}
home = {{ payara_dir }}
port = 4848

# MySQL
db.driver = com.mysql.jdbc.jdbc2.optional.MysqlDataSource
db.driver = com.mysql.cj.jdbc.MysqlDataSource
db.url = jdbc:mysql://{{ db_icat_hostname }}:{{ db_icat_mariadb_port }}/{{ icat_database }}
db.username = {{ db_icat_username }}
db.password = {{ db_icat_password }}
db.password = {{ db_icat_password }}
2 changes: 1 addition & 1 deletion roles/authn_ldap/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
authn_ldap_version: "2.0.1"
authn_ldap_version: "3.0.0"
authn_ldap_provider_url: "ldap://logon05.fed.cclrc.ac.uk"
authn_ldap_mechanism_enabled: true
25 changes: 0 additions & 25 deletions roles/authn_ldap/tasks/compat1x.yml

This file was deleted.

21 changes: 11 additions & 10 deletions roles/authn_ldap/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
register: packageResult

- name: "Download authn_ldap"
get_url:
url: https://repo.icatproject.org/repo/org/icatproject/authn.ldap/{{ authn_ldap_version }}/authn.ldap-{{ authn_ldap_version }}-distro.zip
dest: /home/{{ payara_user }}/downloads
community.general.maven_artifact:
repository_url: "https://repo.icatproject.org/repo"
group_id: "org.icatproject"
artifact_id: "authn.ldap"
version: "{{ authn_ldap_version }}"
classifier: "distro"
extension: "zip"
dest: "/home/{{ payara_user }}/downloads/authn.ldap-{{ authn_ldap_version }}-distro.zip"
owner: "{{ payara_user }}"
group: "{{ payara_user }}"
mode: 0664
Expand All @@ -26,7 +31,7 @@
find:
paths: /home/{{ payara_user }}/install/authn.ldap/
use_regex: yes
patterns: "^.*-(?!{{ authn_ldap_version }}).*\\.war$"
patterns: "^.*(?<!{{ authn_ldap_version }})\\.war$"
register: warFilesResult

- name: "Remove war files not matching the current version"
Expand Down Expand Up @@ -99,13 +104,9 @@
notify:
- "authn_ldap-handler"

- name: "Run tasks for authn_ldap versions 1.x"
import_tasks: tasks/compat1x.yml
when: authn_ldap_compat1x is defined and authn_ldap_compat1x

- name: "Setup authn_ldap if not setup"
- name: "Setup authn_ldap if not setup or a different version is found"
import_tasks: tasks/installation.yml
when: (ansible_local is not defined) or (ansible_local.local is not defined) or (ansible_local.local.instantiations is not defined) or (ansible_local.local.instantiations.authn_ldap is not defined) or (ansible_local.local.instantiations.authn_ldap != 'true')
when: (ansible_local is not defined) or (ansible_local.local is not defined) or (ansible_local.local.instantiations is not defined) or (ansible_local.local.instantiations.authn_ldap is not defined) or (ansible_local.local.instantiations.authn_ldap != 'true') or (ansible_local.local.versions.authn_ldap != authn_ldap_version)

- name: "Set temporary fact to indicate authn_ldap is installed within play"
set_fact:
Expand Down
3 changes: 0 additions & 3 deletions roles/authn_ldap/vars/main.yml

This file was deleted.

2 changes: 1 addition & 1 deletion roles/authn_simple/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---

authn_simple_version: '2.0.1'
authn_simple_version: '3.0.0'
25 changes: 0 additions & 25 deletions roles/authn_simple/tasks/compat1x.yml

This file was deleted.

21 changes: 11 additions & 10 deletions roles/authn_simple/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
register: packageResult

- name: "Download authn_simple"
get_url:
url: https://repo.icatproject.org/repo/org/icatproject/authn.simple/{{ authn_simple_version }}/authn.simple-{{ authn_simple_version }}-distro.zip
dest: /home/{{ payara_user }}/downloads
community.general.maven_artifact:
repository_url: "https://repo.icatproject.org/repo"
group_id: "org.icatproject"
artifact_id: "authn.simple"
version: "{{ authn_simple_version }}"
classifier: "distro"
extension: "zip"
dest: "/home/{{ payara_user }}/downloads/authn.simple-{{ authn_simple_version }}-distro.zip"
owner: "{{ payara_user }}"
group: "{{ payara_user }}"
mode: 0664
Expand All @@ -26,7 +31,7 @@
find:
paths: /home/{{ payara_user }}/install/authn.simple/
use_regex: yes
patterns: "^.*-(?!{{ authn_simple_version }}).*\\.war$"
patterns: "^.*(?<!{{ authn_simple_version }})\\.war$"
register: warFilesResult

- name: "Remove war files not matching the current version"
Expand Down Expand Up @@ -99,10 +104,6 @@
notify:
- "authn_simple-handler"

- name: "Run tasks for authn_simple versions 1.x"
import_tasks: tasks/compat1x.yml
when: authn_simple_compat1x is defined and authn_simple_compat1x

- name: "Setup authn_simple if not setup"
- name: "Setup authn_simple if not setup or a different version is found"
import_tasks: tasks/installation.yml
when: (ansible_local is not defined) or (ansible_local.local is not defined) or (ansible_local.local.instantiations is not defined) or (ansible_local.local.instantiations.authn_simple is not defined) or (ansible_local.local.instantiations.authn_simple != 'true')
when: (ansible_local is not defined) or (ansible_local.local is not defined) or (ansible_local.local.instantiations is not defined) or (ansible_local.local.instantiations.authn_simple is not defined) or (ansible_local.local.instantiations.authn_simple != 'true') or (ansible_local.local.versions.authn_simple != authn_simple_version)
3 changes: 0 additions & 3 deletions roles/authn_simple/vars/main.yml

This file was deleted.

18 changes: 8 additions & 10 deletions roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
---
- name: "Update apt cache if running on Debian system"
apt:
update_cache: yes
when: ansible_os_family == 'Debian'

- name: "Update yum cache if running on RedHat system"
yum:
update_cache: yes
when: ansible_os_family == 'RedHat'

- name: "Installing common packages"
package:
state: latest
state: present
name:
- htop
- unzip
- vim
- wget

- name: "Install python3-lxml"
package:
state: present
name:
- python3-lxml
when: not (ansible_os_family == "RedHat" and ansible_distribution_major_version == "7")

- name: "Create ansible config directory on remote hosts"
file:
path: /etc/ansible/facts.d
Expand Down
3 changes: 3 additions & 0 deletions roles/datagateway_download_api/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---

datagateway_download_api_version: '3.0.1'
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${HOME}/logs/topcat.log</file>
<file>${HOME}/logs/datagateway-download-api.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${HOME}/logs/topcat.log.%d{yyyy-MM-dd}.%i.zip
<fileNamePattern>${HOME}/logs/datagateway-download-api.log.%d{yyyy-MM-dd}.%i.zip
</fileNamePattern>
<maxHistory>30</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
- name: 'Import: Check payara is running'
import_tasks: "{{ role_path }}/../payara/tasks/status.yml"

- name: 'Re-install topcat'
shell: 'su -l {{ payara_user }} -c "cd /home/{{ payara_user }}/install/topcat; python2 setup -vv install"'
- name: 'Re-install datagateway-download-api'
shell: 'su -l {{ payara_user }} -c "cd /home/{{ payara_user }}/install/datagateway-download-api; ./setup -vv install"'
become: true
become_user: root
args:
Expand Down
Loading

0 comments on commit aeea97b

Please sign in to comment.