diff --git a/README.md b/README.md index 737ead69a..526cee0f0 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@
[![Docker Pulls](https://img.shields.io/docker/pulls/parseable/parseable?logo=docker&label=Docker%20Pulls)](https://hub.docker.com/r/parseable/parseable) -[![Slack](https://img.shields.io/badge/slack-brightgreen.svg?logo=slack&label=Community&style=flat&color=%2373DC8C&)](https://launchpass.com/parseable) -[![Docs](https://img.shields.io/badge/stable%20docs-parseable.io%2Fdocs-brightgreen?style=flat&color=%2373DC8C&label=Docs)](https://www.parseable.io/docs) +[![Slack](https://img.shields.io/badge/slack-brightgreen.svg?logo=slack&label=Community&style=flat&color=%2373DC8C&)](https://logg.ing/community) +[![Docs](https://img.shields.io/badge/stable%20docs-parseable.io%2Fdocs-brightgreen?style=flat&color=%2373DC8C&label=Docs)](https://logg.ing/docs) [![Build](https://img.shields.io/github/checks-status/parseablehq/parseable/main?style=flat&color=%2373DC8C&label=Checks)](https://github.com/parseablehq/parseable/actions) [Key Concepts](https://www.parseable.io/docs/concepts) | [Features](https://github.com/parseablehq/parseable#rocket-highlights) | [Documentation](https://www.parseable.io/docs) | [Demo](https://demo.parseable.com/login?q=eyJ1c2VybmFtZSI6ImFkbWluIiwicGFzc3dvcmQiOiJhZG1pbiJ9) | [Integrations](https://www.parseable.io/docs/category/integrations) | [FAQ](https://www.parseable.io/docs/faq) diff --git a/server/src/about.rs b/server/src/about.rs index c18df7600..f33ac2137 100644 --- a/server/src/about.rs +++ b/server/src/about.rs @@ -104,7 +104,7 @@ pub fn print_about( eprintln!( " Commit: \"{commit_hash}\" - Docs: \"https://www.parseable.io/docs\"" + Docs: \"https://logg.ing/docs\"" ); } diff --git a/server/src/option.rs b/server/src/option.rs index 50dab8878..e0e3260bd 100644 --- a/server/src/option.rs +++ b/server/src/option.rs @@ -30,7 +30,8 @@ use crate::oidc::{self, OpenidConfig}; use crate::storage::{FSConfig, ObjectStorageError, ObjectStorageProvider, S3Config}; pub const MIN_CACHE_SIZE_BYTES: u64 = 1000u64.pow(3); // 1 GiB - +pub const JOIN_COMMUNITY: &str = + "Join us on Parseable Slack community for questions : https://logg.ing/community"; pub static CONFIG: Lazy> = Lazy::new(|| Arc::new(Config::new())); #[derive(Debug)] @@ -104,30 +105,25 @@ impl Config { let has_parseable_json = obj_store.get_object(&rel_path).await.is_ok(); - let has_dirs = match obj_store.list_dirs_in_storage().await { + // Lists all the directories in the root of the bucket/directory + // can be a stream (if it contains .stream.json file) or not + let has_dirs = match obj_store.list_dirs().await { Ok(dirs) => !dirs.is_empty(), Err(_) => false, }; let has_streams = obj_store.list_streams().await.is_ok(); - if !has_dirs || has_parseable_json && has_streams { - Ok(()) - } else if has_parseable_json && !has_streams { - Err(ObjectStorageError::Custom( - "Could not start the server because storage contains stale data from previous deployment, please choose an empty storage and restart the server.\nJoin us on Parseable Slack to report this incident : launchpass.com/parseable" - .to_owned(), - )) - } else if !has_parseable_json && !has_streams && has_dirs { - Err(ObjectStorageError::Custom( - "Could not start the server because storage contains some stale data, please provide an empty storage and restart the server.\nJoin us on Parseable Slack to report this incident : launchpass.com/parseable".to_owned(), - )) - } else { - Err(ObjectStorageError::Custom( - "Could not start the server because storage contains stale data from previous deployment.\nJoin us on Parseable Slack to report this incident : launchpass.com/parseable" - .to_owned() - )) + if has_streams || !has_dirs && !has_parseable_json { + return Ok(()); } + + if self.mode_string() == "Local drive" { + return Err(ObjectStorageError::Custom(format!("Could not start the server because directory '{}' contains stale data, please use an empty directory, and restart the server.\n{}", self.storage.get_endpoint(), JOIN_COMMUNITY))); + } + + // S3 bucket mode + Err(ObjectStorageError::Custom(format!("Could not start the server because bucket '{}' contains stale data, please use an empty bucket and restart the server.\n{}", self.storage.get_endpoint(), JOIN_COMMUNITY))) } pub fn storage(&self) -> Arc { @@ -185,7 +181,7 @@ fn parseable_cli_command() -> Command { .next_line_help(false) .help_template( r#" -{about} Join the community at https://launchpass.com/parseable. +{about} Join the community at https://logg.ing/community. {all-args} "#, diff --git a/server/src/storage/localfs.rs b/server/src/storage/localfs.rs index fad4538ea..8b802ebe8 100644 --- a/server/src/storage/localfs.rs +++ b/server/src/storage/localfs.rs @@ -169,7 +169,7 @@ impl ObjectStorage for LocalFS { Ok(logstreams) } - async fn list_dirs_in_storage(&self) -> Result, ObjectStorageError> { + async fn list_dirs(&self) -> Result, ObjectStorageError> { let dirs = ReadDirStream::new(fs::read_dir(&self.root).await?) .try_collect::>() .await? diff --git a/server/src/storage/object_storage.rs b/server/src/storage/object_storage.rs index cd0051345..7494d16e1 100644 --- a/server/src/storage/object_storage.rs +++ b/server/src/storage/object_storage.rs @@ -75,7 +75,7 @@ pub trait ObjectStorage: Sync + 'static { async fn check(&self) -> Result<(), ObjectStorageError>; async fn delete_stream(&self, stream_name: &str) -> Result<(), ObjectStorageError>; async fn list_streams(&self) -> Result, ObjectStorageError>; - async fn list_dirs_in_storage(&self) -> Result, ObjectStorageError>; + async fn list_dirs(&self) -> Result, ObjectStorageError>; async fn list_dates(&self, stream_name: &str) -> Result, ObjectStorageError>; async fn upload_file(&self, key: &str, path: &Path) -> Result<(), ObjectStorageError>; diff --git a/server/src/storage/s3.rs b/server/src/storage/s3.rs index dbd7dc915..ef1144f18 100644 --- a/server/src/storage/s3.rs +++ b/server/src/storage/s3.rs @@ -471,7 +471,7 @@ impl ObjectStorage for S3 { url::Url::parse(&format!("s3://{}", self.bucket)).unwrap() } - async fn list_dirs_in_storage(&self) -> Result, ObjectStorageError> { + async fn list_dirs(&self) -> Result, ObjectStorageError> { let pre = object_store::path::Path::from("/"); let resp = self.client.list_with_delimiter(Some(&pre)).await?; diff --git a/server/src/storage/store_metadata.rs b/server/src/storage/store_metadata.rs index 137cf1e24..b7d3a52f8 100644 --- a/server/src/storage/store_metadata.rs +++ b/server/src/storage/store_metadata.rs @@ -26,7 +26,7 @@ use once_cell::sync::OnceCell; use std::io; use crate::{ - option::CONFIG, + option::{CONFIG, JOIN_COMMUNITY}, rbac::{role::model::DefaultPrivilege, user::User}, storage::ObjectStorageError, utils::uid, @@ -145,11 +145,7 @@ pub async fn resolve_parseable_metadata() -> Result = err.into(); ObjectStorageError::UnhandledError(err) })?;