Skip to content

Better handling of node in Linux scripts.#607

Merged
mcottontensor merged 8 commits intoEpicGamesExt:masterfrom
mcottontensor:script_update_for_mac
May 6, 2025
Merged

Better handling of node in Linux scripts.#607
mcottontensor merged 8 commits intoEpicGamesExt:masterfrom
mcottontensor:script_update_for_mac

Conversation

@mcottontensor
Copy link
Copy Markdown
Collaborator

@mcottontensor mcottontensor commented May 5, 2025

Relevant components:

  • Signalling server
  • Common library
  • Frontend library
  • Frontend UI library
  • Matchmaker
  • Platform scripts
  • SFU

Problem statement:

A few issues:

  • The handling of node sometimes causes issues on some environments.
  • The semver comparison function does not work on mac.

Solution

For the node installations, we now just check whatever node is installed. If it's greater or equal to our requirements we do nothing. Otherwise we install node in our local location. If we installed node, then we update PATH to point to the new location.
If node_modules doesnt exist or package-lock is newer than the directory, we install dependencies, otherwise we assume they're up to date.
Additionally I've also added a printout of the node and npm versions used in the script.
I've removed the weird NPM variable that was used to point to the specific npm version. Since we now properly update the path it should not be needed. Also, the way we call sudo now should also allow the correct path variable to carry over to the new environment.
The version check function also now uses a simplified version utilizing 'sort -V' which is designed to sort version numbers. This should work across OSs like Linux and Mac.

Mac has issues with the way we currently check semver values. Replacing
it with sort -V. This might not be available on mac but CI should tell
me.
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented May 5, 2025

⚠️ No Changeset found

Latest commit: 186cb69

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mcottontensor mcottontensor changed the title Updating the platform scripts again. Better handling of node in Linux scripts. May 5, 2025
@mcottontensor mcottontensor marked this pull request as ready for review May 5, 2025 02:47
@mcottontensor mcottontensor added auto-backport Used to specify we want a PR to auto backport to a branch, must be paired with auto-backport-to-UEX. auto-backport-to-UE5.5 auto-backport-to-LatencyTest labels May 5, 2025
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is just piggy backing with this change. I figure it's useful to backport to LatencyTest.

echo "----------------------------------"

start_process "sudo PATH=\"$PATH\" \"$NPM\" start -- ${SERVER_ARGS}"
echo "sudo env \"PATH=$PATH\" npm start -- ${SERVER_ARGS}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the echo here just for debug?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yep. Will remove.


# setup the path so we're using our node. required when calling npm
PATH="${SCRIPT_DIR}/node/bin:$PATH"
# PATH="${SCRIPT_DIR}/node/bin:$PATH"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These comments can go (or be moved to line 177)

Copy link
Copy Markdown
Contributor

@lukehb lukehb left a comment

Choose a reason for hiding this comment

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

Looks like a good change to me. CI is passing from what I can see. I left a few minor comments/questions - but those are not merge blockers.

@mcottontensor mcottontensor merged commit f27bace into EpicGamesExt:master May 6, 2025
8 checks passed
@mcottontensor mcottontensor deleted the script_update_for_mac branch May 6, 2025 06:26
github-actions bot pushed a commit that referenced this pull request May 6, 2025
Updated the way the bash script sets up the environment for node.
Node will only be installed if a version meeting the minimum requirements is not found.
The new environment should result in a more robust environment setup.

(cherry picked from commit f27bace)
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented May 6, 2025

💔 Some backports could not be created

Status Branch Result
UE5.5 Backport failed because of merge conflicts
LatencyTest

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

backport --pr 607

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

github-actions bot added a commit that referenced this pull request May 6, 2025
[LatencyTest] refactor: Better handling of node in Linux scripts. (#607)
@mcottontensor
Copy link
Copy Markdown
Collaborator Author

💚 All backports created successfully

Status Branch Result
UE5.5

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

mcottontensor added a commit to mcottontensor/PixelStreamingInfrastructure that referenced this pull request May 6, 2025
Updated the way the bash script sets up the environment for node.
Node will only be installed if a version meeting the minimum requirements is not found.
The new environment should result in a more robust environment setup.

(cherry picked from commit f27bace)

# Conflicts:
#	SignallingWebServer/platform_scripts/bash/common.sh
mcottontensor added a commit that referenced this pull request May 6, 2025
Updated the way the bash script sets up the environment for node.
Node will only be installed if a version meeting the minimum requirements is not found.
The new environment should result in a more robust environment setup.

(cherry picked from commit f27bace)

# Conflicts:
#	SignallingWebServer/platform_scripts/bash/common.sh
mcottontensor added a commit that referenced this pull request May 29, 2025
… support (#647)

* Add 4.27 support back for latency testing

* Save webrtc stats to csv and auto download

* Deep copy stats object

* Update record parsing logic to handle missing field when generating the csv

* Update session test to handle additional latency stats

* Fixing path setup in the windows platform scripts. (#594) (#595)

(cherry picked from commit 152abd6)

Co-authored-by: mcottontensor <80377552+mcottontensor@users.noreply.github.com>
(cherry picked from commit 1dedc87)

* Fixing more path issues in platform_scripts (#604)

* feat: Adding script tests where the scripts are run multiple times.

This tests that the scripts still work when things have already been
installed.

* fix: Fixing typo in github action.

* gimme a break.

* Adding mutliple script runs for other OSs

* Testing node on the runner

* Trying to figure out what node is doing what.

* Trying to change the way node version is detected.

* Messy

* The additions to the script really didn't catch anything. Could be worth
revisiting how we handle the local node install.

* Removing debug print.

(cherry picked from commit 2321fa9)

* refactor: Better handling of node in Linux scripts. (#607)

Updated the way the bash script sets up the environment for node.
Node will only be installed if a version meeting the minimum requirements is not found.
The new environment should result in a more robust environment setup.

(cherry picked from commit f27bace)

* Fixing a small issue with how path was setup previously. (#611)

If the node install was installed locally previously the script would
not pick that up and try to install again. It would fail because the
directory already exists and then the path would not get properly setup
for the local install of node.
This change sets PATH to point to the local install anyway. If it doesn't
exist it doesn't matter, if it does exist we use the local install.

(cherry picked from commit 00aaa52)

* Added disable button when session test is running

* Added new flag ?LatencyCSV to enable the session test and its UI

* Added changeset for 4.27 support and session test feature

---------

Co-authored-by: Will Belcher <william.belcher@xa.epicgames.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: mcottontensor <80377552+mcottontensor@users.noreply.github.com>
github-actions bot added a commit that referenced this pull request May 29, 2025
… support (#647)

* Add 4.27 support back for latency testing

* Save webrtc stats to csv and auto download

* Deep copy stats object

* Update record parsing logic to handle missing field when generating the csv

* Update session test to handle additional latency stats

* Fixing path setup in the windows platform scripts. (#594) (#595)

(cherry picked from commit 152abd6)

Co-authored-by: mcottontensor <80377552+mcottontensor@users.noreply.github.com>
(cherry picked from commit 1dedc87)

* Fixing more path issues in platform_scripts (#604)

* feat: Adding script tests where the scripts are run multiple times.

This tests that the scripts still work when things have already been
installed.

* fix: Fixing typo in github action.

* gimme a break.

* Adding mutliple script runs for other OSs

* Testing node on the runner

* Trying to figure out what node is doing what.

* Trying to change the way node version is detected.

* Messy

* The additions to the script really didn't catch anything. Could be worth
revisiting how we handle the local node install.

* Removing debug print.

(cherry picked from commit 2321fa9)

* refactor: Better handling of node in Linux scripts. (#607)

Updated the way the bash script sets up the environment for node.
Node will only be installed if a version meeting the minimum requirements is not found.
The new environment should result in a more robust environment setup.

(cherry picked from commit f27bace)

* Fixing a small issue with how path was setup previously. (#611)

If the node install was installed locally previously the script would
not pick that up and try to install again. It would fail because the
directory already exists and then the path would not get properly setup
for the local install of node.
This change sets PATH to point to the local install anyway. If it doesn't
exist it doesn't matter, if it does exist we use the local install.

(cherry picked from commit 00aaa52)

* Added disable button when session test is running

* Added new flag ?LatencyCSV to enable the session test and its UI

* Added changeset for 4.27 support and session test feature

---------

Co-authored-by: Will Belcher <william.belcher@xa.epicgames.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: mcottontensor <80377552+mcottontensor@users.noreply.github.com>
(cherry picked from commit c61fd7b)
mcottontensor added a commit that referenced this pull request May 29, 2025
… support (#647) (#651)

* Add 4.27 support back for latency testing

* Save webrtc stats to csv and auto download

* Deep copy stats object

* Update record parsing logic to handle missing field when generating the csv

* Update session test to handle additional latency stats

* Fixing path setup in the windows platform scripts. (#594) (#595)

(cherry picked from commit 152abd6)


(cherry picked from commit 1dedc87)

* Fixing more path issues in platform_scripts (#604)

* feat: Adding script tests where the scripts are run multiple times.

This tests that the scripts still work when things have already been
installed.

* fix: Fixing typo in github action.

* gimme a break.

* Adding mutliple script runs for other OSs

* Testing node on the runner

* Trying to figure out what node is doing what.

* Trying to change the way node version is detected.

* Messy

* The additions to the script really didn't catch anything. Could be worth
revisiting how we handle the local node install.

* Removing debug print.

(cherry picked from commit 2321fa9)

* refactor: Better handling of node in Linux scripts. (#607)

Updated the way the bash script sets up the environment for node.
Node will only be installed if a version meeting the minimum requirements is not found.
The new environment should result in a more robust environment setup.

(cherry picked from commit f27bace)

* Fixing a small issue with how path was setup previously. (#611)

If the node install was installed locally previously the script would
not pick that up and try to install again. It would fail because the
directory already exists and then the path would not get properly setup
for the local install of node.
This change sets PATH to point to the local install anyway. If it doesn't
exist it doesn't matter, if it does exist we use the local install.

(cherry picked from commit 00aaa52)

* Added disable button when session test is running

* Added new flag ?LatencyCSV to enable the session test and its UI

* Added changeset for 4.27 support and session test feature

---------




(cherry picked from commit c61fd7b)

Co-authored-by: Luke Bermingham <1215582+lukehb@users.noreply.github.com>
Co-authored-by: Will Belcher <william.belcher@xa.epicgames.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: mcottontensor <80377552+mcottontensor@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Used to specify we want a PR to auto backport to a branch, must be paired with auto-backport-to-UEX. auto-backport-to-LatencyTest auto-backport-to-UE5.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants