diff --git a/server/src/about.rs b/server/src/about.rs
index c696a9c18..1dff12755 100644
--- a/server/src/about.rs
+++ b/server/src/about.rs
@@ -122,7 +122,7 @@ pub async fn print(config: &Config, meta: &StorageMetadata) {
// print current version
let current = current();
let latest_release = if config.parseable.check_update {
- update::get_latest(meta).await.ok()
+ update::get_latest(&meta.deployment_id).await.ok()
} else {
None
};
diff --git a/server/src/handlers/http.rs b/server/src/handlers/http.rs
index c163c6a5c..ab935a2a8 100644
--- a/server/src/handlers/http.rs
+++ b/server/src/handlers/http.rs
@@ -31,6 +31,7 @@ use crate::rbac::role::Action;
use self::middleware::{Auth, DisAllowRootUser};
+mod about;
mod health_check;
mod ingest;
mod logstream;
@@ -233,6 +234,8 @@ pub fn configure_routes(cfg: &mut web::ServiceConfig) {
.service(web::resource("/liveness").route(web::get().to(health_check::liveness)))
// GET "/readiness" ==> Readiness check as per https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-readiness-probes
.service(web::resource("/readiness").route(web::get().to(health_check::readiness)))
+ // GET "/about" ==> Returns information about instance
+ .service(web::resource("/about").route(web::get().to(about::about)))
.service(
web::scope("/logstream")
.service(
diff --git a/server/src/handlers/http/about.rs b/server/src/handlers/http/about.rs
new file mode 100644
index 000000000..ba6feb188
--- /dev/null
+++ b/server/src/handlers/http/about.rs
@@ -0,0 +1,56 @@
+/*
+ * Parseable Server (C) 2022 - 2023 Parseable, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+use actix_web::web::Json;
+use serde_json::json;
+
+use crate::{about, option::CONFIG, storage::StorageMetadata, utils::update};
+
+pub async fn about() -> Json {
+ let meta = StorageMetadata::global();
+
+ let current_release = about::current();
+ let latest_release = update::get_latest(&meta.deployment_id).await;
+
+ let (update_available, latest_release) = match latest_release {
+ Ok(latest_release) => (
+ latest_release.version > current_release.released_version,
+ Some(format!("v{}", latest_release.version)),
+ ),
+ Err(_) => (false, None),
+ };
+
+ let current_version = format!("v{}", current_release.released_version);
+ let commit = current_release.commit_hash;
+ let deployment_id = meta.deployment_id.to_string();
+ let mode = CONFIG.mode_string();
+ let staging = CONFIG.staging_dir();
+ let store = CONFIG.storage().get_endpoint();
+
+ Json(json!({
+ "version": current_version,
+ "commit": commit,
+ "deploymentId": deployment_id,
+ "updateAvailable": update_available,
+ "latestVersion": latest_release,
+ "license": "AGPL-3.0-only",
+ "mode": mode,
+ "staging": staging,
+ "store": store
+ }))
+}
diff --git a/server/src/utils/update.rs b/server/src/utils/update.rs
index 19659f877..c33879a55 100644
--- a/server/src/utils/update.rs
+++ b/server/src/utils/update.rs
@@ -22,7 +22,8 @@ use anyhow::anyhow;
use chrono::{DateTime, Utc};
use crate::about;
-use crate::storage::StorageMetadata;
+
+use super::uid;
#[derive(Debug)]
pub struct LatestRelease {
@@ -30,9 +31,9 @@ pub struct LatestRelease {
pub date: DateTime,
}
-pub async fn get_latest(meta: &StorageMetadata) -> Result {
+pub async fn get_latest(deployment_id: &uid::Uid) -> Result {
let agent = reqwest::ClientBuilder::new()
- .user_agent(about::user_agent(&meta.deployment_id))
+ .user_agent(about::user_agent(deployment_id))
.timeout(Duration::from_secs(8))
.build()
.expect("client can be built on this system");