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

Rust-based stats server on fly.io #165

Merged
merged 33 commits into from
Sep 9, 2024
Merged

Rust-based stats server on fly.io #165

merged 33 commits into from
Sep 9, 2024

Conversation

alsuren
Copy link
Collaborator

@alsuren alsuren commented Mar 4, 2023

working towards #164

To test what I have done so far (forwarding from vercel to fly.io and logging query params):

I have made a start on a public dashboard at https://alsuren.grafana.net/public-dashboards/12d4ec3edf2548a1850a813e00592b53 . I think I might make a public cargo-bins org with a shared login or something, so we can play about with it more freely.

TODO:

  • make the existing stats server proxy http requests onto another stats server that we can all mess about with (or fan out and give everyone their own "staging" server?)
    • probably urlencode things, like /record-install?crate=$crate&version=$version&arch=$arch&client=$client
  • (copy-pasta from from switch to hosted influxdb for stats #164):
    • (optional) make the existing stats server proxy http requests onto another stats server that we can all mess about with (or fan out and give everyone their own "staging" server?)
    • write stats to influxdb using the http api
  • add people to the org
  • dump things into influx
  • make get-stats.sh do a thing
  • deploy on merge to main
  • think about branch deploys?
  • ...

server/fly.io/Dockerfile Outdated Show resolved Hide resolved
server/fly.io/src/main.rs Outdated Show resolved Hide resolved
server/fly.io/Cargo.toml Outdated Show resolved Hide resolved
server/fly.io/Cargo.toml Outdated Show resolved Hide resolved
server/fly.io/src/main.rs Outdated Show resolved Hide resolved
server/fly.io/Dockerfile Outdated Show resolved Hide resolved
server/fly.io/Cargo.toml Outdated Show resolved Hide resolved
server/fly.io/src/main.rs Outdated Show resolved Hide resolved
server/fly.io/src/main.rs Outdated Show resolved Hide resolved
server/fly.io/src/main.rs Outdated Show resolved Hide resolved
server/fly.io/src/main.rs Outdated Show resolved Hide resolved
server/fly.io/Cargo.toml Outdated Show resolved Hide resolved
server/fly.io/src/main.rs Outdated Show resolved Hide resolved
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
axum = "0.6.10"
influx_db_client = "^0.5.0"
influxrs = "2.0.1"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

placeholder to think about ijagberg/influx#4 at some point. This might involve forking their repo temporarily and deploying from the fork

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oh you know what? it might be a problem with how the js server is encoding the url params?

(still not looked into it properly though)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in ijagberg/influx#5 . Depending on my fork for now.

edition = "2021"

# Make a new workspace so that we get our own Cargo.lock and target dir for the docker build.
[workspace]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For some reason my vscode is no longer giving any hints for anything in this folder unless I explicitly open only this folder in its own instance. I'm sure it worked before, and for other projects, but I can't remember what I did last time.

Probably I will merge this as is, but if this causes problems for anyone else then tell me and I'll try to address it properly.

@alsuren alsuren marked this pull request as ready for review September 8, 2024 15:28
@alsuren alsuren changed the title WIP: Rust-based stats server on fly.io Rust-based stats server on fly.io Sep 8, 2024
@alsuren alsuren temporarily deployed to stats server production September 8, 2024 15:59 — with GitHub Actions Inactive
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Roughly following https://fly.io/docs/launch/continuous-deployment-with-github-actions/ but using an environment to hold the secret, so you can only access the fly secret if you can push to main.

This was tested on a previous commit.

Logs exist here: https://github.com/cargo-bins/cargo-quickinstall/actions/runs/10761262315/job/29840247483?pr=165

stats-server/Cargo.toml Show resolved Hide resolved
Co-authored-by: Jiahao XU <[email protected]>
Signed-off-by: David Laban <[email protected]>
@NobodyXu NobodyXu merged commit c42d7cd into main Sep 9, 2024
33 checks passed
@NobodyXu NobodyXu deleted the rust-stats-server branch September 9, 2024 10:07
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.

2 participants