From 32b0d94c11c3a1bdaccf136d0f5cef06972a87e2 Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Wed, 24 Jan 2024 15:55:05 -0500 Subject: [PATCH] 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 --- .github/workflows/ci.yaml | 3 ++- .sync.yml | 14 ++++++++--- README.md | 16 ++++++------ data/common.yaml | 9 +------ data/os/RedHat/7.yaml | 1 - manifests/apache.pp | 28 +++------------------ manifests/init.pp | 26 ++++++++++--------- manifests/repo/apt.pp | 21 +++++++++------- manifests/repo/rpm.pp | 30 +++------------------- metadata.json | 14 ++++++++++- spec/acceptance/nodesets/amazon2023.yml | 28 +++++++++++++++++++++ spec/acceptance/nodesets/debian-12.yml | 31 +++++++++++++++++++++++ spec/acceptance/nodesets/el7.yml | 29 ---------------------- spec/shared_examples/repo_apt.rb | 10 ++++---- spec/shared_examples/repo_rpm.rb | 33 ++++++------------------- 15 files changed, 139 insertions(+), 154 deletions(-) delete mode 100644 data/os/RedHat/7.yaml create mode 100644 spec/acceptance/nodesets/amazon2023.yml create mode 100644 spec/acceptance/nodesets/debian-12.yml delete mode 100644 spec/acceptance/nodesets/el7.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 04da148..8fdf8be 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -50,11 +50,12 @@ jobs: fail-fast: false matrix: set: - - "el7" - "el8" - "el9" + - "amazon2023" - "ubuntu-2004" - "ubuntu-2204" + - "debian-12" puppet: - "puppet7" - "puppet8" diff --git a/.sync.yml b/.sync.yml index 6bc8a92..5c815ae 100644 --- a/.sync.yml +++ b/.sync.yml @@ -7,11 +7,13 @@ Rakefile: - '0 6 * * 1' acceptance_matrix: set: - - el7 + - ---el7 - el8 - el9 + - amazon2023 - ubuntu-2004 - ubuntu-2204 + - debian-12 puppet: - puppet7 - puppet8 @@ -20,9 +22,7 @@ Rakefile: appveyor.yml: delete: true spec/acceptance/nodesets/el7.yml: - default_module_install_opts: - ignore-dependencies: ~ - force: ~ + delete: true spec/acceptance/nodesets/el8.yml: default_module_install_opts: ignore-dependencies: ~ @@ -51,3 +51,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: ~ diff --git a/README.md b/README.md index cf21c0e..b73339a 100644 --- a/README.md +++ b/README.md @@ -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 +* 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 @@ -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 ``` @@ -357,8 +356,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 diff --git a/data/common.yaml b/data/common.yaml index f36cd40..fdf908f 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -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' + diff --git a/data/os/RedHat/7.yaml b/data/os/RedHat/7.yaml deleted file mode 100644 index 9a903a0..0000000 --- a/data/os/RedHat/7.yaml +++ /dev/null @@ -1 +0,0 @@ -openondemand::repo_gpgkey: https://yum.osc.edu/ondemand/RPM-GPG-KEY-ondemand diff --git a/manifests/apache.pp b/manifests/apache.pp index 7ce45cb..0ca99d3 100644 --- a/manifests/apache.pp +++ b/manifests/apache.pp @@ -4,12 +4,6 @@ assert_private() if $openondemand::declare_apache { - if $openondemand::scl_apache { - class { 'apache::version': - scl_httpd_version => '2.4', - scl_php_version => '7.0', - } - } class { 'apache': default_vhost => false, } @@ -17,16 +11,10 @@ contain apache } - if $openondemand::scl_apache { - $package_prefix = 'httpd24-' - } else { - $package_prefix = '' - } - if $facts['os']['family'] == 'RedHat' { - $session_package = "${package_prefix}mod_session" - $proxy_html_package = "${package_prefix}mod_proxy_html" - $openidc_package = "${package_prefix}mod_auth_openidc" + $session_package = 'mod_session' + $proxy_html_package = 'mod_proxy_html' + $openidc_package = 'mod_auth_openidc' } else { $session_package = undef $proxy_html_package = undef @@ -71,16 +59,6 @@ } } - if $openondemand::scl_apache { - shellvar { 'HTTPD24_HTTPD_SCLS_ENABLED': - ensure => 'present', - target => '/opt/rh/httpd24/service-environment', - value => $openondemand::apache_scls, - require => Package['httpd'], - notify => Class['Apache::Service'], - } - } - systemd::dropin_file { 'ood.conf': unit => "${apache::service_name}.service", content => join([ diff --git a/manifests/init.pp b/manifests/init.pp index a5b2178..94a9ded 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -30,8 +30,6 @@ # Hash of apps to install, passed to ondemand::install::app # @param declare_apache # Boolean that determines if apache is declared or included -# @param apache_scls -# SCLs to load when starting Apache service # @param generator_insecure # Run ood-portal-generator with --insecure flag # This is needed if you wish to use default ood@localhost user or @@ -44,6 +42,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 @@ -76,6 +76,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 @@ -232,7 +236,7 @@ # 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] @@ -253,7 +257,6 @@ # Apache Boolean $declare_apache = true, - String $apache_scls = 'httpd24', # ood_portal.yml Boolean $generator_insecure = false, @@ -261,6 +264,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, @@ -277,6 +281,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', @@ -384,12 +390,6 @@ fail("Unsupported OS: module ${module_name}. osfamily=${osfamily} osmajor=${osmajor} detected") } - if versioncmp($osmajor, '7') <= 0 { - $scl_apache = true - } else { - $scl_apache = false - } - if $selinux { $selinux_package_ensure = $ondemand_package_ensure } else { @@ -474,6 +474,7 @@ 'server_aliases' => $server_aliases, 'port' => $port, 'ssl' => $ssl, + 'disable_logs' => $disable_logs, 'logroot' => $logroot, 'use_rewrites' => $use_rewrites, 'use_maintenance' => $use_maintenance, @@ -488,6 +489,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, @@ -541,7 +544,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'] } diff --git a/manifests/repo/apt.pp b/manifests/repo/apt.pp index 6c635b9..7773dcc 100644 --- a/manifests/repo/apt.pp +++ b/manifests/repo/apt.pp @@ -25,14 +25,17 @@ }, } - 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' { + 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', + }, + } } } diff --git a/manifests/repo/rpm.pp b/manifests/repo/rpm.pp index 87d741e..e4ea413 100644 --- a/manifests/repo/rpm.pp +++ b/manifests/repo/rpm.pp @@ -56,38 +56,14 @@ 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', - } - } - - case $facts['os']['name'] { - 'RedHat': { - rh_repo { "rhel-server-rhscl-${openondemand::osmajor}-rpms": - ensure => 'present', - } - } - 'CentOS': { - package { 'centos-release-scl': - ensure => 'installed', - } - } - default: { - # Do nothing - } - } - } - - 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 => '18', enable_only => true, provider => 'dnfmodule', } package { 'ruby': - ensure => '3.0', + ensure => '3.1', enable_only => true, provider => 'dnfmodule', } diff --git a/metadata.json b/metadata.json index 726c5a6..e1ebc24 100644 --- a/metadata.json +++ b/metadata.json @@ -74,12 +74,24 @@ "9" ] }, + { + "operatingsystem": "Amazon", + "operatingsystemrelease": [ + "2023" + ] + }, { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "20.04", "22.04" ] + }, + { + "operatingsystem": "Debian", + "operatingsystemrelease": [ + "12" + ] } ], "requirements": [ @@ -95,5 +107,5 @@ ], "pdk-version": "2.7.1", "template-url": "https://github.com/treydock/pdk-templates.git#master", - "template-ref": "heads/master-0-g76f4dbb" + "template-ref": "heads/master-0-ge8bcc28" } diff --git a/spec/acceptance/nodesets/amazon2023.yml b/spec/acceptance/nodesets/amazon2023.yml new file mode 100644 index 0000000..2ea704c --- /dev/null +++ b/spec/acceptance/nodesets/amazon2023.yml @@ -0,0 +1,28 @@ +HOSTS: + amazon-2023: + roles: + - agent + platform: amazon-2023-x86_64 + hypervisor: docker + image: amazonlinux:2023 + docker_preserve_image: true + docker_cmd: + - '/usr/sbin/init' + docker_image_commands: + - 'dnf install -y dnf-utils' + - 'dnf install -y wget which cronie iproute initscripts langpacks-en glibc-all-langpacks glibc-langpack-en cpio' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 + docker_container_name: 'openondemand-amazon2023' + default_module_install_opts: + ignore-dependencies: + force: +CONFIG: + log_level: debug + type: foss +ssh: + password: root + auth_methods: ["password"] + diff --git a/spec/acceptance/nodesets/debian-12.yml b/spec/acceptance/nodesets/debian-12.yml new file mode 100644 index 0000000..ad54880 --- /dev/null +++ b/spec/acceptance/nodesets/debian-12.yml @@ -0,0 +1,31 @@ +HOSTS: + debian12: + roles: + - agent + platform: debian-12-amd64 + hypervisor: docker + image: debian:12 + docker_preserve_image: true + docker_cmd: + - '/sbin/init' + docker_image_commands: + - 'apt-get install -y wget net-tools systemd-sysv locales apt-transport-https ca-certificates cron' + - 'echo "LC_ALL=en_US.UTF-8" >> /etc/environment' + - 'echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen' + - 'echo "LANG=en_US.UTF-8" > /etc/locale.conf' + - 'locale-gen en_US.UTF-8' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 + docker_container_name: 'openondemand-debian12' + default_module_install_opts: + ignore-dependencies: + force: +CONFIG: + log_level: debug + type: foss +ssh: + password: root + auth_methods: ["password"] + diff --git a/spec/acceptance/nodesets/el7.yml b/spec/acceptance/nodesets/el7.yml deleted file mode 100644 index 3a29316..0000000 --- a/spec/acceptance/nodesets/el7.yml +++ /dev/null @@ -1,29 +0,0 @@ -HOSTS: - centos-7: - roles: - - agent - platform: el-7-x86_64 - hypervisor: docker - image: centos:7 - docker_preserve_image: true - docker_cmd: - - '/usr/sbin/init' - docker_image_commands: - - 'yum install -y wget which cronie iproute initscripts' - - 'wget --no-check-certificate https://copr.fedorainfracloud.org/coprs/jsynacek/systemd-backports-for-centos-7/repo/epel-7/jsynacek-systemd-backports-for-centos-7-epel-7.repo -O /etc/yum.repos.d/jsynacek-systemd-centos-7.repo' - - 'yum update -y systemd' - docker_env: - - LANG=en_US.UTF-8 - - LANGUAGE=en_US.UTF-8 - - LC_ALL=en_US.UTF-8 - docker_container_name: 'openondemand-el7' - default_module_install_opts: - ignore-dependencies: - force: -CONFIG: - log_level: debug - type: foss -ssh: - password: root - auth_methods: ["password"] - diff --git a/spec/shared_examples/repo_apt.rb b/spec/shared_examples/repo_apt.rb index 0a337db..9715f2b 100644 --- a/spec/shared_examples/repo_apt.rb +++ b/spec/shared_examples/repo_apt.rb @@ -4,7 +4,7 @@ it do is_expected.to contain_apt__source('ondemand-web').with( ensure: 'present', - location: 'https://apt.osc.edu/ondemand/3.0/web/apt', + location: 'https://apt.osc.edu/ondemand/3.1/web/apt', repos: 'main', release: facts[:os]['distro']['codename'], key: { @@ -30,12 +30,12 @@ it do is_expected.to contain_apt__source('nodesource').with( ensure: 'present', - location: 'https://deb.nodesource.com/node_14.x', + location: 'https://deb.nodesource.com/node_18.x', repos: 'main', - release: facts[:os]['distro']['codename'], + release: 'nodistro', key: { - 'id' => '9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280', - 'source' => 'https://deb.nodesource.com/gpgkey/nodesource.gpg.key' + 'id' => '6F71F525282841EEDAF851B42F59B5F99B1BE0B4', + 'source' => 'https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key' }, ) end diff --git a/spec/shared_examples/repo_rpm.rb b/spec/shared_examples/repo_rpm.rb index 9d7e54a..3d1eafd 100644 --- a/spec/shared_examples/repo_rpm.rb +++ b/spec/shared_examples/repo_rpm.rb @@ -12,7 +12,7 @@ it do is_expected.to contain_yumrepo('ondemand-web').only_with( descr: 'Open OnDemand Web Repo', - baseurl: "https://yum.osc.edu/ondemand/3.0/web/el#{facts[:os]['release']['major']}/$basearch", + baseurl: "https://yum.osc.edu/ondemand/3.1/web/el#{facts[:os]['release']['major']}/$basearch", enabled: '1', gpgcheck: '1', repo_gpgcheck: '1', @@ -37,25 +37,6 @@ ) end - if facts[:os]['release']['major'].to_i == 7 - it { is_expected.not_to contain_exec('dnf makecache ondemand-web') } - - if facts[:os]['name'] == 'CentOS' - it { is_expected.to contain_file('/etc/yum.repos.d/ondemand-centos-scl.repo').with_ensure('absent') } - else - it { is_expected.not_to contain_file('/etc/yum.repos.d/ondemand-centos-scl.repo') } - end - - case facts[:os]['name'] - when 'RedHat' - it { is_expected.to contain_rh_repo("rhel-server-rhscl-#{facts[:os]['release']['major']}-rpms").with_ensure('present') } - when 'CentOS' - it { is_expected.to contain_package('centos-release-scl').with_ensure('installed') } - end - it { is_expected.not_to contain_package('nodejs:14') } - it { is_expected.not_to contain_package('ruby:3.0') } - end - if facts[:os]['release']['major'].to_i == 8 it do is_expected.to contain_exec('dnf makecache ondemand-web').with( @@ -71,9 +52,12 @@ is_expected.to contain_exec('dnf makecache ondemand-web').that_comes_before('Package[ruby]') end + end + + if facts[:os]['release']['major'].to_s =~ %r{^(8|9)$} it do is_expected.to contain_package('nodejs').with( - ensure: '14', + ensure: '18', enable_only: 'true', provider: 'dnfmodule', ) @@ -81,7 +65,7 @@ it do is_expected.to contain_package('ruby').with( - ensure: '3.0', + ensure: '3.1', enable_only: 'true', provider: 'dnfmodule', ) @@ -91,9 +75,8 @@ context 'when manage_dependency_repos => false' do let(:params) { { manage_dependency_repos: false } } - it { is_expected.not_to contain_file('/etc/yum.repos.d/ondemand-centos-scl.repo') } - it { is_expected.not_to contain_rh_repo("rhel-server-rhscl-#{facts[:os]['release']['major']}-rpms") } - it { is_expected.not_to contain_package('centos-release-scl') } + it { is_expected.not_to contain_package('nodejs') } + it { is_expected.not_to contain_package('ruby') } end context 'when repo_nightly => true' do