Skip to content

Store build logs in S3 #1214

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

Merged
merged 5 commits into from
Dec 29, 2020
Merged

Store build logs in S3 #1214

merged 5 commits into from
Dec 29, 2020

Conversation

Nemo157
Copy link
Member

@Nemo157 Nemo157 commented Dec 22, 2020

This is a first step on the path to #787

The first 4 commits are refactoring, adding tests for the builds list and build logs and splitting them into separate handlers and templates (I don't think there's much benefit to having the list of other builds below the log, and it makes the code simpler to reason about).

The last commit adds support for rendering the build log from either database or S3, and changes the build process to upload to S3.

The next step would be to migrate existing build logs from the database to S3 so we can delete the code checking for both. Then thread the build logs for other targets through and upload and render them all.

We could also consider bumping the max build log size up, which would allow reverting #1192 if having verbose logs would be useful.

@jyn514 jyn514 added A-builds Area: Building the documentation for a crate S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed labels Dec 24, 2020
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

How does this behave for multiple builds? Will it show/store the additional logs? You answered this in the description, sorry.

Comment on lines 135 to 140
assert!(
!successful,
"default is success, can only override to failure"
);
assert!(
self.builds.is_empty(),
"cannot use custom builds with build_result_successful"
);
Copy link
Member

Choose a reason for hiding this comment

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

This is a good idea, we should add more assertions like this :) I'll work on that.

In the meantime though, since the boolean has to be false, can you statically enforce that by not taking a parameter and changing the name to build_result_failed?


let value: serde_json::Value = serde_json::from_str(
&env.frontend()
.get("/crate/foo/0.1.0/builds.json")
Copy link
Member

Choose a reason for hiding this comment

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

This seems like a misfeature. Is anyone actually using this?

@pietroalbini what do you think about just removing this? It seems silly to have exactly one page that has JSON available, especially since you need to know the version ahead of time.

Copy link
Member

Choose a reason for hiding this comment

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

That endpoint is used by crates.io.

@jyn514
Copy link
Member

jyn514 commented Dec 25, 2020

The next step would be to migrate existing build logs from the database to S3 so we can delete the code checking for both. Then thread the build logs for other targets through and upload and render them all.

We should decide if we want to support running docs.rs in prod without the database (we shouldn't be special casing build logs when documentation can still be stored in the DB). Since we have min.io for testing locally and all our data in prod is in S3, I guess there's no real reason to keep the DB support around? @pietroalbini what do you think?

@jyn514
Copy link
Member

jyn514 commented Dec 25, 2020

the test failed: failed to get a database connection
caused by: timed out waiting for connection: db error: FATAL: sorry, too many clients already

Ugh, I'll review #1216.

Do you know why it only failed here? It's been working fine on other PRs ...

@Nemo157
Copy link
Member Author

Nemo157 commented Dec 25, 2020

The next step would be to migrate existing build logs from the database to S3 so we can delete the code checking for both. Then thread the build logs for other targets through and upload and render them all.

We should decide if we want to support running docs.rs in prod without the database (we shouldn't be special casing build logs when documentation can still be stored in the DB). Since we have min.io for testing locally and all our data in prod is in S3, I guess there's no real reason to keep the DB support around? @pietroalbini what do you think?

Well, I say S3, but I actually mean "the configured storage", so in tests they're still stored in the DB, just in the files table instead.

@Nemo157
Copy link
Member Author

Nemo157 commented Dec 25, 2020

the test failed: failed to get a database connection

caused by: timed out waiting for connection: db error: FATAL: sorry, too many clients already

Ugh, I'll review #1216.

Do you know why it only failed here? It's been working fine on other PRs ...

3 new web tests may have just put it over the limit.

@pietroalbini
Copy link
Member

We should decide if we want to support running docs.rs in prod without the database (we shouldn't be special casing build logs when documentation can still be stored in the DB). Since we have min.io for testing locally and all our data in prod is in S3, I guess there's no real reason to keep the DB support around?

This doesn't use S3 directly, it uses Storage, which also has a database backend.

@jyn514 jyn514 merged commit df48965 into rust-lang:master Dec 29, 2020
@Nemo157 Nemo157 deleted the logs-to-s3 branch May 31, 2023 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-builds Area: Building the documentation for a crate S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants