Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to TypeScript and express & Add stats API #1

Merged
merged 18 commits into from
Jul 2, 2023
Merged

Switch to TypeScript and express & Add stats API #1

merged 18 commits into from
Jul 2, 2023

Conversation

TSRBerry
Copy link
Member

@TSRBerry TSRBerry commented May 31, 2023

This should be the last thing that needs to be done before we can make this repo public.

Deployment notes

@marysaka make sure to block public access to /info, it's just intended for health checks that could be used by a Kubernetes cluster for example. I wanted to add health checks for Docker as well, but we can only use commands for that and the node image does not have curl.

Overview

The change to TypeScript was done for the server code, so it's easier to maintain. The static website code is still plain JavaScript as I didn't want to change too many things at once and the main goal of this PR was to get the stats API working again.

I also decided to use pnpm instead of npm for package management, since it's a lot faster and feels a little more modern.
In case dependabot creates update PRs a workflow will be triggered to update the pnpm-lock.yaml as well, so it shouldn't break due to dependency updates. (Dependabot now natively supports pnpm as well.)

API changes

The new API is now using express and a Redis client to read the data provided by the LDN server.

Since the website and the LDN server have been split we needed to come up with a new way to provide stats for the website.
The API itself changed minimally and only in places where it was possible without breaking existing Ryujinx LDN builds.

The LDN server has already been adapted to write the data into a Redis database nearly in real time.

Possible future changes

Since we are now using express and TypeScript we can polish this website a lot more and potentially get rid of all the JavaScript with the help of a template engine like EJS.
By opening this repository to the public we might also see some external contributors with new ideas, so I hope these changes also make it easy to work with the website and won't be a hindrance to anyone who is interested.

@TSRBerry
Copy link
Member Author

TSRBerry commented Jun 9, 2023

I can't request more than one reviewer at a time in a private repository, so I'll just ping @Ryujinx/developers and hope you'll take a look. :D

Copy link
Member

@riperiperi riperiperi left a comment

Choose a reason for hiding this comment

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

Looks sensible, just one comment.

package.json Outdated Show resolved Hide resolved
@TSRBerry
Copy link
Member Author

Copy link
Member

@riperiperi riperiperi left a comment

Choose a reason for hiding this comment

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

Looks good here.

@TSRBerry TSRBerry requested a review from marysaka June 14, 2023 12:15
@TSRBerry TSRBerry changed the title [WIP] Switch to TypeScript and express & Add stats API Switch to TypeScript and express & Add stats API Jun 21, 2023
@TSRBerry
Copy link
Member Author

@riperiperi the latest changes were made for better Nix compatibility. Since these changes are now finished, feel free to take a look and review these as well.

@TSRBerry TSRBerry merged commit d0ab84a into master Jul 2, 2023
4 checks passed
@TSRBerry TSRBerry deleted the dev branch July 2, 2023 02:05
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.

None yet

3 participants