Skip to content

Commit

Permalink
chore: release (#18)
Browse files Browse the repository at this point in the history
* doc: correct image link

* chore: upgrade deps

* chore: upgrade depsq

---------

Co-authored-by: Thomas Hoppe <[email protected]>
  • Loading branch information
github-actions[bot] and vanthome authored Oct 30, 2024
1 parent b3d8881 commit f7eed59
Show file tree
Hide file tree
Showing 11 changed files with 864 additions and 764 deletions.
1,545 changes: 821 additions & 724 deletions Cargo.lock

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
[package]
name = "pdf-rendering-srv"
version = "0.1.0"
version = "0.1.2"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread", "rt", "full"] }
prost = "0.12.3"
headless_chrome = "1.0.9"
tonic = "0.11.0"
prost-types = "0.12.3"
tokio-stream = "0.1.15"
tokio = { version = "1.41.0", features = ["macros", "rt-multi-thread", "rt", "full"] }
prost = "0.13.3"
headless_chrome = "1.0.15"
tonic = "0.12.3"
prost-types = "0.13.3"
tokio-stream = "0.1.16"
tiny_http = "0.12.0"
tonic-reflection = "0.11.0"
tonic-health = "0.11.0"
anyhow = "1.0.75"
log = "0.4.20"
env_logger = "0.11.3"
config = "0.14.0"
aws-sdk-s3 = "1.22.0"
aws-sdk-config = "1.20.0"
aws-smithy-runtime-api = "1.3.0"
lopdf = "0.32.0"
serde_json = "1.0.116"
serde = { version = "1.0.198", features = ["derive"] }
prost-wkt-types = "0.5.1"
ulid = "1.1.2"
tonic-reflection = "0.12.3"
tonic-health = "0.12.3"
anyhow = "1.0.91"
log = "0.4.22"
env_logger = "0.11.5"
config = "0.14.1"
aws-sdk-s3 = "1.58.0"
aws-sdk-config = "1.49.0"
aws-smithy-runtime-api = "1.7.2"
lopdf = "0.34.0"
serde_json = "1.0.132"
serde = { version = "1.0.214", features = ["derive"] }
prost-wkt-types = "0.6.0"
ulid = "1.1.3"

[build-dependencies]
tonic-build = "0.11.0"
reqwest = { version = "0.12.0", features = ["blocking", "json"] }
flate2 = "1.0.28"
tar = "0.4.40"
tonic-build = "0.12.3"
reqwest = { version = "0.12.9", features = ["blocking", "json"] }
flate2 = "1.0.34"
tar = "0.4.42"
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM lukemathwalker/cargo-chef:latest-rust-1.77-alpine AS planner
FROM lukemathwalker/cargo-chef:latest-rust-1.82-alpine AS planner
WORKDIR /app
COPY . .
RUN cargo chef prepare --recipe-path recipe.json


FROM rust:1.77.2-alpine as build
FROM rust:1.82-alpine as build

RUN rustup target add x86_64-unknown-linux-musl
RUN apk add --no-cache build-base pkgconfig dbus-dev libressl-dev protoc protobuf-dev
Expand Down
4 changes: 3 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
- PDF/A support
- Proxy support for downloads
- Content caching
- Add docs also explaining how to add fonts
- ~~Add docs also explaining how to add fonts~~
- ~~Info endpoint that provides chrome version~~
- ~~Modify PDF meta data~~
- Emit Kafka event on successful render/ upload
- ~~Batch rendering of multiple documents~~
- ~~Add logging~~
- Store objects via Ostorage service instead of S3 directly
- return the actual URL instead of n/a when the object is stored
4 changes: 2 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.extern_path(".google.protobuf", "::prost_wkt_types")
.type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]")
.file_descriptor_set_path(Path::new(&out_dir).join("proto_fd.bin"))
.compile(
.compile_protos(
&[Path::new(&proto_path).join("pdf_rendering.proto").clone()],
&[Path::new(&relative_path).join("package/")],
)?;
Expand Down Expand Up @@ -80,7 +80,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
)
.extern_path(".google.protobuf", "::prost_wkt_types")
.type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]")
.compile(&paths, &[Path::new(&relative_path).join("package/")])?;
.compile_protos(&paths, &[Path::new(&relative_path).join("package/")])?;

Ok(())
}
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ A microservice for rendering PDFs from HTML using the Chromium browser.
----

renders like this in PDF:
link:https://github.com/restorecommerce/pdf-rendering-srv/blob/master/docs/modules/ROOT/assets/images/fonts.png[fonts.png].
image:https://github.com/restorecommerce/pdf-rendering-srv/blob/master/docs/modules/ROOT/assets/images/fonts.png[fonts.png].

[#usage]
== Usage
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async fn main() -> Result<(), Box<dyn Error>> {

let reflection_service = tonic_reflection::server::Builder::configure()
.register_encoded_file_descriptor_set(proto::pdf_rendering::FILE_DESCRIPTOR_SET)
.build()
.build_v1()
.unwrap();

let (mut health_reporter, health_service) = tonic_health::server::health_reporter();
Expand Down
2 changes: 1 addition & 1 deletion src/pdf_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ pub fn add_pdf_metadata(file: Vec<u8>, meta: Option<MetaData>) -> std::io::Resul

document
.save_to(&mut memory_cursor)
.expect("failed saving pdf");
.expect("failed saving PDF");

memory_cursor.flush().expect("failed flushing");

Expand Down
2 changes: 1 addition & 1 deletion src/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub async fn upload_to_s3(
}

#[derive(Debug, Default, Serialize)]
struct Resource {
pub struct Resource {
id: String,
key: String,
bucket: String,
Expand Down
12 changes: 6 additions & 6 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl PDFServer {
status: Some(status::Status {
id: None,
code: Some(400),
message: Some(format!("render failed: {}", err)),
message: Some(format!("rendering failed: {}", err)),
}),
payload: None,
});
Expand Down Expand Up @@ -160,7 +160,7 @@ impl PDFServer {

Response::new(RenderingResponse {
operation_status: Some(OperationStatus {
code: Some(0),
code: Some(200),
message: Some("success".to_string()),
}),
response: Some(rendering_response::Response::Individual(
Expand Down Expand Up @@ -188,7 +188,7 @@ impl PDFServer {
Err(err) => {
panic!("missing pdf: {}", err)
}
Ok(response) => Document::load_mem(response).expect("failed parsing pdf"),
Ok(response) => Document::load_mem(response).expect("failed parsing PDF"),
},
})
.collect(),
Expand All @@ -202,7 +202,7 @@ impl PDFServer {

Response::new(RenderingResponse {
operation_status: Some(OperationStatus {
code: Some(0),
code: Some(200),
message: Some("success".to_string()),
}),
response: Some(rendering_response::Response::Combined(
Expand Down Expand Up @@ -235,7 +235,7 @@ impl PDFServer {
Ok(_) => ResponsePayloadWithStatus {
status: Some(status::Status {
id: None,
code: Some(0),
code: Some(200),
message: Some("success".to_string()),
}),
payload: Some(ResponsePayload {
Expand All @@ -260,7 +260,7 @@ impl PDFServer {
ResponsePayloadWithStatus {
status: Some(status::Status {
id: None,
code: Some(0),
code: Some(200),
message: Some("success".to_string()),
}),
payload: Some(ResponsePayload {
Expand Down
1 change: 1 addition & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub struct RendererResponse {
pub order: usize,
}

#[derive(Copy, Clone)]
pub struct IDExtension {
pub id: ulid::Ulid,
}

0 comments on commit f7eed59

Please sign in to comment.