Skip to content
Closed
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
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ DB_HEALTHCHECK_PASSWORD=healthcheck
GRAFANA_CONTAINER_PORT=3000
GRAFANA_HOST_PORT=grafana:${GRAFANA_CONTAINER_PORT}
GRAFANA_PROXIES_PATH=localhost/grafana
GRAFANA_DB_NAME=grafana_internal_db

REDIS_PORT=6379
JS_AMP_PORT=3001
ANMS_UI_HTTP_PORT=9030
Expand Down
17 changes: 17 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
This file will contain upgrading instructions for all future tagged releases.

# Upgrading v2.0.0 to main

## Grafana DB Update
A new database named `grafana_internal_db` needs to be created in postgres.

This can be done from the commandline or via the dev UI.

In the latter case, ensure your instance is started with the `dev` and `full` profiles. Go to Adminer (link provided in UI Help page) and either manually create the DB or 'Execute SQL' and upload the file `grafana/create_grafana_db.sql`

# Upgrading v1.x to v.2.0.0

It is recommended to start fresh (delete any existing ANMS-related containers and volumes) when transitioning from ANMS v1 to v2.

If you have data or customizations in a v1 installation that you need to migrate, please contact us or open an issue to discuss.

12 changes: 11 additions & 1 deletion anms-core/anms/routes/network_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,17 @@ def do_nm_put_hex_eid(eid: str, ari: str):
logger.info('post to nm manager %s with eid %s and data %s' % (url, eid, ari))

try:
request = requests.post(url=url, data=ari, headers={'Content-Type': 'text/plain'})
request = requests.post(url=url,
data=ari,
headers={'Content-Type': 'text/plain'},
timeout=(2.0, 8.0) # 2s for manager to connect, 8s for it to respond
)
except requests.exceptions.ConnectTimeout:
return status.HTTP_504_GATEWAY_TIMEOUT
except requests.exceptions.ReadTimeout:
return status.HTTP_504_GATEWAY_TIMEOUT
except requests.exceptions.Timeout:
return status.HTTP_504_GATEWAY_TIMEOUT
except Exception:
return status.HTTP_500_INTERNAL_SERVER_ERROR
return request.status_code
Expand Down
3 changes: 2 additions & 1 deletion anms-core/anms/routes/system_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,5 @@ async def sys_status_get_version():
async def sys_status_get_services_status():
statuses = get_containers_status()
logger.debug(f"Checking all services' status: {str(statuses)}")
return json.dumps(statuses)
return statuses

23 changes: 13 additions & 10 deletions anms-core/anms/routes/transcoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,16 @@ async def transcoder_put_input_cbor(input_cbor: str):
session.refresh(c1)
transcoder_log_id = c1.transcoder_log_id
session.commit()
status = "Submitted ARI to transcoder"
state = "Submitted ARI to transcoder"
else:
# the input_ari has already been submitted
status = "ARI previously submitted, check log"
state = "ARI previously submitted, check log"
transcoder_log_id = curr_uri.transcoder_log_id

logger.info('PUBLISH to transcode/CoreFacing/Outgoing, msg = %s' % msg)
MQTT_CLIENT.publish("transcode/CoreFacing/Outgoing", msg)

return {"id": transcoder_log_id, "status": status}
return {"id": transcoder_log_id, "status": state}


@router.get("/ui/incoming/await/{cbor}/hex", status_code=status.HTTP_200_OK)
Expand Down Expand Up @@ -200,16 +200,16 @@ def transcoder_put_str(input_ari: str):
session.refresh(c1)
transcoder_log_id = c1.transcoder_log_id
session.commit()
status = "Submitted ARI to transcoder"
state = "Submitted ARI to transcoder"
else:
# the input_ari has already been submitted
status = "ARI previously submitted, check log"
state = "ARI previously submitted, check log"
transcoder_log_id = curr_uri.transcoder_log_id

logger.info('PUBLISH to transcode/CoreFacing/Outgoing, msg = %s' % msg)
MQTT_CLIENT.publish("transcode/CoreFacing/Outgoing", msg)

return {"id": transcoder_log_id, "status": status}
return {"id": transcoder_log_id, "status": state}



Expand All @@ -223,21 +223,24 @@ async def transcoder_send_ari_str(eid: str, ari: str):
# Retrieve details and wait for completion
retries = 10
while True:
# Wait for request to process before checking state
await asyncio.sleep(1)

info = do_transcoder_log_by_id(idinfo["id"])

if info.parsed_as != "pending":
break
if retries <= 0:
return { "idinfo" : idinfo, "info" : info, "status" : 504 }
await asyncio.sleep(1)
retries -= 1

if info.parsed_as == "ERROR":
return { "idinfo" : idinfo, "info" : info, "status" : 500 }

# Publish
status = do_nm_put_hex_eid( eid, info.cbor )
state = do_nm_put_hex_eid( eid, info.cbor )

return { "idinfo" : idinfo, "info" : info, "status" : status }
return { "idinfo" : idinfo, "info" : info, "status" : state }
except Exception as e:
logger.exception(e)
return status.HTTP_500_INTERNAL_SERVER_ERROR
Expand Down
2 changes: 1 addition & 1 deletion anms-ui/config_ui_env.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ window.anms_env_config = {
VUE_APP_STATUS_REFRESH_RATE: 60000,
SERVICE_INFO: {
names: [
"adminer","anms-core","authnz",
"adminer","anms-core","authnz","amp-manager",
"aricodec","postgres",
"redis","mqtt-broker","transcoder",
"grafana","grafana-image-renderer"
Expand Down
36 changes: 36 additions & 0 deletions anms-ui/public/app/components/help/Help.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<template>
<div class="help">
<h1>Asynchronous Network Management System (ANMS) documentation</h1>
<ul>
<li><a href="https://github.com/NASA-AMMOS/anms/">Github</a></li>
<li><a href="https://nasa-ammos.github.io/anms-docs/product-guide/html/index.html">Product Guide</a></li>
<li><a href="https://nasa-ammos.github.io/anms-docs/user-guide/html/index.html">User Guide</a></li>
</ul>

<h1>Developer Resources</h1>
<li><a :href="apiDocsUrl">ANMS REST API Docs</a></li>

Check warning on line 11 in anms-ui/public/app/components/help/Help.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Surround this <li> item tag by a <ul> or <ol> container one.

See more on https://sonarcloud.io/project/issues?id=NASA-AMMOS_anms&issues=AZrlKXSm8su8WuaL5MzA&open=AZrlKXSm8su8WuaL5MzA&pullRequest=287
<li><a href="/grafana">Grafana</a> - This powers the 'Monitor' tab. Tip: Press the 'Esc' key in the Monitor tab after clicking within the display to exit Kiosk mode and access the full UI interface.</li>

Check warning on line 12 in anms-ui/public/app/components/help/Help.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Surround this <li> item tag by a <ul> or <ol> container one.

See more on https://sonarcloud.io/project/issues?id=NASA-AMMOS_anms&issues=AZrlKXSm8su8WuaL5MzB&open=AZrlKXSm8su8WuaL5MzB&pullRequest=287
<li><a href="/adminer?pgsql=postgres&username=root">Adminer (DB Management)</a> (if ANMS is configured with 'dev' profile</li>

Check warning on line 13 in anms-ui/public/app/components/help/Help.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Surround this <li> item tag by a <ul> or <ol> container one.

See more on https://sonarcloud.io/project/issues?id=NASA-AMMOS_anms&issues=AZrlKXSm8su8WuaL5MzC&open=AZrlKXSm8su8WuaL5MzC&pullRequest=287
<ul>
</ul>

NOTE: This page is a placeholder. If you have suggestions to improve this page, or ANMS in general, share it with us on github.
</div>
</template>
<script>
import _ from 'lodash';

export default {
name: 'Help',
data() {
return {
pageName: _.upperFirst(_.camelCase('help-page'))
};
},
computed: {
apiDocsUrl() {
return `http://${window.location.hostname}:5555/docs`;

Check warning on line 32 in anms-ui/public/app/components/help/Help.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `globalThis` over `window`.

See more on https://sonarcloud.io/project/issues?id=NASA-AMMOS_anms&issues=AZrlKXSm8su8WuaL5My_&open=AZrlKXSm8su8WuaL5My_&pullRequest=287
}
}
};
</script>
12 changes: 2 additions & 10 deletions anms-ui/public/app/components/management/monitor/Monitor.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
<template>
<div class="container">
<!-- incoming messages -->
<iframe src="/grafana/d-solo/x5LAIuA7z/agents-copy?orgId=1&from=now-48h&to=now&panelId=11" width="100%" height="250" frameborder="0"></iframe>
<!-- reports -->
<iframe src="/grafana/d-solo/oZ7xupanz/reports?orgId=1&from=now-48h&to=now&panelId=123129" width="100%" height="250" frameborder="0"></iframe>
<!-- aris -->
<iframe src="/grafana/d-solo/x5LAIuA7z/agents-copy?orgId=1&panelId=6" width="100%" height="250" frameborder="0"></iframe>
<!-- dashboard -->
<iframe src="/grafana/dashboard/new?orgId=1" width="100%" height="120%" frameborder="0"></iframe>
</div>
<!-- ANMS dashboard -->
<iframe src="/grafana/d/mwvijjmvk/monitor-page?orgId=1&amp;kiosk" width="100%" height="100%" frameborder="0"></iframe>

Check warning on line 3 in anms-ui/public/app/components/management/monitor/Monitor.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add a "title" attribute to this <iframe> tag.

See more on https://sonarcloud.io/project/issues?id=NASA-AMMOS_anms&issues=AZrlKXU78su8WuaL5MzE&open=AZrlKXU78su8WuaL5MzE&pullRequest=287

Check warning on line 3 in anms-ui/public/app/components/management/monitor/Monitor.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this deprecated "frameborder" attribute.

See more on https://sonarcloud.io/project/issues?id=NASA-AMMOS_anms&issues=AZrlKXU78su8WuaL5MzD&open=AZrlKXU78su8WuaL5MzD&pullRequest=287

</template>

Expand Down
18 changes: 18 additions & 0 deletions anms-ui/public/app/components/notfound/NotFound.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<div class="notfound">
<h1>{{ pageName }}</h1>
This is not the page you are looking for.
</div>
</template>
<script>
import _ from 'lodash';

Check warning on line 8 in anms-ui/public/app/components/notfound/NotFound.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused import of '_'.

See more on https://sonarcloud.io/project/issues?id=NASA-AMMOS_anms&issues=AZrlKXVG8su8WuaL5MzF&open=AZrlKXVG8su8WuaL5MzF&pullRequest=287

export default {
name: 'Not found',
data() {
return {
pageName: "Page Not Found"
};
}
};
</script>
1 change: 1 addition & 0 deletions anms-ui/public/app/core/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
</template>
</b-button>
<b-button variant="outline-success" @click="$router.push('/adms')">Adms</b-button>
<b-button variant="outline-success" @click="$router.push('/help')">Help</b-button>
</b-button-group>
</b-col>
</b-row>
Expand Down
14 changes: 11 additions & 3 deletions anms-ui/public/app/core/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
import Vue from 'vue';
import Router from 'vue-router';
import Home from '@app/components/home/Home.vue';
import About from '@app/components/about/About.vue';
import Help from '@app/components/help/Help.vue';
import About from '@app/components/about/About.vue'
import NotFound from '@app/components/notfound/NotFound.vue';

import Constants from '@app/shared/constants';
import User from '@app/components/user/User';
import UserProfile from '@app/components/user/UserProfile';
Expand Down Expand Up @@ -57,6 +60,11 @@ export default new Router({
name: 'about',
component: About
},
{
path: '/help',
name: 'help',
component: Help
},
{
path: '/monitor',
name: 'Monitor',
Expand Down Expand Up @@ -130,8 +138,8 @@ export default new Router({
props: true
},
{
path: '*',
redirect: '/'
path: '*',
component: NotFound
}
]
});
4 changes: 2 additions & 2 deletions anms-ui/public/app/store/modules/service_status.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export default {
api.methods.apiGetServiceStatus().then(res => {
console.log("updateStatus response", res.data);
let jsonStatus = {};
try{
jsonStatus = JSON.parse(res.data); //?Asomehow axios does not parse the Json response
try {
jsonStatus = (typeof jsonStatus === 'object') ? res.data : JSON.parse(res.data);
} catch (e){
console.error(e)
jsonStatus = {};
Expand Down
10 changes: 6 additions & 4 deletions anms.Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ COPY deps/dtnma-adms /usr/src/dtnma-adms
# This is a postgres stateful database with data definition startup SQL scripts
FROM docker.io/library/postgres:14 AS anms-sql

# Grafana DB Creation (can't setup second DB via env variable)
COPY grafana/create_grafana_db.sql /docker-entrypoint-initdb.d/

# ANMS Table Setup
COPY deps/anms_db_tables/*.sql /docker-entrypoint-initdb.d/
COPY deps/dtnma-tools/refdb-sql/postgres/Database_Scripts/*.sql /docker-entrypoint-initdb.d/

Expand Down Expand Up @@ -152,7 +156,7 @@ HEALTHCHECK --start-period=10s --interval=60s --timeout=10s --retries=20 \

# Local grafana configuration
#
FROM docker.io/grafana/grafana:9.1.3 AS grafana
FROM docker.io/grafana/grafana:12.3.0 AS grafana

# Optional APL network configuration from
# https://aplprod.servicenowservices.com/sp?id=kb_article&sys_id=c0de6fe91b83d85071b143bae54bcb34
Expand All @@ -164,9 +168,7 @@ RUN ( \
) || true
USER grafana

COPY --chown=grafana grafana/grafana_vol /var/lib/grafana
COPY grafana/provisioning /etc/grafana/provisioning
COPY grafana/plugins /var/lib/grafana/plugins
COPY --chown=grafana grafana/provisioning /etc/grafana/provisioning
COPY grafana/grafana.ini /etc/grafana/grafana.ini


Expand Down
17 changes: 12 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,18 @@ services:
depends_on:
- grafana-image-renderer
environment:
- GF_RENDERING_SERVER_URL=http://${RENDERER_HOST_PORT}/render
- GF_RENDERING_CALLBACK_URL=http://${GRAFANA_HOST_PORT}/
- GF_SERVER_ROOT_URL=http://${ANMS_GW_FQDN}/grafana/
volumes:
- "grafana-data:/var/lib/grafana"
GF_RENDERING_SERVER_URL: http://${RENDERER_HOST_PORT}/render
GF_RENDERING_CALLBACK_URL: http://${GRAFANA_HOST_PORT}/
GF_SERVER_ROOT_URL: http://${ANMS_GW_FQDN}/grafana/
GF_DATABASE_TYPE: postgres
GF_DATABASE_HOST: postgres:5432
GF_DATABASE_NAME: ${GRAFANA_DB_NAME}
GF_DATABASE_USER: ${DB_USER}
GF_DATABASE_PASSWORD: ${DB_PASSWORD}
GF_DATABASE_SSL_MODE: disable
GF_DATABASE_PATH: "" # Explicitly disable internal sqlite for clarity
GF_PLUGINS_PREINSTALL: "yesoreyeram-infinity-datasource"
GODEBUG: x509negativeserial=1 #fix for tls: failed to parse certificate from server: x509: negative serial number

grafana-image-renderer:
hostname: grafana-image-renderer
Expand Down
3 changes: 3 additions & 0 deletions grafana/create_grafana_db.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- create_grafana_db.sql
CREATE DATABASE grafana_internal_db;
GRANT ALL PRIVILEGES ON DATABASE grafana_internal_db TO grafana;
3 changes: 0 additions & 3 deletions grafana/grafana.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ allow_embedding=true
[live]
allowed_origins=*

[server]
serve_from_sub_path=true

[users]
allow_sign_up=false
auto_assign_org=true
Expand Down
6 changes: 0 additions & 6 deletions grafana/grafana_vol/environment/.gfenv

This file was deleted.

Binary file removed grafana/grafana_vol/grafana.db
Binary file not shown.
Loading
Loading