Commit c169a990 authored by Mohamed, Fawzi Roberto (fawzi)'s avatar Mohamed, Fawzi Roberto (fawzi)
Browse files

updated serviceDumper/templateEvaluer, remotevis fixes

parent 1bb140a6
......@@ -7,3 +7,43 @@ use
With minikube do
./deploy.sh --chown-root /data --nomad-root /hosthome/$USER/nomadlab
machine specific deploy:
# labdev-nomad
cd /nomad/nomadlab/servers/labdev-nomad/analytics/beaker
./deploy.sh --env labdev-nomad --target-hostname labdev-nomad --secret-web-certs web-certs --debug
development machine, deploy mirroring the filesystem, you might need to manully execute npm install in the container to if you update packages
# nomad-vis-test
from labdev-nomad.container
cd /nomad/nomadlab/servers/nomad-vis-test/analytics/remotevis
Update info on services of labdev that we use as we share the session db (we should probably clean up this ugly command)
kubectl exec -ti $(kubectl get po | grep nomad-container-manager-beaker | cut -f1 -d ' ') node app.js serviceDumper -- --out-file labdev-nomad.services.yaml
update config with current info on the redis dbs of labdev (default-remotevis.hjson.in -> default-remotevis.hjson)
docker run -ti -v $PWD:/usr/src/app -v /nomad/nomadlab/servers/labdev-nomad/analytics/beaker:/mnt -w /usr/src/app --rm node:carbon node app.js templateEvaluer --replacements /mnt/labdev-nomad.services.yaml --template config/nomad-vis-test.hjson.in --out-file config/nomad-vis-test.hjson
deploy
./deploy.sh --tls --env nomad-vis-test --target-hostname nomad-vis-test --secret-web-certs web-certs
and execute the deploy for remote vis
kubectl create -f container-manager-service-remotevis.yaml
if ! kubectl get deployment nomad-container-manager-remotevis >& /dev/null ; then
kubectl create --save-config -f container-manager-deploy-remotevis.yaml
else
kubectl apply -f container-manager-deploy-remotevis.yaml
fi
if only that changed, otherwise on has also to create the secrets and analytics namespace.
A serviceDump has to be run to reexport the ports to the frontend, then the frontend setup needs to be updated.
......@@ -20,7 +20,8 @@ function main() {
var cmds = []
const usage = `node ${args[1]} [-h|--help] [--image-type [beaker|jupyter|creedo|remotevis]] [webserver|watcher|apiserver]
node ${args[1]} serviceDumper <serviceListFile>
node ${args[1]} serviceDumper [--help <serviceListFile>...]
node ${args[1]} templateEvaluer [--help ...]
`
var imageType = undefined
if (iarg < args.length) {
......
......@@ -30,10 +30,12 @@ exports.serviceDumper = function(args) {
iarg += 1
if (arg == '--help') {
console.log(usage)
process.exit(0)
return;
} else if (arg == '--in-file') {
if (iarg >= args.length) {
console.log(`Expected in file after --in-file, ${usage}`)
process.exit(1)
return;
}
inFile = args[iarg]
......@@ -41,6 +43,7 @@ exports.serviceDumper = function(args) {
} else if (arg == '--out-file') {
if (iarg >= args.length) {
console.log(`Expected out file after --out-file, ${usage}`)
process.exit(1)
return;
}
outFile = args[iarg]
......@@ -48,12 +51,14 @@ exports.serviceDumper = function(args) {
} else if (arg == '--namespace') {
if (iarg >= args.length) {
console.log(`Expected namespace after --namespace, ${usage}`)
process.exit(1)
return;
}
namespace = args[iarg]
iarg += 1
} else {
console.log(`unexpected argument ${arg}, ${usage}`)
process.exit(1)
}
}
if (inFile.length > 0) {
......@@ -64,9 +69,10 @@ exports.serviceDumper = function(args) {
services = inF.services
}
k8D.getServiceInfo(namespace, function(err, ss){
if (err)
if (err) {
logger.warn(`error getting services for namespace ${namespace}`)
else {
process.exit(1)
} else {
let sss = ss
if (services.length != 0){
sss = {}
......
const yaml = require('js-yaml')
const logger = require('./logger')
const fs = require('fs')
const k8D = require('./k8-data')
const stringify = require('json-stringify-safe')
const components = require('./components')
......@@ -27,10 +26,12 @@ exports.templateEvaluer = function(args) {
iarg += 1
if (arg == '--help') {
console.log(usage)
process.exit(0)
return;
} else if (arg == '--template') {
if (iarg >= args.length) {
console.log(`Expected in file after --template, ${usage}`)
process.exit(1)
return;
}
inFile = args[iarg]
......@@ -38,6 +39,7 @@ exports.templateEvaluer = function(args) {
} else if (arg == '--replacements') {
if (iarg >= args.length) {
console.log(`Expected a replacements file after --replacements, ${usage}`)
process.exit(1)
return;
}
let repl = yaml.safeLoad(fs.readFileSync(args[iarg]))
......@@ -46,19 +48,21 @@ exports.templateEvaluer = function(args) {
} else if (arg == '--out-file') {
if (iarg >= args.length) {
console.log(`Expected out file after --out-file, ${usage}`)
process.exit(1)
return;
}
outFile = args[iarg]
iarg += 1
} else {
console.log(`unexpected argument ${arg}, ${usage}`)
process.exit(1)
return;
}
}
if (inFile.length > 0) {
let inF = fs.readFileSync(inFile, {encoding:'utf8'})
let outF = components.templatize(inF)(replacements)
if (outFile.lenght > 0)
if (outFile.length > 0)
fs.writeFileSync(outFile, outF, { encoding: 'utf8'})
else
console.log(outF)
......
k8component: {
templatePath: "kube/jupyterTemplate.yaml"
image: {
name: jupyter
imageType: jupyter
imageSubtype: default1
subType: default1
......
k8component: {
image: {
name: remotevis
imageType: remotevis
subtype: default1
image: "labdev-nomad.esc.rzg.mpg.de:5000/nomadlab/notebook-jupyter-libatoms-tutorial",
port: 8809,
prefix: "/jupyter",
prefix: "/remotevis",
templatePath: "kube/remoteVisTemplate.yaml"
}
entryPoint: {
redirectTarget: "{{prefix}}/vnc.html"
execCommand: []
exclusiveStartPoint: true
}
}
session_redis: {
port: 30289
host: 130.183.207.101
}
usersettings_redis: {
port: 31996
host: 130.183.207.101
}
session_redis: {
port: {{analytics-session-db-redis-master.0.ports.0.nodePort}}
host: {{analytics-session-db-redis-master.0.nodes.[0]}}
}
usersettings_redis: {
port: {{user-settings-db-redis-master.0.ports.0.nodePort}}
host: {{user-settings-db-redis-master.0.nodes.[0]}}
}
{
k8component: {
imageType: remotevis
}
k8Api: {
url: "https://130.183.207.115:6443"
node: "130.183.207.115"
}
session_redis: {
# from labdev
# export KUBECONFIG=/etc/kubernetes/admin.conf
# kubectl svc analytics-session-db-redis-master
port: 30289
host: "labdev3-nomad.rzg.mpg.de"
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment