Skip to content

Commit

Permalink
Update dependencies and Rust Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
rkudryashov committed May 18, 2024
1 parent 59475ec commit 13d6537
Show file tree
Hide file tree
Showing 15 changed files with 1,918 additions and 1,231 deletions.
3,008 changes: 1,847 additions & 1,161 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"auth-service",
"planets-service",
Expand Down
26 changes: 13 additions & 13 deletions auth-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ edition = "2021"

[dependencies]
common-utils = { path = "../common-utils" }
async-graphql = "6.0.7"
async-graphql-actix-web = "6.0.7"
actix-web = "4.4.0"
async-graphql = "7.0.5"
async-graphql-actix-web = "7.0.5"
actix-web = "4.5.1"
actix-rt = "2.9.0"
serde = { version = "1.0.188", features = ["derive"] }
diesel = { version = "2.1.1", features = ["postgres", "r2d2"] }
serde = { version = "1.0.202", features = ["derive"] }
diesel = { version = "2.1.6", features = ["postgres", "r2d2"] }
diesel_migrations = "2.1.0"
dotenv = "0.15.0"
jsonwebtoken = "8.3.0"
argon2 = "0.5.2"
chrono = "0.4.31"
jsonwebtoken = "9.3.0"
argon2 = "0.5.3"
chrono = "0.4.38"
lazy_static = "1.4.0"
strum = "0.25.0"
strum_macros = "0.25.2"
strum = "0.26.2"
strum_macros = "0.26.2"

[dev-dependencies]
serde_json = "1.0.107"
serde_json = "1.0.117"
jsonpath_lib = "0.3.0"
base64 = "0.21.4"
testcontainers = "0.14.0"
base64 = "0.22.1"
testcontainers = "0.16.7"
2 changes: 1 addition & 1 deletion auth-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.72.1 as builder
FROM rust:1.78.0 as builder

ENV CARGO_TERM_COLOR always
RUN apt-get update && apt-get install -y libpq-dev
Expand Down
1 change: 0 additions & 1 deletion auth-service/src/graphql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ impl RoleGuard {
}
}

#[async_trait::async_trait]
impl Guard for RoleGuard {
async fn check(&self, ctx: &Context<'_>) -> Result<()> {
let maybe_getting_role_result = ctx.data_opt::<Result<Option<AuthRole>, CustomError>>();
Expand Down
8 changes: 4 additions & 4 deletions common-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Roman Kudryashov <rskudryashov@gmail.com>"]
edition = "2021"

[dependencies]
actix-web = "4.4.0"
serde = { version = "1.0.188", features = ["derive"] }
strum = "0.25.0"
strum_macros = "0.25.2"
actix-web = "4.5.1"
serde = { version = "1.0.202", features = ["derive"] }
strum = "0.26.2"
strum_macros = "0.26.2"
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
ports:
- "8001:8080"
planets-db:
image: postgres:15.1-alpine
image: postgres:16.3
container_name: planets-db
restart: always
environment:
Expand Down Expand Up @@ -53,7 +53,7 @@ services:
ports:
- "8002:8080"
satellites-db:
image: postgres:15.1-alpine
image: postgres:16.3
container_name: satellites-db
restart: always
environment:
Expand Down Expand Up @@ -86,7 +86,7 @@ services:
ports:
- "8003:8080"
users-db:
image: postgres:15.1-alpine
image: postgres:16.3
container_name: users-db
restart: always
environment:
Expand Down
22 changes: 11 additions & 11 deletions gateway/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ edition = "2021"

[dependencies]
common-utils = { path = "../common-utils" }
apollo-router = "1.30.1"
anyhow = "1.0.75"
async-trait = "0.1.73"
futures = "0.3.28"
schemars = "0.8.15"
jsonwebtoken = "8.3.0"
serde = "1.0.188"
serde_json = "1.0.107"
tokio = { version = "1.32.0", features = ["full"] }
apollo-router = "1.46.0"
anyhow = "1.0.85"
async-trait = "0.1.80"
futures = "0.3.30"
schemars = "0.8.19"
jsonwebtoken = "9.3.0"
serde = "1.0.202"
serde_json = "1.0.117"
tokio = { version = "1.37.0", features = ["full"] }
tower = { version = "0.4.13", features = ["full"] }
tracing = "0.1.37"
http = "0.2.9"
tracing = "0.1.40"
http = "1.1.0"
dotenv = "0.15.0"
2 changes: 1 addition & 1 deletion gateway/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.72.1 as builder
FROM rust:1.76.0 as builder

ENV CARGO_TERM_COLOR always
RUN apt-get update && apt-get install -y protobuf-compiler cmake
Expand Down
20 changes: 12 additions & 8 deletions gateway/src/jwt_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,24 @@ impl Plugin for JwtValidation {
.extension_code("AUTH_ERROR")
.build(),
)
.status_code(status)
// TODO: don't know why by the commented line doesn't compile
// .status_code(Some(status))
.context(context)
.build()?;
Ok(ControlFlow::Break(response))
}

let handler = move |request: supergraph::Request| {
let auth_header_value_result =
match request.supergraph_request.headers().get(AUTHORIZATION) {
Some(auth_header_value) => auth_header_value.to_str(),
// in this project, I decided to allow the passage of requests without the AUTHORIZATION header. then each subgraph performs authorization based on the ROLE header
// your case may be different. be careful
None => return Ok(ControlFlow::Continue(request)),
};
let auth_header_value_result = match request
.supergraph_request
.headers()
.get(AUTHORIZATION.as_str())
{
Some(auth_header_value) => auth_header_value.to_str(),
// in this project, I decided to allow the passage of requests without the AUTHORIZATION header. then each subgraph performs authorization based on the ROLE header
// your case may be different. be careful
None => return Ok(ControlFlow::Continue(request)),
};

let auth_header_value_untrimmed = match auth_header_value_result {
Ok(auth_header_value) => auth_header_value,
Expand Down
27 changes: 13 additions & 14 deletions planets-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,24 @@ edition = "2021"

[dependencies]
common-utils = { path = "../common-utils" }
async-graphql = { version = "6.0.7", features = ["dataloader"] }
async-graphql-actix-web = "6.0.7"
actix-web = "4.4.0"
async-graphql = { version = "7.0.5", features = ["dataloader"] }
async-graphql-actix-web = "7.0.5"
actix-web = "4.5.1"
actix-rt = "2.9.0"
actix-web-actors = "4.2.0"
futures = "0.3.28"
async-trait = "0.1.73"
bigdecimal = { version = "0.4.1", features = ["serde"] }
serde = { version = "1.0.188", features = ["derive"] }
serde_json = "1.0.107"
diesel = { version = "2.1.1", features = ["postgres", "r2d2", "numeric"] }
actix-web-actors = "4.3.0"
futures = "0.3.30"
bigdecimal = { version = "0.4.3", features = ["serde"] }
serde = { version = "1.0.202", features = ["derive"] }
serde_json = "1.0.117"
diesel = { version = "2.1.6", features = ["postgres", "r2d2", "numeric"] }
diesel_migrations = "2.1.0"
dotenv = "0.15.0"
strum = "0.25.0"
strum_macros = "0.25.2"
rdkafka = { version = "0.34.0", features = ["cmake-build"] }
strum = "0.26.2"
strum_macros = "0.26.2"
rdkafka = { version = "0.36.2", features = ["cmake-build"] }
async-stream = "0.3.5"
lazy_static = "1.4.0"

[dev-dependencies]
jsonpath_lib = "0.3.0"
testcontainers = "0.14.0"
testcontainers = "0.16.7"
2 changes: 1 addition & 1 deletion planets-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.72.1 as builder
FROM rust:1.78.0 as builder

ENV CARGO_TERM_COLOR always
RUN apt-get update && apt-get install -y libpq-dev cmake
Expand Down
2 changes: 0 additions & 2 deletions planets-service/src/graphql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ pub struct DetailsLoader {
pub pool: Arc<PgPool>,
}

#[async_trait::async_trait]
impl Loader<i32> for DetailsLoader {
type Value = Details;
type Error = Error;
Expand All @@ -329,7 +328,6 @@ impl RoleGuard {
}
}

#[async_trait::async_trait]
impl Guard for RoleGuard {
async fn check(&self, ctx: &Context<'_>) -> Result<()> {
// TODO: auth disabling is needed for tests. try to reimplement when https://github.com/rust-lang/rust/issues/45599 will be resolved (using cfg(test))
Expand Down
20 changes: 10 additions & 10 deletions satellites-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ authors = ["Roman Kudryashov <rskudryashov@gmail.com>"]
edition = "2021"

[dependencies]
async-graphql = { version = "6.0.7", features = ["chrono"] }
async-graphql-actix-web = "6.0.7"
actix-web = "4.4.0"
async-graphql = { version = "7.0.5", features = ["chrono"] }
async-graphql-actix-web = "7.0.5"
actix-web = "4.5.1"
actix-rt = "2.9.0"
serde = { version = "1.0.188", features = ["derive"] }
diesel = { version = "2.1.1", features = ["postgres", "r2d2", "chrono"] }
serde = { version = "1.0.202", features = ["derive"] }
diesel = { version = "2.1.6", features = ["postgres", "r2d2", "chrono"] }
diesel_migrations = "2.1.0"
chrono = { version = "0.4.31", features = ["serde"] }
chrono = { version = "0.4.38", features = ["serde"] }
dotenv = "0.15.0"
strum = "0.25.0"
strum_macros = "0.25.2"
strum = "0.26.2"
strum_macros = "0.26.2"

[dev-dependencies]
serde_json = "1.0.107"
serde_json = "1.0.117"
jsonpath_lib = "0.3.0"
testcontainers = "0.14.0"
testcontainers = "0.16.7"
2 changes: 1 addition & 1 deletion satellites-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.72.1 as builder
FROM rust:1.78.0 as builder

ENV CARGO_TERM_COLOR always
RUN apt-get update && apt-get install -y libpq-dev
Expand Down

0 comments on commit 13d6537

Please sign in to comment.