diff --git a/Dockerfile b/Dockerfile index 7dd4de4e..039d0452 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ ENV SQLX_OFFLINE true # Build the project RUN echo "Building with features: ${FEATURES}" -RUN cargo build --profile=profiling --features "${FEATURES}" --bin appflowy_cloud +RUN cargo build --profile=release --features "${FEATURES}" --bin appflowy_cloud FROM debian:bookworm-slim AS runtime @@ -33,7 +33,7 @@ RUN apt-get update -y \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* -COPY --from=builder /app/target/profiling/appflowy_cloud /usr/local/bin/appflowy_cloud +COPY --from=builder /app/target/release/appflowy_cloud /usr/local/bin/appflowy_cloud ENV APP_ENVIRONMENT production ENV RUST_BACKTRACE 1 CMD ["appflowy_cloud"] diff --git a/src/api/file_storage.rs b/src/api/file_storage.rs index ba9ee47c..cbe4231f 100644 --- a/src/api/file_storage.rs +++ b/src/api/file_storage.rs @@ -19,7 +19,7 @@ use std::pin::Pin; use tokio::io::{AsyncRead, AsyncReadExt}; use tokio_stream::StreamExt; use tokio_util::io::StreamReader; -use tracing::{event, instrument}; +use tracing::{error, event, instrument}; use crate::state::AppState; @@ -59,7 +59,12 @@ async fn put_blob_handler( let mut payload_reader = payload_to_async_read(payload); let mut content = vec![0; content_length]; let n = payload_reader.read_exact(&mut content).await?; - assert_eq!(n, content_length); + if n != content_length { + error!( + "Content length is {}, but the actual content is larger", + content_length + ); + } let res = payload_reader.read_u8().await; match res { Ok(_) => { diff --git a/src/application.rs b/src/application.rs index 32bef9a0..297cca90 100644 --- a/src/application.rs +++ b/src/application.rs @@ -43,7 +43,7 @@ use std::net::TcpListener; use std::sync::Arc; use std::time::Duration; use tokio::sync::RwLock; -use tracing::info; +use tracing::{info, warn}; pub struct Application { port: u16, @@ -305,8 +305,11 @@ async fn setup_admin_account( .await .context("failed to update the admin user")?; - assert_eq!(result.rows_affected(), 1); - info!("Admin user created and set role to supabase_admin"); + if result.rows_affected() != 1 { + warn!("Failed to update the admin user"); + } else { + info!("Admin user created and set role to supabase_admin"); + } Ok(gotrue_admin) },