Skip to content

Conversation

@anvit
Copy link
Contributor

@anvit anvit commented Mar 13, 2025

This should add support for AtoM 2.9 (Ubuntu 22.04, Ubuntu 24.04, Rocky9) and PHP 8.x. Also bumps npm and node versions for AtoM

anvit and others added 4 commits March 13, 2025 15:19
@anvit anvit force-pushed the dev/ubuntu-24-atom branch from d03d436 to 4ed5ba6 Compare March 13, 2025 22:20
@anvit
Copy link
Contributor Author

anvit commented Mar 13, 2025

@mamedin this PR is based off of your dev/add-AtoM29-support branch, @replaceafill and I ran a couple of tests on https://github.com/artefactual/deploy-pub/actions/runs/13842622147 and https://github.com/artefactual-labs/am-packbuild/actions/runs/13844101697 to confirm that this is able to install AtoM, index documents, is able to connect to AM and receive a DIP upload, and that am-packbuild can build an AtoM 2.9 on Ubuntu 24.04 VM using this

Copy link
Contributor

@replaceafill replaceafill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me! 🎉

@anvit @scollazo Do you think this supersedes #127?

@mamedin
Copy link
Contributor

mamedin commented Mar 20, 2025

Running some tests:

  • Ubuntu 22 -> AtoM 28 update (no 2.9, just to ensure the role is not breaking old version)
  • Rocky 9 -> AtoM 28 update (no 2.9, just to ensure the role is not breaking old version)
  • Rocky 9 --> Upgrade from 2.8->2.9
  • vagrant Ubuntu 24 --> deploy-pub repo (new VM)
  • vagrant Rocky9 --> deploy-pub repo (new VM)
  • Ubuntu22 --> Run the role in existing 2.9
  • Ubuntu24 --> Run the role in existing 2.9
  • Rocky9 --> Run the role in existing 2.9

@mamedin
Copy link
Contributor

mamedin commented Mar 20, 2025

Rocky9 upgrade from AtoM 2.8 failed:

TASK [artefactual.atom : Create /usr/bin/php link] *******************************************************************************************************************************************************************************
fatal: [rocky9-atom]: FAILED! => {"changed": false, "gid": 0, "group": "root", "mode": "0755", "msg": "refusing to convert from file to symlink for /usr/bin/php", "owner": "root", "path": "/usr/bin/php", "secontext": "system_u:object_r:bin_t:s0", "size": 8469760, "state": "file", "uid": 0}

It was a file:

[root@rocky9-atom ~]# ls -lh /usr/bin/php
-rwxr-xr-x. 1 root root 8.1M Oct 20  2023 /usr/bin/php

It comes from php-cli package:

[root@rocky9-atom ~]# rpm -qf /usr/bin/php
php-cli-8.0.30-1.el9_2.x86_64

Checking /var/log/dnf.log, it was installed at:

2025-03-20T16:07:20+0000 DEBUG Installed: php-cli-8.0.30-1.el9_2.x86_64
2025-03-20T16:07:20+0000 DEBUG Installed: php81-php-cli-8.1.32-1.el9.remi.x86_64

And checking /var/log/messages it was done with ansible:

Mar 20 16:07:08 rocky9-atom python3[259571]: ansible-ansible.legacy.dnf Invoked with name=['php81-php-cli', 'php81-php-ldap', 'php81-php-fpm', 'php81-php-mysqlnd', 'php81-php-xml', 'php81-php-opcache', 'php81-php-devel', 'php81-php-mbstring', 'php81-php-pecl-apcu', 'php81-php-pecl-memcache', 'php81-php-pecl-memprof', 'php81-php-pecl-zip', 'zlib-devel', 'unzip', 'java-1.8.0-openjdk-headless'] state=latest allow_downgrade=False autoremove=False bugfix=False cacheonly=False disable_gpg_check=False disable_plugin=[] disablerepo=[] download_only=False enable_plugin=[] enablerepo=[] exclude=[] installroot=/ install_repoquery=True install_weak_deps=True security=False skip_broken=False update_cache=False update_only=False validate_certs=True sslverify=True lock_timeout=30 allowerasing=False nobest=False use_backend=auto conf_file=None disable_excludes=None download_dir=None list=None releasever=None

More lines in dnf.log:

2025-03-20T16:07:13+0000 DDEBUG RPM transaction start.
2025-03-20T16:07:19+0000 DDEBUG RPM transaction over.
2025-03-20T16:07:19+0000 DDEBUG timer: verify transaction: 316 ms
2025-03-20T16:07:19+0000 DDEBUG timer: transaction: 6517 ms
2025-03-20T16:07:19+0000 DEBUG Completion plugin: Generating completion cache...
2025-03-20T16:07:20+0000 DEBUG Installed: php-cli-8.0.30-1.el9_2.x86_64
2025-03-20T16:07:20+0000 DEBUG Installed: php-common-8.0.30-1.el9_2.x86_64
2025-03-20T16:07:20+0000 DEBUG Installed: php-fedora-autoloader-1.0.1-7.el9.noarch
2025-03-20T16:07:20+0000 DEBUG Installed: php-nikic-php-parser4-4.18.0-1.el9.noarch
2025-03-20T16:07:20+0000 DEBUG Installed: php81-php-cli-8.1.32-1.el9.remi.x86_64
2025-03-20T16:07:20+0000 DEBUG Installed: php81-php-common-8.1.32-1.el9.remi.x86_64
2025-03-20T16:07:20+0000 DEBUG Installed: php81-php-devel-8.1.32-1.el9.remi.x86_64
2025-03-20T16:07:20+0000 DEBUG Installed: php81-php-fpm-8.1.32-1.el9.remi.x86_64
2025-03-20T16:07:20+0000 DEBUG Installed: php81-php-ldap-8.1.32-1.el9.remi.x86_64
2025-03-20T16:07:20+0000 DEBUG Installed: php81-php-mbstring-8.1.32-1.el9.remi.x86_64
2025-03-20T16:07:20+0000 DEBUG Installed: php81-php-mysqlnd-8.1.32-1.el9.remi.x86_64
2025-03-20T16:07:20+0000 DEBUG Installed: php81-php-opcache-8.1.32-1.el9.remi.x86_64
2025-03-20T16:07:20+0000 DEBUG Installed: php81-php-pdo-8.1.32-1.el9.remi.x86_64
2025-03-20T16:07:20+0000 DEBUG Installed: php81-php-pecl-apcu-5.1.24-1.el9.remi.x86_64
2025-03-20T16:07:20+0000 DEBUG Installed: php81-php-pecl-memcache-8.2-1.el9.remi.x86_64
2025-03-20T16:07:20+0000 DEBUG Installed: php81-php-pecl-memprof-3.1.0-1.el9.remi.x86_64
2025-03-20T16:07:20+0000 DEBUG Installed: php81-php-pecl-zip-1.22.5-1.el9.remi.x86_64
2025-03-20T16:07:20+0000 DEBUG Installed: php81-php-xml-8.1.32-1.el9.remi.x86_64
2025-03-20T16:07:20+0000 DEBUG Installed: php81-runtime-8.1-4.el9.remi.x86_64

When removing php-cli:

[root@rocky9-atom log]# yum remove php-cli
Dependencies resolved.
==================================================================================================================================================================================================================================
 Package                                                        Architecture                                    Version                                                 Repository                                           Size
==================================================================================================================================================================================================================================
Removing:
 php-cli                                                        x86_64                                          8.0.30-1.el9_2                                          @appstream                                           16 M
Removing dependent packages:
 php-nikic-php-parser4                                          noarch                                          4.18.0-1.el9                                            @epel                                               941 k
Removing unused dependencies:
 php-common                                                     x86_64                                          8.0.30-1.el9_2                                          @appstream                                          7.8 M
 php-fedora-autoloader                                          noarch                                          1.0.1-7.el9                                             @epel                                                15 k

Transaction Summary
==================================================================================================================================================================================================================================
Remove  4 Packages

Freed space: 25 M
Is this ok [y/N]: 

After removing the package and running again the role, this time failed starting php-fpm service, because it has 2 fpm services installed and the old is running:

[root@analyst-blossom-atom ~]# rpm -qa | grep fpm
php74-php-fpm-7.4.33-23.el9.remi.x86_64
php81-php-fpm-8.1.32-1.el9.remi.x86_64

@mamedin
Copy link
Contributor

mamedin commented Mar 25, 2025

@anvit I added a new commit to fix the 2 issues I saw in RedHat upgrade.

It makes easier to maintain the php tasks for RedHat. We already had a
task file only for php7.4 and RedHat. It is the same php-rh-7.4.yml file
but adding a task to remove old php7 (required for 2.9 upgrades from
2.7/2.8).

To avoid installing recommended packages, the following options have
been added to yum task:

   * allowerasing: true
   * install_weak_deps: false
@mamedin mamedin requested a review from replaceafill March 25, 2025 07:26
@mamedin
Copy link
Contributor

mamedin commented Mar 25, 2025

New error when testing rolling the role in AtoM 2.8 (Ubuntu20) and AtoM2.8->2.9 Upgrade in Rocky9:

TASK [artefactual.atom : Update npm to 10.9.2 version] ***************************************************************************************************************************************************************************
fatal: [ubuntu20-2.8-atom]: FAILED! => {"changed": true, "cmd": ["npm", "install", "-g", "[email protected]"], "delta": "0:00:00.482053", "end": "2025-03-25 07:26:44.737015", "msg": "non-zero return code", "rc": 1, "start": "2025-03-25 07:26:44.254962", "stderr": "npm ERR! code EBADENGINE\nnpm ERR! engine Unsupported engine\nnpm ERR! engine Not compatible with your version of node/npm: [email protected]\nnpm ERR! notsup Not compatible with your version of node/npm: [email protected]\nnpm ERR! notsup Required: {\"node\":\"^18.17.0 || >=20.5.0\"}\nnpm ERR! notsup Actual:   {\"npm\":\"9.8.1\",\"node\":\"v14.21.3\"}\n\nnpm ERR! A complete log of this run can be found in: /root/.npm/_logs/2025-03-25T07_26_44_422Z-debug-0.log", "stderr_lines": ["npm ERR! code EBADENGINE", "npm ERR! engine Unsupported engine", "npm ERR! engine Not compatible with your version of node/npm: [email protected]", "npm ERR! notsup Not compatible with your version of node/npm: [email protected]", "npm ERR! notsup Required: {\"node\":\"^18.17.0 || >=20.5.0\"}", "npm ERR! notsup Actual:   {\"npm\":\"9.8.1\",\"node\":\"v14.21.3\"}", "", "npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2025-03-25T07_26_44_422Z-debug-0.log"], "stdout": "", "stdout_lines": []}

fatal: [rocky9-2.9-atom]: FAILED! => {"changed": true, "cmd": ["npm", "install", "-g", "[email protected]"], "delta": "0:00:00.915834", "end": "2025-03-25 07:26:45.378177", "msg": "non-zero return code", "rc": 1, "start": "2025-03-25 07:26:44.462343", "stderr": "npm ERR! code EBADENGINE\nnpm ERR! engine Unsupported engine\nnpm ERR! engine Not compatible with your version of node/npm: [email protected]\nnpm ERR! notsup Not compatible with your version of node/npm: [email protected]\nnpm ERR! notsup Required: {\"node\":\"^18.17.0 || >=20.5.0\"}\nnpm ERR! notsup Actual:   {\"npm\":\"9.8.1\",\"node\":\"v14.21.3\"}\n\nnpm ERR! A complete log of this run can be found in: /root/.npm/_logs/2025-03-25T07_26_44_806Z-debug-0.log", "stderr_lines": ["npm ERR! code EBADENGINE", "npm ERR! engine Unsupported engine", "npm ERR! engine Not compatible with your version of node/npm: [email protected]", "npm ERR! notsup Not compatible with your version of node/npm: [email protected]", "npm ERR! notsup Required: {\"node\":\"^18.17.0 || >=20.5.0\"}", "npm ERR! notsup Actual:   {\"npm\":\"9.8.1\",\"node\":\"v14.21.3\"}", "", "npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2025-03-25T07_26_44_806Z-debug-0.log"], "stdout": "", "stdout_lines": []}

@mamedin
Copy link
Contributor

mamedin commented Mar 25, 2025

Reading the error log:

36 verbose pkgid [email protected]
37 verbose cwd /home/artefactual
38 verbose Linux 5.14.0-427.26.1.el9_4.x86_64
39 verbose node v14.21.3
40 verbose npm  v9.8.1
41 error code EBADENGINE
42 error engine Unsupported engine
43 error engine Not compatible with your version of node/npm: [email protected]
44 error notsup Not compatible with your version of node/npm: [email protected]
44 error notsup Required: {"node":"^18.17.0 || >=20.5.0"}
44 error notsup Actual:   {"npm":"9.8.1","node":"v14.21.3"}
45 verbose exit 1
46 timing npm Completed in 559ms
47 verbose code 1
48 error A complete log of this run can be found in: /root/.npm/_logs/2025-03-25T07_26_44_806Z-debug-0.log

So, it requires node>=20.5.0. But the problem is that it is not supported in Ubuntu18 or CentOS7, so it will break the role for old versions. See supported versions on deb and rpms here: https://github.com/nodesource/distributions

Additional changes must be done to install the nodejs package with the correct package repo, but need to take into account the old supported AtoM and OS versions.

  • For Ubuntu 20 there's an error in tasks/deps.yml, not installing any nodesource repo for Ubuntu 20.
  • For rpms now it is adding nodesource 14.x repo in tasks/deps-rh-php-81.yml file-

We need to decide what to do with atom_npm_version variable. It is only used in tasks/build.yml file for buildstrap5. We can forget Ubuntu<20.04, but RedHat 7 has AtoM2.7 support.

We can define the atom_npm_version in defaults/main.yml` file with a conditional, based on OS version, with:

# Define default `atom_npm_version` depending on OS and version
atom_npm_version: >-
  {{
    (
      "10.9.2" if ansible_os_family == 'Debian' and ansible_distribution_version >= '22.04' else
      "10.9.2" if ansible_os_family == 'RedHat'  and ansible_distribution_version > '7' else
      "9.8.1"
    ) | trim
  }}

This way, it will use the old version (9.8.1) for Ubuntu<=20.04 and RedHat <=7.

RedHat is using a different deps-rh task file, based on php version. We can use a different nodesource repo for each file:

  • deps-rh.yml : php < 7.4 --> No changes needed
  • deps-rh-7.4.yml: php =>7.4 and php <8.1 --> No changes needed
  • deps-rh-81.yml: php >= 8.1 --> Add nodesource 20.x repo.

Ubuntu requires the changes in deps.yml:

  • Fix Ubuntu 20.04 repo, not adding any repo now, it needs nodesource 14.x
  • Add nodesource 20.x for Ubuntu >= 22.04

Miguel Medinilla added 2 commits March 28, 2025 09:51
* Added  conditional for default npm version based on OS
* Use nodesource 22.x repo for Ubuntu >= 22.04
* Use nodesource 22.x repo for RedHat >= 8 and php >= 8.1
* Fix nodesource 14.x repo for Ubuntu 20.04
Update README.md for AtoM 2.9 and new supported Operative Systems.
@mamedin
Copy link
Contributor

mamedin commented Mar 28, 2025

Test finished. Vagrant tests done: https://github.com/artefactual/deploy-pub/tree/dev/add-atom29-playbooks

@anvit
Copy link
Contributor Author

anvit commented Mar 28, 2025

Thanks @mamedin ! I took a look at the new commits and they look good to me!

@anvit anvit merged commit 3a4e95c into master Mar 31, 2025
@anvit anvit deleted the dev/ubuntu-24-atom branch March 31, 2025 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants