Skip to content

Commit

Permalink
Support OnDemand 3.1 (#154)
Browse files Browse the repository at this point in the history
* Support OnDemand 3.1
* Drop EL7 support - fixes #147
* Amazon 2023 support - fixes #127
* Support aarch64 (no changes) - fixes #128
* Support ppc64le (no changes) - fixes #133
* Update to NodeJS 18 and Ruby 3.1 for EL8 and EL9 - fixes #134
* Support Debian 12 - fixes #139
* Use NodeJS nodistro repos - fixes #140
* Add 'disable_logs' parameter - fixes #149
* Add 'custom_vhost_directives' and 'custom_location_directives' parameters - fixes #152

* Use forked beaker-docker to support Amazon 2023 tests

* Need makecache hack for all EL and fix Amazon repo URL

* Still support OnDemand 3.0

* Can not enable NodeJS module for EL9 and 3.0

* Add repo_module_hotfixes and enable for EL8

* Need to remove Ruby 3.1 DNF module on EL9 for OnDemand 3.0

* Disable Apache during Amazon tests
  • Loading branch information
treydock authored Feb 13, 2024
1 parent ea8c953 commit 9e19df0
Show file tree
Hide file tree
Showing 20 changed files with 364 additions and 102 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ jobs:
- "el7"
- "el8"
- "el9"
- "amazon2023"
- "ubuntu-2004"
- "ubuntu-2204"
- "debian-12"
puppet:
- "puppet7"
- "puppet8"
Expand Down
8 changes: 8 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ Rakefile:
- el7
- el8
- el9
- amazon2023
- ubuntu-2004
- ubuntu-2204
- debian-12
puppet:
- puppet7
- puppet8
Expand Down Expand Up @@ -51,3 +53,9 @@ spec/acceptance/nodesets/ubuntu-2204.yml:
default_module_install_opts:
ignore-dependencies: ~
force: ~
spec/acceptance/nodesets/debian-12.yml:
packages:
- cron
default_module_install_opts:
ignore-dependencies: ~
force: ~
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ group :system_tests do
gem "beaker-pe", require: false
gem "beaker-hostgenerator"
gem "beaker-rspec"
gem "beaker-docker"
gem "beaker-puppet"
gem "beaker-docker", git: 'https://github.com/treydock/beaker-docker.git', branch: 'amazon-2023'
gem "beaker-puppet", git: 'https://github.com/puppetlabs/beaker-puppet.git', ref: '6063d22b6c4449df795731f5853c3c75241240c4'
gem "beaker-puppet_install_helper", require: false
gem "beaker-module_install_helper", require: false
end
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Manage [Open OnDemand](http://openondemand.org/) installation and configuration.

The following are the versions of this module and the supported versions of Open OnDemand:

* Module 3.x and 4.x supports Open OnDemand 3.x
* Module 5.x supports Open OnDemand 3.1 and 3.0
* Module 3.x and 4.x supports Open OnDemand 3.0
* Module 2.x supports Open OnDemand 2.x
* Module 1.x supports Open OnDemand 1.18.x
* Module <= 0.12.0 supports Open OnDemand <= 1.7
Expand Down Expand Up @@ -55,8 +56,6 @@ If you already declare the apache class you may wish to only include apache in t
```yaml
openondemand::declare_apache: false
apache::version::scl_httpd_version: '2.4'
apache::version::scl_php_version: '7.0'
apache::default_vhost: false
```
Expand Down Expand Up @@ -358,7 +357,9 @@ openondemand::confs:
This module has been tested on:

* RedHat/CentOS 7 x86_64
* RedHat/Rocky Linux/Alma Linux 8 x86_64
* RedHat/Rocky Linux/Alma Linux 9 x86_64
* Ubuntu 18.04 x86_64
* Ubuntu 20.04 x86_64
* RedHat/Rocky Linux/Alma Linux 8
* RedHat/Rocky Linux/Alma Linux 9
* Amazon Linux 2023
* Ubuntu 20.04
* Ubuntu 22.04
* Debian 12
9 changes: 1 addition & 8 deletions data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@ openondemand::nginx_stage_app_root:
dev: "/var/www/ood/apps/dev/%{literal('%')}{owner}/gateway/%{literal('%')}{name}"
usr: "/var/www/ood/apps/usr/%{literal('%')}{owner}/gateway/%{literal('%')}{name}"
sys: "/var/www/ood/apps/sys/%{literal('%')}{name}"
openondemand::basic_auth_users:
ood:
password: ood
openondemand::auth_configs:
- 'AuthName "Private"'
- 'AuthUserFile "/opt/rh/httpd24/root/etc/httpd/.htpasswd"'
- 'RequestHeader unset Authorization'
- 'Require valid-user'

2 changes: 2 additions & 0 deletions data/os/Amazon.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
openondemand::manage_epel: false
2 changes: 2 additions & 0 deletions data/os/RedHat/7.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# OnDemand 3.1 does not support EL7
openondemand::repo_release: '3.0'
openondemand::repo_gpgkey: https://yum.osc.edu/ondemand/RPM-GPG-KEY-ondemand
1 change: 1 addition & 0 deletions data/os/RedHat/8.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
openondemand::repo_gpgkey: https://yum.osc.edu/ondemand/RPM-GPG-KEY-ondemand
openondemand::repo_module_hotfixes: true
2 changes: 2 additions & 0 deletions hiera.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ defaults: # Used for any hierarchy level that omits these keys.
data_hash: yaml_data # Use the built-in YAML backend.

hierarchy:
- name: 'os name'
path: "os/%{facts.os.name}.yaml"
- name: 'os family - os major version'
path: "os/%{facts.os.family}/%{facts.os.release.major}.yaml"
- name: 'os family'
Expand Down
61 changes: 56 additions & 5 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# The URL for proxy for OnDemand repo
# @param repo_priority
# The priority of the OnDemand repo
# @param repo_module_hotfixes
# The module_hotfixes of the OnDemand repo
# @param repo_exclude
# Exclusion for OnDemand repo
# @param manage_dependency_repos
Expand Down Expand Up @@ -46,6 +48,8 @@
# ood_porta.yml server_aliases
# @param ssl
# ood_portal.yml ssl
# @param disable_logs
# ood_portal.yml disable_logs
# @param logroot
# ood_portal.yml logroot
# @param use_rewrites
Expand Down Expand Up @@ -78,6 +82,10 @@
# ood_portal.yml auth_type
# @param auth_configs
# ood_portal.yml auth_configs
# @param custom_vhost_directives
# ood_portal.yml custom_vhost_directives
# @param custom_location_directives
# ood_portal.yml custom_location_directives
# @param root_uri
# ood_portal.yml root_uri
# @param analytics
Expand Down Expand Up @@ -234,13 +242,14 @@
#
class openondemand (
# repos
String $repo_release = '3.0',
String $repo_release = '3.1',
Variant[Stdlib::HTTPSUrl, Stdlib::HTTPUrl]
$repo_baseurl_prefix = 'https://yum.osc.edu/ondemand',
Variant[Stdlib::HTTPSUrl, Stdlib::HTTPUrl, Stdlib::Absolutepath]
$repo_gpgkey = 'https://yum.osc.edu/ondemand/RPM-GPG-KEY-ondemand-SHA512',
Optional[String[1]] $repo_proxy = undef,
Integer[1,99] $repo_priority = 99,
Optional[Boolean] $repo_module_hotfixes = undef,
String $repo_exclude = 'absent',
Boolean $manage_dependency_repos = true,
Boolean $manage_epel = true,
Expand All @@ -264,6 +273,7 @@
Optional[String] $servername = undef,
Optional[Array] $server_aliases = undef,
Optional[Array] $ssl = undef,
Boolean $disable_logs = false,
String $logroot = 'logs',
Boolean $use_rewrites = true,
Boolean $use_maintenance = true,
Expand All @@ -280,6 +290,8 @@
Optional[String] $map_fail_uri = undef,
Variant[Enum['CAS', 'openid-connect', 'shibboleth', 'dex'], String[1]] $auth_type = 'dex',
Optional[Array] $auth_configs = undef,
Array $custom_vhost_directives = [],
Array $custom_location_directives = [],
String $root_uri = '/pun/sys/dashboard',
Optional[Struct[{ url => String, id => String }]] $analytics = undef,
String $public_uri = '/public',
Expand Down Expand Up @@ -381,27 +393,62 @@
$osname = $facts.dig('os', 'name')
$osmajor = $facts.dig('os', 'release', 'major')

$supported = ['RedHat-7','RedHat-8','RedHat-9','Debian-20.04','Debian-22.04']
$supported = ['RedHat-7','RedHat-8','RedHat-9','RedHat-2023','Debian-20.04','Debian-22.04','Debian-12']
$os = "${osfamily}-${osmajor}"
if ! ($os in $supported) {
fail("Unsupported OS: module ${module_name}. osfamily=${osfamily} osmajor=${osmajor} detected")
}

# Handle unsupported distro and OnDemand combos
if $repo_release == '3.1' {
if "${osfamily}-${osmajor}" == 'RedHat-7' {
fail('EL7 is not supported with OnDemand 3.1')
}
}
if $repo_release == '3.0' {
if "${osname}-${osmajor}" == 'Amazon-2023' {
fail('Amazon 2023 is not supported with OnDemand 3.0')
}
if "${osname}-${osmajor}" == 'Debian-12' {
fail('Debian 12 is not supported with OnDemand 3.0')
}
}

if versioncmp($osmajor, '7') <= 0 {
$scl_apache = true
} else {
$scl_apache = false
}

# EL9 only has these two versions at this time
if $repo_release == '3.0' and "${osfamily}-${osmajor}" == 'RedHat-9' {
$nodejs = 'absent'
$ruby = 'absent'
} elsif $repo_release == '3.0' {
$nodejs = '14'
$ruby = '3.0'
} else {
$nodejs = '18'
$ruby = '3.1'
}

if $selinux {
$selinux_package_ensure = $ondemand_package_ensure
} else {
$selinux_package_ensure = 'absent'
}

if $facts['os']['name'] == 'Amazon' {
$dist = 'amzn'
} elsif $osfamily == 'RedHat' {
$dist = 'el'
} else {
$dist = undef
}

if $osfamily == 'RedHat' {
$repo_baseurl = "${repo_baseurl_prefix}/${repo_release}/web/el${osmajor}/\$basearch"
$repo_nightly_baseurl = "${repo_baseurl_prefix}/nightly/web/el${osmajor}/\$basearch"
$repo_baseurl = "${repo_baseurl_prefix}/${repo_release}/web/${dist}${osmajor}/\$basearch"
$repo_nightly_baseurl = "${repo_baseurl_prefix}/nightly/web/${dist}${osmajor}/\$basearch"
} elsif $osfamily == 'Debian' {
$repo_baseurl = "${repo_baseurl_prefix}/${repo_release}/web/apt"
$repo_nightly_baseurl = "${repo_baseurl_prefix}/nightly/web/apt"
Expand Down Expand Up @@ -477,6 +524,7 @@
'server_aliases' => $server_aliases,
'port' => $port,
'ssl' => $ssl,
'disable_logs' => $disable_logs,
'logroot' => $logroot,
'use_rewrites' => $use_rewrites,
'use_maintenance' => $use_maintenance,
Expand All @@ -491,6 +539,8 @@
'map_fail_uri' => $map_fail_uri,
'pun_stage_cmd' => $pun_stage_cmd,
'auth' => $auth,
'custom_vhost_directives' => $custom_vhost_directives,
'custom_location_directives' => $custom_location_directives,
'root_uri' => $root_uri,
'analytics' => $analytics,
'public_uri' => $public_uri,
Expand Down Expand Up @@ -544,7 +594,8 @@
if $osfamily == 'RedHat' {
contain openondemand::repo::rpm
Class['openondemand::repo::rpm'] -> Class['openondemand::install']
} elsif $osfamily == 'Debian' {
}
if $osfamily == 'Debian' {
contain openondemand::repo::apt
Class['openondemand::repo::apt'] -> Class['openondemand::install']
}
Expand Down
34 changes: 25 additions & 9 deletions manifests/repo/apt.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,30 @@
},
}

apt::source { 'nodesource':
ensure => 'present',
location => 'https://deb.nodesource.com/node_14.x',
repos => 'main',
release => $facts['os']['distro']['codename'],
key => {
'id' => '9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280',
'source' => 'https://deb.nodesource.com/gpgkey/nodesource.gpg.key',
},
# Debian 12 has NodeJS 18 in OS repos
if String($openondemand::osmajor) != '12' and $openondemand::nodejs == '18' {
apt::source { 'nodesource':
ensure => 'present',
location => 'https://deb.nodesource.com/node_18.x',
repos => 'main',
release => 'nodistro',
key => {
'id' => '6F71F525282841EEDAF851B42F59B5F99B1BE0B4',
'source' => 'https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key',
},
}
}

if $openondemand::nodejs == '14' {
apt::source { 'nodesource':
ensure => 'present',
location => 'https://deb.nodesource.com/node_14.x',
repos => 'main',
release => $facts['os']['distro']['codename'],
key => {
'id' => '9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280',
'source' => 'https://deb.nodesource.com/gpgkey/nodesource.gpg.key',
},
}
}
}
26 changes: 10 additions & 16 deletions manifests/repo/rpm.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
priority => $openondemand::repo_priority,
exclude => $openondemand::repo_exclude,
proxy => $openondemand::repo_proxy,
module_hotfixes => $openondemand::repo_module_hotfixes,
}

yumrepo { 'ondemand-web-nightly':
Expand All @@ -36,33 +37,24 @@
metadata_expire => '1',
priority => $openondemand::repo_priority,
proxy => $openondemand::repo_proxy,
module_hotfixes => $openondemand::repo_module_hotfixes,
}

# Work around a bug where 'dnf module list' is not executed with -y
if versioncmp($openondemand::osmajor, '8') == 0 {
if versioncmp($openondemand::osmajor, '8') >= 0 {
# Work around a bug where 'dnf module list' is not executed with -y
exec { 'dnf makecache ondemand-web':
path => '/usr/bin:/bin:/usr/sbin:/sbin',
command => "dnf -q makecache -y --disablerepo='*' --enablerepo='ondemand-web'",
refreshonly => true,
subscribe => Yumrepo['ondemand-web'],
}
if $openondemand::manage_dependency_repos {
Exec['dnf makecache ondemand-web'] -> Package['nodejs']
Exec['dnf makecache ondemand-web'] -> Package['ruby']
}
}

if $openondemand::manage_epel {
contain epel
}

if versioncmp($openondemand::osmajor, '7') <= 0 and $openondemand::manage_dependency_repos {
if $facts['os']['name'] == 'CentOS' and versioncmp($openondemand::osmajor, '7') == 0 {
file { '/etc/yum.repos.d/ondemand-centos-scl.repo':
ensure => 'absent',
}
}

if versioncmp($openondemand::osmajor, '7') == 0 and $openondemand::manage_dependency_repos {
case $facts['os']['name'] {
'RedHat': {
rh_repo { "rhel-server-rhscl-${openondemand::osmajor}-rpms":
Expand All @@ -80,16 +72,18 @@
}
}

if versioncmp($openondemand::osmajor, '8') == 0 and $openondemand::manage_dependency_repos {
if String($openondemand::osmajor) in ['8', '9'] and $openondemand::manage_dependency_repos {
package { 'nodejs':
ensure => '14',
ensure => $openondemand::nodejs,
enable_only => true,
provider => 'dnfmodule',
require => Exec['dnf makecache ondemand-web'],
}
package { 'ruby':
ensure => '3.0',
ensure => $openondemand::ruby,
enable_only => true,
provider => 'dnfmodule',
require => Exec['dnf makecache ondemand-web'],
}
}
}
Loading

0 comments on commit 9e19df0

Please sign in to comment.