phetsims / rosetta

PhET's Simulation Translation Utility
MIT License
3 stars 1 forks source link

Update rosetta to node 18 on phet-server-dev #405

Closed mattpen closed 3 months ago

mattpen commented 1 year ago

When rosetta is ready to be upgraded to node 18 on phet-server-dev, the systemd file /usr/lib/systemd/system/rosetta.service should point to /home/phet-admin/.nvm/versions/node/v18.16.0/bin/npm instead of /usr/local/bin/npm.

This should be done before node 16 end of life on 09-11-2023 - https://github.com/nodejs/release#release-schedule

EDIT: if you wait a while to do this, the minor and/or maintenance versions of node may have changed, please check the target before hard coding 18.16.0 using which node in an interactive shell for phet-admin. Note: sudo -u phet-admin which node will report the node version for your user, not phet-admin. It's required that phet-admin's .bashrc has been loaded in the current shell, for example you could run sudo -i -u phet-admin then which node.

jbphet commented 1 year ago

@liammulh and I discussed this and did a little initial work on it, and he is going to take it from here. I'm going to unassign myself for now.

liammulh commented 1 year ago

I tried changing the rosetta.service file today on phet-server2, and it didn't work. After changing the path to npm like MP suggested above, I ran sudo systemctl daemon-reload, then sudo systemctl restart rosetta. When I did, it failed. I am not sure why.

A few notes for posterity:

liammulh commented 1 year ago

Hey, it looks like Node 18 isn't available yet:

$ nvm ls
       v14.18.2
->     v16.14.2
         system
default -> 16 (-> v16.14.2)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v16.14.2) (default)
stable -> 16.14 (-> v16.14.2) (default)
lts/* -> lts/gallium (-> v16.14.2)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.19.1 (-> N/A)
lts/gallium -> v16.14.2

@mattpen, Rosetta is running on Node 18 using my Mac computer. I haven't seen any issues. @jbphet also is able to run Rosetta + Node 18 on Windows, so we are pretty confident it is ready once phet-server2 has Node 18 installed.

jbphet commented 3 months ago

@mattpen - I've been allocated some time to work on Rosetta in this iteration (iteration E2, early August 2024), and came across this issue. I just checked, and it looks like a newer version of Node is running now on phet-server-dev. If I run node -v when logged in as phet-admin on that machine, I'm seeing v20.14.0. I looked at rosetta.service, and though I don't know how to read these files well, I don't see anything that seems to be specifying a particular version of Node. Is this issue perhaps resolved?

mattpen commented 3 months ago

rosetta.service specifies that the service starts with /usr/local/bin/npm start. The version of npm it is using is:

[mape5853@phet-server-dev bin]$ /usr/local/bin/npm -v
8.5.0

According to https://nodejs.org/en/about/previous-releases#looking-for-latest-release-of-a-version-branch it looks like this corresponds to Node 16, so I would think that no, this is not resolved.

Since rosetta is running as phet-admin, I would advise using a version of npm provided by nvm for that user if possible. Since phet-server2/phet-server-dev are now on RHEL 9, you can use whatever version you want (I'd recommend node 20, but 22 is an option as it will enter LTS in Oct. 2024).

So, rosetta.service would need to change the npm in the ExecStart variable to something like:

ExecStart=/home/phet-admin/.nvm/versions/node/v20.14.0/bin/npm start

But, we might want to install the latest node 20 (20.16.0) before doing that.

mattpen commented 3 months ago

Not sure if there is a corresponding issue, but rosetta on phet-server2 is still running node 16 as well, and should be upgraded to LTS:

[mape5853@phet-server2 ~]$ sudo cat /etc/systemd/system/rosetta.service
[Service]
ExecStart=/home/phet-admin/.nvm/versions/node/v16.14.2/bin/npm run prod
jbphet commented 3 months ago

@mattpen and I worked together to update both the latest version of NodeJS that is currently available on phet-server-dev and to update Rosetta's configuration files to use it. As of this writing, it's running v20.16.0. I haven't done much validation on this version, but I plan to log an issue to update the version used on the main server, and I'll do a bunch of testing prior to making that cutover.

This is done, closing.