Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion crates/tower-cmd/src/util/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,16 @@ pub async fn upload_file_with_progress(
let metadata = file.metadata().await?;
let file_size = metadata.len();

// Create a stream with progress tracking
// Check if bundle size exceeds the maximum allowed size
if file_size > tower_package::MAX_BUNDLE_SIZE {
let size_mb = file_size as f64 / (1024.0 * 1024.0);
let max_mb = tower_package::MAX_BUNDLE_SIZE as f64 / (1024.0 * 1024.0);
output::die(&format!(
"Your App is too big! ({:.2} MB) exceeds maximum allowed size ({:.0} MB). Please consider reducing app size by removing unnecessary files or import_paths in the Towerfile.",
size_mb, max_mb
));
}

let reader_stream = ReaderStream::new(file);
let progress_stream =
util::progress::ProgressStream::new(reader_stream, file_size, progress_cb).await?;
Expand Down
4 changes: 4 additions & 0 deletions crates/tower-package/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ pub use error::Error;
// 3 - Change checksum algorithm to be cross-platform
const CURRENT_PACKAGE_VERSION: i32 = 3;

// Maximum allowed size for a bundle package in bytes (50MB)
// This limit ensures bundles remain manageable for deployment and storage.
pub const MAX_BUNDLE_SIZE: u64 = 50 * 1024 * 1024;

#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct Parameter {
pub name: String,
Expand Down
2 changes: 1 addition & 1 deletion crates/tower-runtime/tests/local_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async fn test_running_hello_world_json_logs() {
secrets: HashMap::new(),
parameters: HashMap::new(),
env_vars: HashMap::new(),
cache_dir: Some(config::default_cache_dir())
cache_dir: Some(config::default_cache_dir()),
};

// Start the app using the LocalApp runtime
Expand Down
40 changes: 22 additions & 18 deletions crates/tower-telemetry/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,22 +183,26 @@ fn create_fmt_layer(format: LogFormat, destination: LogDestination) -> BoxedFmtL

match destination {
LogDestination::Stdout => match format {
LogFormat::Plain => Box::new(fmt::layer().event_format(
fmt::format()
.pretty()
.with_target(false)
.with_file(false)
.with_line_number(false)
.with_ansi(use_color)
)),
LogFormat::Json => Box::new(fmt::layer().event_format(
fmt::format()
.json()
.with_target(false)
.with_file(false)
.with_line_number(false)
.with_ansi(use_color)
)),
LogFormat::Plain => Box::new(
fmt::layer().event_format(
fmt::format()
.pretty()
.with_target(false)
.with_file(false)
.with_line_number(false)
.with_ansi(use_color),
),
),
LogFormat::Json => Box::new(
fmt::layer().event_format(
fmt::format()
.json()
.with_target(false)
.with_file(false)
.with_line_number(false)
.with_ansi(use_color),
),
),
},
LogDestination::File(path) => {
let file_appender = tracing_appender::rolling::daily(".", path);
Expand All @@ -211,7 +215,7 @@ fn create_fmt_layer(format: LogFormat, destination: LogDestination) -> BoxedFmtL
.with_target(false)
.with_file(false)
.with_line_number(false)
.with_ansi(use_color)
.with_ansi(use_color),
)
.with_writer(file_appender),
),
Expand All @@ -223,7 +227,7 @@ fn create_fmt_layer(format: LogFormat, destination: LogDestination) -> BoxedFmtL
.with_target(false)
.with_file(false)
.with_line_number(false)
.with_ansi(use_color)
.with_ansi(use_color),
)
.with_writer(file_appender),
),
Expand Down