diff --git a/ci/ci.sh b/ci/ci.sh index 858e5f5d..fb0ed3a5 100755 --- a/ci/ci.sh +++ b/ci/ci.sh @@ -12,7 +12,7 @@ DB_PASS=${8} ES_PROTOCOL=${9} ES_HOST=${10} -ES_INDEX_NAME=${11} +ES_INDEX_PREFIX=${11} ES_PORT=${12} ES_USE_AUTH=${13} ES_USERNAME=${14} @@ -106,7 +106,7 @@ project_webapp_root=proj cws_enable_cloud_autoscaling=n elasticsearch_protocol=${ES_PROTOCOL} elasticsearch_host=${ES_HOST} -elasticsearch_index_name=${ES_INDEX_NAME} +elasticsearch_index_prefix=${ES_INDEX_PREFIX} elasticsearch_use_auth=${ES_USE_AUTH} elasticsearch_port=${ES_PORT} elasticsearch_username=${ES_USERNAME} @@ -117,7 +117,7 @@ default_cws_ldap_url=ldap://localhost:389 cws_ldap_url=ldap://localhost:389 default_elasticsearch_use_auth=n aws_cloudwatch_endpoint=monitoring.us-west-1.amazonaws.com -default_elasticsearch_index_name +default_elasticsearch_index_prefix=cws-index default_elasticsearch_port=9200 default_aws_cloudwatch_endpoint=monitoring.us-west-1.amazonaws.com aws_sqs_dispatcher_msgFetchLimit=1 @@ -170,12 +170,13 @@ email_subject=[CWS] You have been assigned a task (CWS_TASK_NAME) email_body=fn:CWS_USER_FIRSTNAME
ln:CWS_USER_LASTNAME,
tn:(CWS_TASK_NAME), em:CWS_USER_EMAIL elasticsearch_protocol=${ES_PROTOCOL} elasticsearch_host=${ES_HOST} -elasticsearch_index_name=${ES_INDEX_NAME} +elasticsearch_index_prefix=${ES_INDEX_PREFIX} elasticsearch_use_auth=${ES_USE_AUTH} elasticsearch_port=${ES_PORT} elasticsearch_username=${ES_USERNAME} elasticsearch_password=${ES_PASSWORD} smtp_hostname=smtp.localhost +default_elasticsearch_index_prefix=cws-index default_smtp_hostname=smtp.localhost default_cws_ldap_url=ldap://localhost:389 cws_ldap_url=ldap://localhost:389 diff --git a/ci/run_ci.sh b/ci/run_ci.sh index 90af0d8d..dd607c05 100755 --- a/ci/run_ci.sh +++ b/ci/run_ci.sh @@ -31,7 +31,7 @@ ADMIN_EMAIL="/" ES_PROTOCOL="HTTP" ES_HOST="http://localhost" -ES_INDEX_NAME="cws" +ES_INDEX_PREFIX="cws-index" ES_PORT=9200 ES_USE_AUTH=n ES_USERNAME="na" @@ -45,4 +45,4 @@ NUM_WORKERS=${2} # parameter is passed as an env through workflow file WORKER_ABANDONED_DAYS=1 # Run the ci script -./ci.sh `pwd` ${USER} ${DB_TYPE} ${DB_HOST} ${DB_PORT} ${DB_NAME} ${DB_USER} ${DB_PASS} ${ES_PROTOCOL} ${ES_HOST} ${ES_INDEX_NAME} ${ES_PORT} ${ES_USE_AUTH} ${ES_USERNAME} ${ES_PASSWORD} ${CLOUD} ${SECURITY} ${HOSTNAME} ${EMAIL_LIST} ${ADMIN_FIRST} ${ADMIN_LAST} ${ADMIN_EMAIL} ${NUM_WORKERS} ${WORKER_ABANDONED_DAYS} +./ci.sh `pwd` ${USER} ${DB_TYPE} ${DB_HOST} ${DB_PORT} ${DB_NAME} ${DB_USER} ${DB_PASS} ${ES_PROTOCOL} ${ES_HOST} ${ES_INDEX_PREFIX} ${ES_PORT} ${ES_USE_AUTH} ${ES_USERNAME} ${ES_PASSWORD} ${CLOUD} ${SECURITY} ${HOSTNAME} ${EMAIL_LIST} ${ADMIN_FIRST} ${ADMIN_LAST} ${ADMIN_EMAIL} ${NUM_WORKERS} ${WORKER_ABANDONED_DAYS} diff --git a/cws-installer/src/main/java/jpl/cws/task/CwsInstaller.java b/cws-installer/src/main/java/jpl/cws/task/CwsInstaller.java index 5b4093fb..53fb57e8 100755 --- a/cws-installer/src/main/java/jpl/cws/task/CwsInstaller.java +++ b/cws-installer/src/main/java/jpl/cws/task/CwsInstaller.java @@ -222,7 +222,7 @@ public class CwsInstaller { private static String elasticsearch_protocol_init; private static String elasticsearch_host; private static String elasticsearch_host_init; - private static String elasticsearch_index_name; + private static String elasticsearch_index_prefix; private static String elasticsearch_port; private static String elasticsearch_use_auth; private static String elasticsearch_username; @@ -1370,18 +1370,18 @@ private static void setupElasticsearch() { log.debug("elasticsearch_port: " + elasticsearch_port); // PROMPT USER FOR ELASTICSEARCH INDEX - elasticsearch_index_name = getPreset("elasticsearch_index_name"); + elasticsearch_index_prefix = getPreset("elasticsearch_index_prefix"); - if (elasticsearch_index_name == null) { - elasticsearch_index_name = getPreset("default_elasticsearch_index_name"); + if (elasticsearch_index_prefix == null) { + elasticsearch_index_prefix = getPreset("default_elasticsearch_index_prefix"); } if (cws_installer_mode.equals("interactive")) { - elasticsearch_index_name = readLine("Enter the Elasticsearch Index. " + - "Default is " + elasticsearch_index_name + ": ", elasticsearch_index_name); + elasticsearch_index_prefix = readLine("Enter the Elasticsearch Index. " + + "Default is " + elasticsearch_index_prefix + ": ", elasticsearch_index_prefix); } - log.debug("elasticsearch_index_name: " + elasticsearch_index_name); + log.debug("elasticsearch_index_prefix: " + elasticsearch_index_prefix); // PROMPT USER ELASTICSEARCH AUTH @@ -1799,7 +1799,7 @@ private static void showInstallationInfo() { print("...................................................................................."); print("Elasticsearch Protocol = " + elasticsearch_protocol); print("Elasticsearch Host = " + elasticsearch_host); - print("Elasticsearch Index Name = " + elasticsearch_index_name); + print("Elasticsearch Index Prefix = " + elasticsearch_index_prefix); print("Elasticsearch Port = " + elasticsearch_port); if (elasticsearch_use_auth.equalsIgnoreCase("Y")) { print("Elasticsearch User = " + elasticsearch_username); @@ -2459,7 +2459,7 @@ private static int validateElasticsearch() { print(" [ELASTICSEARCH]: Configuration Details"); print(" elasticsearch_protocol=" + elasticsearch_protocol_init + " "); print(" elasticsearch_host=" + elasticsearch_host_init + " "); - print(" elasticsearch_index_name=" + elasticsearch_index_name + " "); + print(" elasticsearch_index_prefix=" + elasticsearch_index_prefix + " "); print(" elasticsearch_port=" + elasticsearch_port + " "); print(" ........................................................................................."); print(""); @@ -2982,7 +2982,7 @@ private static void updateCwsUiProperties() throws IOException { content = content.replace("__CWS_CONSOLE_SSL_PORT__", cws_console_ssl_port); content = content.replace("__CWS_ES_PROTOCOL__", elasticsearch_protocol); content = content.replace("__CWS_ES_HOST__", elasticsearch_host); - content = content.replace("__CWS_ES_INDEX_NAME__", elasticsearch_index_name); + content = content.replace("__CWS_ES_INDEX_PREFIX__", elasticsearch_index_prefix); content = content.replace("__CWS_ES_PORT__", elasticsearch_port); content = content.replace("__CWS_ES_USE_AUTH__", elasticsearch_use_auth); content = content.replace("__CWS_ENABLE_CLOUD_AUTOSCALING__", cws_enable_cloud_autoscaling); @@ -3105,7 +3105,7 @@ private static void updateCwsUiConfig() throws IOException { content = getFileContents(path); content = content.replace("__ES_PROTOCOL__", elasticsearch_protocol); content = content.replace("__ES_HOST__", elasticsearch_host); - content = content.replace("__ES_INDEX_NAME__", elasticsearch_index_name); + content = content.replace("__ES_INDEX_PREFIX__", elasticsearch_index_prefix); content = content.replace("__ES_PORT__", elasticsearch_port); content = content.replace("__ES_USE_AUTH__", elasticsearch_use_auth); if (elasticsearch_use_auth.equalsIgnoreCase("Y")) { @@ -3350,7 +3350,7 @@ private static void installLogstash() throws IOException { logstashContent = logstashContent.replace("__CWS_ES_PROTOCOL__", elasticsearch_protocol); logstashContent = logstashContent.replace("__CWS_ES_HOST__", elasticsearch_host); - logstashContent = logstashContent.replace("__CWS_ES_INDEX_NAME__", elasticsearch_index_name); + logstashContent = logstashContent.replace("__CWS_ES_INDEX_PREFIX__", elasticsearch_index_prefix); logstashContent = logstashContent.replace("__CWS_ES_PORT__", elasticsearch_port); if (elasticsearch_use_auth.equalsIgnoreCase(("Y"))) { // Construct the auth config for logstash @@ -3436,7 +3436,7 @@ private static void writeOutConfigurationFile() throws IOException { setPreset("cws_token_expiration_hours", cws_token_expiration_hours); setPreset("elasticsearch_protocol", elasticsearch_protocol); setPreset("elasticsearch_host", elasticsearch_host); - setPreset("elasticsearch_index_name", elasticsearch_index_name); + setPreset("elasticsearch_index_prefix", elasticsearch_index_prefix); setPreset("elasticsearch_port", elasticsearch_port); setPreset("elasticsearch_use_auth", elasticsearch_use_auth); setPreset("elasticsearch_username", elasticsearch_username); diff --git a/cws-service/src/main/java/jpl/cws/controller/MvcCore.java b/cws-service/src/main/java/jpl/cws/controller/MvcCore.java index fa2bd808..2308b6f1 100755 --- a/cws-service/src/main/java/jpl/cws/controller/MvcCore.java +++ b/cws-service/src/main/java/jpl/cws/controller/MvcCore.java @@ -19,17 +19,21 @@ @Component public class MvcCore { private static final Logger log = LoggerFactory.getLogger(MvcCore.class); - + @Autowired protected CamundaExecutionService cwsExecutionService; @Autowired protected SchedulerQueueUtils cwsSchedulerUtils; @Autowired private CwsConsoleService cwsConsoleService; - + @Value("${cws.console.app.root}") private String appRoot; @Value("${cws.version}") private String version; @Value("${cws.db.type}") private String dbType; @Value("${cws.db.host}") private String dbHost; @Value("${cws.db.name}") private String dbName; @Value("${cws.db.port}") private String dbPort; + @Value("${cws.elasticsearch.protocol}") private String esProtocol; + @Value("${cws.elasticsearch.hostname}") private String esHost; + @Value("${cws.elasticsearch.index.prefix}") private String esIndexPrefix; + @Value("${cws.elasticsearch.port}") private String esPort; @Value("${cws.auth.scheme}") private String authScheme; @Value("${cws.install.dir}") private String installDir; @Value("${cws.tomcat.lib}") private String tomcatLib; @@ -41,7 +45,7 @@ public class MvcCore { @Value("${cws.history.level}") private String historyLevel; public MvcCore() {} - + protected ModelAndView buildModel(String page, String message) { ModelAndView model = new ModelAndView(page); model.addObject("base", appRoot); @@ -52,13 +56,13 @@ protected ModelAndView buildModel(String page, String message) { log.debug("MODEL: "+model.getModel()); return model; } - - + + protected ModelAndView buildHomeModel(String message) { ModelAndView model = new ModelAndView("home"); model.addObject("base", appRoot); model.addObject("msg", message); - + log.trace("MODEL for Home page: "+model.getModel()); return model; } @@ -83,8 +87,8 @@ protected ModelAndView buildSummaryModel(String message) { log.trace("MODEL for Summary page: "+model.getModel()); return model; } - - + + protected ModelAndView buildDeploymentsModel(String message) { log.trace("buildDeploymentsModel..."); ModelAndView model = new ModelAndView("deployments"); @@ -95,7 +99,7 @@ protected ModelAndView buildDeploymentsModel(String message) { // Add list of (the latest) process definitions to the model // model.addObject("procDefs", cwsExecutionService.listProcessDefinitions()); - + log.trace("MODEL for Deployments page: "+model.getModel()); } catch (Throwable t) { @@ -123,14 +127,14 @@ protected ModelAndView buildLogsModel(String message) { } return model; } - + protected ModelAndView buildHistoryModel(String message) { log.trace("buildHistoryModel..."); ModelAndView model = new ModelAndView("history"); try { model.addObject("base", appRoot); model.addObject("msg", message); - + log.trace("MODEL for History page: "+model.getModel()); } catch (Throwable t) { @@ -138,9 +142,9 @@ protected ModelAndView buildHistoryModel(String message) { } return model; } - + /** - * + * */ protected ModelAndView buildProcessesModel(String message) { ModelAndView model = new ModelAndView("processes"); @@ -159,10 +163,10 @@ protected ModelAndView buildProcessesModel(String message) { } return model; } - - + + /** - * + * */ protected ModelAndView buildConfigurationModel(String message) { ModelAndView model = new ModelAndView("configuration"); @@ -175,6 +179,10 @@ protected ModelAndView buildConfigurationModel(String message) { model.addObject("dbHost", dbHost); model.addObject("dbName", dbName); model.addObject("dbPort", dbPort); + model.addObject("esProtocol", esProtocol); + model.addObject("esHost", esHost); + model.addObject("esIndexPrefix", esIndexPrefix); + model.addObject("esPort", esPort); model.addObject("authScheme", authScheme); model.addObject("installDir", installDir); model.addObject("tomcatLib", tomcatLib); @@ -188,10 +196,10 @@ protected ModelAndView buildConfigurationModel(String message) { model.addObject("camundaVersion", System.getenv("CAMUNDA_VER")); DiskUsage diskUsage = cwsConsoleService.getDiskUsage(); - + model.addObject("databaseSize", diskUsage.databaseSize); model.addObject("workersInfo", diskUsage.workers); - + log.trace("MODEL for Configuration page: "+model.getModel()); } catch (Throwable t) { @@ -199,15 +207,15 @@ protected ModelAndView buildConfigurationModel(String message) { } return model; } - + /** - * + * */ protected ModelAndView buildModelerModel() { ModelAndView model = new ModelAndView("modeler"); try { model.addObject("base", appRoot); - + log.trace("MODEL for Modeler page: "+model.getModel()); } catch (Throwable t) { @@ -215,10 +223,10 @@ protected ModelAndView buildModelerModel() { } return model; } - - + + /** - * + * */ protected ModelAndView buildDocumentationModel(String message) { ModelAndView model = new ModelAndView("documentation"); @@ -232,11 +240,11 @@ protected ModelAndView buildDocumentationModel(String message) { } return model; } - - + + /** * Model for "Workers" web page - * + * */ protected ModelAndView buildWorkersModel() { ModelAndView model = new ModelAndView("workers"); @@ -247,19 +255,19 @@ protected ModelAndView buildWorkersModel() { // List procDefs = cwsExecutionService.listProcessDefinitions(); model.addObject("procDefs", procDefs); - + model.addObject("workers", cwsConsoleService.getWorkersUiDTO(procDefs)); model.addObject("externalWorkers", cwsConsoleService.getExternalWorkersUiDTO()); - + model.addObject("workersTitle", cwsConsoleService.getWorkersTitle()); - + try { Set clients = cwsSchedulerUtils.getAmqClients(); model.addObject("amqClients", clients); } catch (Exception e) { log.error("There was a problem getting listing of AMQ clients", e); } - + return model; } @@ -277,6 +285,6 @@ protected ModelAndView buildModelerModel(String message) { } return model; } - + } diff --git a/dev.sh b/dev.sh index 4329efcd..30be500e 100755 --- a/dev.sh +++ b/dev.sh @@ -14,7 +14,7 @@ DB_USER=${7} DB_PASS=${8} ES_PROTOCOL=${9} ES_HOST=${10} -ES_INDEX_NAME=${11} +ES_INDEX_PREFIX=${11} ES_PORT=${12} ES_USE_AUTH=${13} ES_USERNAME=${14} diff --git a/install/cws-ui/configuration.ftl b/install/cws-ui/configuration.ftl index a457f993..e939cddb 100755 --- a/install/cws-ui/configuration.ftl +++ b/install/cws-ui/configuration.ftl @@ -13,59 +13,58 @@ var params = {}; var rows; var es = []; - + function formatBytes(bytes,decimals) { if(bytes == 0) return '0 Bytes'; - + var k = 1024, dm = decimals <= 0 ? 0 : decimals || 2, sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], i = Math.floor(Math.log(bytes) / Math.log(k)); - + return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; } function getEsIndices() { - - - $.ajax({ + + $.ajax({ url: "/${base}/rest/stats/es/indices", success: function( data ) { - + for (var i = 0; i < data.length; i++) { - - var index = data[i]; - var health = index.health; - - if (health === 'yellow') { - health += ' (OK)'; - } - - var size = formatBytes(parseInt(index["store.size"], 10)); - - $("#es_indices").append('' + index.index + '' + health + '' + size + ''); + var index = data[i]; + if (index.index.startsWith("${esIndexPrefix}")) { + + var health = index.health; + + if (health === 'yellow') { + health += ' (OK)'; + } + var size = formatBytes(parseInt(index["store.size"], 10)); + $("#es_indices").append('' + index.index + '' + health + '' + size + ''); + } } - + // $("#es_num_indices").html(data.length); }, error: function(err){ console.log("getes indices failed!", err); } }); - + } - + function refreshElasticsearchStats() { - - $.ajax({ + + $.ajax({ url: "/${base}/rest/stats/es", success: function( data ) { - + for (var property in data.nodes) { if (data.nodes.hasOwnProperty(property)) { - + var node = data.nodes[property]; - + es.push( { host: node.host, size: node.indices.store.size_in_bytes, disk_free: node.fs.total.free_in_bytes, @@ -73,31 +72,31 @@ memory_used_precent: node.os.mem.used_percent } ); } } - + $("#es_host").html(es[0].host); $("#es_disk_used").html(formatBytes(es[0].size)); $("#es_disk_free").html(formatBytes(es[0].disk_free)); $("#es_cpu").html(es[0].cpu_usage_percent + "%"); $("#es_memory").html(es[0].memory_used_precent + "%"); - + }, error: function(){ } }); } - + function updateValues() { - + var dbSize = formatBytes(parseInt('${databaseSize}'.replace(/,/g, ''), 10)); - + $("#db_size").html(dbSize); - - + + // Update table values var table = $("#diskUsage tbody"); - + table.find('tr').each(function (i, el) { - + var $tds = $(this).find('td'), node = $tds.eq(1), sizeWithCommas = node.text(); @@ -111,9 +110,9 @@ } }); } - + $( document ).ready(function() { - // + // if ($("#statusMessageDiv:contains('ERROR:')").length >= 1) { $("#statusMessageDiv").css( "color", "red" ); } @@ -123,15 +122,15 @@ $('#statusMessageDiv').fadeOut(5000, "linear"); } } - + updateValues(); getEsIndices(); refreshElasticsearchStats(); }); - + - + @@ -147,28 +146,28 @@ margin-bottom: 1em; float:left; } - + .database { display: flex; align-items: center; margin: 30px 0px 50px; } - + .database > div { font-size: 23px; } - + #db_size { border-radius: 8px; margin-left: 25px; background: #ededed; padding: 10px; } - + .margin { margin-bottom: 20px; } - + @@ -180,13 +179,13 @@
<#include "sidebar.ftl">
- +

${msg}

- +

Configuration

- +
@@ -213,6 +212,14 @@ + + + + + + + + @@ -252,7 +259,7 @@ - + @@ -263,14 +270,14 @@

System Health

- +
Database Disk Usage
${databaseSize}
- +

System

- +
CWS Database Port ${dbPort}
CWS Elasticsearch URL${esProtocol}://${esHost}:${esPort}
CWS Elasticsearch Index Prefix${esIndexPrefix}
CWS Authentication Scheme ${authScheme}
Java Version ${javaVersion}
Java Home Path ${javaHome}
@@ -307,10 +314,10 @@

Elasticsearch Server

- +
Name
- + diff --git a/install/cws-ui/cws-ui.properties b/install/cws-ui/cws-ui.properties index d2f1c44c..d5bed0df 100755 --- a/install/cws-ui/cws-ui.properties +++ b/install/cws-ui/cws-ui.properties @@ -18,7 +18,7 @@ cws.db.password=__CWS_DB_PASSWORD__ cws.elasticsearch.protocol=__CWS_ES_PROTOCOL__ cws.elasticsearch.hostname=__CWS_ES_HOST__ -cws.elasticsearch.index=__CWS_ES_INDEX_NAME__ +cws.elasticsearch.index.prefix=__CWS_ES_INDEX_PREFIX__ cws.elasticsearch.port=__CWS_ES_PORT__ cws.elasticsearch.use.auth=__CWS_ES_USE_AUTH__ cws.elasticsearch.username=__CWS_ES_USERNAME__ diff --git a/install/installerPresets.properties b/install/installerPresets.properties index 1c4fdf61..978ce267 100644 --- a/install/installerPresets.properties +++ b/install/installerPresets.properties @@ -15,7 +15,7 @@ default_cws_token_expiration_hours=24 default_smtp_hostname=smtp.localhost default_smtp_port=25 default_elasticsearch_use_auth=n -default_elasticsearch_index_name=cws +default_elasticsearch_index_prefix=cws-index default_elasticsearch_port=9200 default_user_provided_logstash=n default_history_level=full diff --git a/install/logging/cws-logstash.conf b/install/logging/cws-logstash.conf index 0a805a25..7c701236 100644 --- a/install/logging/cws-logstash.conf +++ b/install/logging/cws-logstash.conf @@ -57,7 +57,7 @@ output { elasticsearch { hosts => ["__CWS_ES_PROTOCOL__://__CWS_ES_HOST__:__CWS_ES_PORT__"] ilm_enabled => false - index => "__CWS_ES_INDEX_NAME__-logstash-%{+YYYY.MM.dd}" + index => "__CWS_ES_INDEX_PREFIX__-logstash-%{+YYYY.MM.dd}" ssl => __LOGSTASH_ES_USE_SSL__ __LOGSTASH_ES_USERNAME__ __LOGSTASH_ES_PASSWORD__ diff --git a/utils.sh b/utils.sh index 26cbe019..d7e7480b 100755 --- a/utils.sh +++ b/utils.sh @@ -191,7 +191,7 @@ function auto_conf_data () { DB_PASS=${9} ES_PROTOCOL=${10} ES_HOST=${11} - ES_INDEX_NAME=${12} + ES_INDEX_PREFIX=${12} ES_PORT=${13} ES_USE_AUTH=${14} ES_USERNAME=${15} @@ -282,7 +282,7 @@ function auto_conf_data () { database_password=${DB_PASS} elasticsearch_protocol=${ES_PROTOCOL} elasticsearch_host=${ES_HOST} - elasticsearch_index_name=${ES_INDEX_NAME} + elasticsearch_index_prefix=${ES_INDEX_PREFIX} elasticsearch_port=${ES_PORT} elasticsearch_use_auth=${ES_USE_AUTH} elasticsearch_username=${ES_USERNAME}
Hostname 127.0.0.1