Skip to content

Commit

Permalink
ci: switch to using openssl-sys
Browse files Browse the repository at this point in the history
Also remove architecture stuff in build process.
  • Loading branch information
IgnisDa committed Jul 31, 2024
1 parent 66dff65 commit a508b88
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 61 deletions.
48 changes: 27 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ sea-orm = { version = "=1.0.0-rc.5", features = [
"debug-print",
"postgres-array",
"macros",
"runtime-tokio-rustls",
"runtime-tokio-native-tls",
"sqlx-postgres",
"with-chrono",
"with-json",
Expand Down
15 changes: 4 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN moon run frontend:build transactional:build
RUN moon docker prune

FROM --platform=$BUILDPLATFORM lukemathwalker/cargo-chef AS backend-chef
RUN apt-get update && apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross clang llvm ca-certificates
RUN apt-get update && apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross clang llvm ca-certificates pkg-config make g++ libssl-dev
RUN update-ca-certificates
WORKDIR app

Expand All @@ -32,7 +32,6 @@ RUN cargo chef prepare --recipe-path recipe.json

FROM backend-chef AS backend-builder
# build specific
ARG TARGETARCH
ARG BUILD_PROFILE=release
# application specific
ARG APP_VERSION
Expand All @@ -41,21 +40,15 @@ ARG DEFAULT_MAL_CLIENT_ID
RUN test -n "$APP_VERSION" && \
test -n "$DEFAULT_TMDB_ACCESS_TOKEN" && \
test -n "$DEFAULT_MAL_CLIENT_ID"
ENV RUST_TARGET_TRIPLE_arm64="aarch64-unknown-linux-gnu"
ENV RUST_TARGET_TRIPLE_amd64="x86_64-unknown-linux-gnu"
ENV TARGET_CC="clang"
ENV TARGET_AR="llvm-ar"
ENV CFLAGS_aarch64_unknown_linux_gnu="--sysroot=/usr/aarch64-linux-gnu"
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
COPY --from=backend-planner /app/recipe.json recipe.json
RUN rustup target add $(eval "echo \$RUST_TARGET_TRIPLE_$TARGETARCH")
RUN cargo chef cook --profile $BUILD_PROFILE --target $(eval "echo \$RUST_TARGET_TRIPLE_$TARGETARCH") --recipe-path recipe.json
RUN cargo chef cook --profile $BUILD_PROFILE --recipe-path recipe.json
COPY . .
COPY --from=frontend-builder /app/apps/backend/templates ./apps/backend/templates
RUN APP_VERSION=$APP_VERSION \
DEFAULT_TMDB_ACCESS_TOKEN=$DEFAULT_TMDB_ACCESS_TOKEN \
DEFAULT_MAL_CLIENT_ID=$DEFAULT_MAL_CLIENT_ID \
./apps/backend/ci/build-app.sh
cargo build --profile ${BUILD_PROFILE} --bin ryot
RUN cp -R /app/target/${BUILD_PROFILE}/ryot /app/ryot

FROM $NODE_BASE_IMAGE
LABEL org.opencontainers.image.source="https://github.com/IgnisDa/ryot"
Expand Down
7 changes: 1 addition & 6 deletions apps/backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ isolang = { version = "=2.4.0", features = ["list_languages"] }
itertools = "=0.13.0"
jsonwebtoken = { version = "=9.3.0", default-features = false }
kinded = "=0.3.0"
lettre = { version = "=0.11.7", features = [
"rustls-tls",
"smtp-transport",
"builder",
], default-features = false }
lettre = "=0.11.7"
markdown = "=1.0.0-alpha.18"
mime_guess = "=2.0.5"
nanoid = { workspace = true }
Expand All @@ -60,7 +56,6 @@ regex = "=1.10.5"
# FIXME: Upgrade once https://github.com/seanmonstar/reqwest/pull/1620 is merged
reqwest = { git = "https://github.com/thomasqueirozb/reqwest", branch = "base_url", features = [
"json",
"rustls-tls",
"stream",
], default-features = false }
rs-utils = { path = "../../libs/rs-utils" }
Expand Down
9 changes: 0 additions & 9 deletions apps/backend/ci/build-app.sh

This file was deleted.

7 changes: 4 additions & 3 deletions apps/backend/src/miscellaneous.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{
collections::{HashMap, HashSet},
fmt,
fs::File,
future::Future,
iter::zip,
Expand Down Expand Up @@ -583,9 +584,9 @@ struct ProgressUpdateCache {
manga_chapter_number: Option<i32>,
}

impl ToString for ProgressUpdateCache {
fn to_string(&self) -> String {
format!("{:#?}", self)
impl fmt::Display for ProgressUpdateCache {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:#?}", self)
}
}

Expand Down
3 changes: 1 addition & 2 deletions apps/backend/src/notification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,8 @@ impl NotificationPlatformSpecifics {
config.server.smtp.password.to_owned(),
);

let mailer = SmtpTransport::starttls_relay(&config.server.smtp.server)
let mailer = SmtpTransport::relay(&config.server.smtp.server)
.unwrap()
.port(config.server.smtp.port)
.credentials(credentials)
.build();

Expand Down
2 changes: 0 additions & 2 deletions apps/backend/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ pub struct AppServices {
pub media_service: Arc<MiscellaneousService>,
pub importer_service: Arc<ImporterService>,
pub exporter_service: Arc<ExporterService>,
pub file_storage_service: Arc<FileStorageService>,
pub exercise_service: Arc<ExerciseService>,
}

Expand Down Expand Up @@ -159,7 +158,6 @@ pub async fn create_app_services(
media_service,
importer_service,
exporter_service,
file_storage_service,
exercise_service,
}
}
Expand Down
3 changes: 0 additions & 3 deletions docs/includes/backend-config-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,6 @@ server:
# @envvar SERVER_SMTP_PASSWORD
password: ""

# @envvar SERVER_SMTP_PORT
port: 587

# @envvar SERVER_SMTP_SERVER
server: ""

Expand Down
2 changes: 0 additions & 2 deletions libs/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,6 @@ pub struct SchedulerConfig {
#[config(rename_all = "snake_case", env_prefix = "SERVER_SMTP_")]
pub struct SmtpConfig {
pub server: String,
#[setting(default = 587)]
pub port: u16,
pub user: String,
pub password: String,
#[setting(default = "Ryot <[email protected]>")]
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
profile = "default"
channel = "1.77.2"
channel = "1.80.0"

0 comments on commit a508b88

Please sign in to comment.