-
Notifications
You must be signed in to change notification settings - Fork 4
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
Create a stats endpoint to stream server data over websocket to frontend clients #2
Comments
Hi I am new to rust language, however I would love to contribute to this PR can you please guide me? |
Hey @ChellappanRajan welcome to the project :) Would suggest you to go over basics of rust for sometime. You can refer to official rust docs as well as some YT channels for picking up the basics of rust, not much advanced concepts are required as of now. The web framework we're using in the project is The task deals with implementing a websocket endpoint for stats(server statistics) that the frontend clients can connect to, to get the server data in realtime. This stats can be anything like memory usage, cpu usage, load average, open file descriptors. We can initially limit this to couple of things only. One example is present in the For local setup, the instructions are present in the README.md. You'll need to install rust on your system, Linux and macOS are preferable for the setup. Do drop a star on the repo, if you like the project, that'd be helpful :) |
Thanks for the explanation. I wil check and get back to you. |
Hi I tried to run this app on my local machine getting below error, Could you please help to resolve this?
|
You'll need to export few environment variables, when the app or the crate runs, it expects these values to be present in the environment in which it's running, whether a linux/macOS machine or a container. You can set those environment variables by running following commands in your terminal. export SERVER_ADDR=localhost:8082
export PG__USER=PG_USERNAME
export PG__PASSWORD=PG_PASSWORD
export PG__HOST=PG_HOST_URL
export PG__PORT=5432
export PG__DBNAME=PG_DB_NAME
export PG__POOL__MAX_SIZE=20
export BASE_ADDR=http://localhost:8082
|
Thanks able to run it now. Is this crates only supported for windows? |
Great! Crate is supported on all platforms |
when I open this page http://localhost:8082/stats in browser getting below error in terminal
|
Oh yeah, the underlying crate which provides the machine data doesn't have full support for all functions in all OSes. So on macOS, a lot of functions will not work. Workaround is to use Docker to run it. I have a sample $ docker build -t x-server-stats .
$ docker run -p 8082:8082 x-server-stats Since the docker image will linux based, you'd see the correct cpu load value in your browser, and no error in your console. We need to look at another package for a better support, I guess sysinfo, will have a better support for macOS as well, need to try it out. Currently, development cycle would look like write code -> run it -> fix error and issues -> build the docker image -> run it. |
@ChellappanRajan Do let me know if you're facing any more issues. On a side note, I'd suggest to start with the issue #5 first, since it'll just require a little bit of tinkering with the existing code to complete. |
Hi @xamfy Since I am new to rust it's taking a lot of time. Currently I am trying to understand the existing code and going through the creates documentation which x-server-stats using. |
No description provided.
The text was updated successfully, but these errors were encountered: