Commit ac8e25b0 authored by Chris Hines's avatar Chris Hines
Browse files

many changes, plust setup git ignore

parent 4102f1d0
......@@ -42,3 +42,7 @@ testem.log
# System Files
.DS_Store
Thumbs.db
*~
*.swp
*.swo
mkdir -p /var/www/sv2/dist/sv2
mkdir -p /opt/strudel2/spa/sv2
cp sv2.conf /etc/nginx/snippets
cp -r dist/* /var/www/sv2/dist/sv2
cp -r dist/* /opt/strudel2/spa/sv2
echo "you must include /etc/nginx/snippets/sv2.conf in your nginx site config manually"
This diff is collapsed.
export class APIServer {
name: string;
tes: string;
tws: string
}
......@@ -25,7 +25,9 @@ export class SshauthzServer {}
export class AuthorisationService {
// public token: BehaviorSubject<AuthToken>;
public token: AuthToken
public SshAuthzServers: BehaviorSubject<SshAuthzServer[]>;
public sshAuthzServers: BehaviorSubject<SshAuthzServer[]>;
public loggedInAuthZ: BehaviorSubject<SshAuthzServer[]>;
public loggedOutAuthZ: BehaviorSubject<SshAuthzServer[]>;
public readyToNavigate: Subject<[Boolean,string]>;
public progress: Subject<string>;
// private keyCert: Subject<KeyCert>;
......@@ -48,12 +50,16 @@ export class AuthorisationService {
this.progress.next("");
// this.token.subscribe(token => this.getCert(token));
this.route.fragment.subscribe(frag => this.storeToken(frag));
this.SshAuthzServers = new BehaviorSubject<SshAuthzServer[]>([]);
this.sshAuthzServers = new BehaviorSubject<SshAuthzServer[]>([]);
this.loggedInAuthZ = new BehaviorSubject<SshAuthzServer[]>([]);
this.loggedOutAuthZ = new BehaviorSubject<SshAuthzServer[]>([]);
this.backendURI = environment.tesurl;
this.agentContents = new BehaviorSubject(null);
this.agentContents = new BehaviorSubject([]);
this.keys = [];
this.getSshAuthzServers();
this.keys = [];
this.agentContents.subscribe((value) => this.updateLoggedAuthZ());
this.sshAuthzServers.subscribe((value) => this.updateLoggedAuthZ());
}
public setStatusMsg(statusMsg: BehaviorSubject<any>) {
......@@ -68,9 +74,48 @@ export class AuthorisationService {
.subscribe(resp => this.updateSshAuthzServers(resp));
}
private updateLoggedAuthZ() {
let agentContents = this.agentContents.value
let authzServers = this.sshAuthzServers.value
let loggedin = []
let loggedout = []
var found: boolean;
for (let s of authzServers) {
found=false;
console.log('server fp',s.cafp)
for (let cert of agentContents) {
console.log('cert',cert);
if ('Signing CA' in cert) {
for (let ca of cert['Signing CA']) {
console.log('ca',ca);
if (ca == s.cafp) {
loggedin.push(s)
found=true;
continue;
}
}
}
if (found) {
continue;
}
}
if (!found) {
loggedout.push(s)
}
}
console.log('updating which authz servers are logged in and out');
console.log('logged in');
console.log(loggedin);
console.log('logged out');
console.log(loggedout);
this.loggedOutAuthZ.next(loggedout);
this.loggedInAuthZ.next(loggedin);
}
updateSshAuthzServers(resp) {
this.SshAuthzServers.next(<SshAuthzServer[]>resp);
console.log('sshauthzservers set to',this.SshAuthzServers.value);
this.sshAuthzServers.next(<SshAuthzServer[]>resp);
console.log('sshauthzservers set to',this.sshAuthzServers.value);
}
storeToken(frag: string) {
......@@ -191,6 +236,7 @@ public getKeys(id?: Identity) {
// error => this.httperror(error))
}
private killAgent() {
this.statusMsg.next("Logging out")
let headers = new HttpHeaders();
......@@ -228,7 +274,7 @@ public getKeys(id?: Identity) {
public login(authservice: SshAuthzServer) {
let redirect_uri = window.location.origin+this.locationStrategy.getBaseHref()+"sshauthz_callback";
let nonce="asdfzxcv";
let nonce=Math.random().toString(36).substring(2, 15)
console.log(this.location.path());
......
......@@ -56,4 +56,5 @@ export class SshAuthzServer {
scope: string;
logout: string;
userdefined: boolean;
cafp: string;
}
......@@ -9,10 +9,12 @@
Select your username an compute site on the left to see running jobs or start new jobs.
</div>
<div *ngIf="!(identity == undefined)">
<button mat-button (click)="refreshJobs()" style="width: 100%; text-align: left">Refresh</button>
Jobs running as {{ identity.displayName() }}
<div *ngFor="let job of tesService.joblist | async">
<app-job [jobdata]=job></app-job>
</div>
<button mat-button (click)="refreshJobs()" style="width: 100%; text-align: right">Refresh Job list</button>
</div>
</mat-card>
......
<div fxFlex style="flex: 1 1 0%; box-sizing: border-box">
<div fxLayout="column" fxLayoutAlign="space-around stretch" style="height: 100%; width: 100%" >
<mat-toolbar color="primary">
......@@ -11,25 +13,42 @@
<mat-sidenav-container autosize autosize style="height: 100%; width: 100%">
<mat-sidenav #idSideNav mode="side" opened>
<mat-accordion>
<app-sv2-side-nav></app-sv2-side-nav>
</mat-accordion>
<mat-divider></mat-divider>
<mat-accordion>
<div *ngFor="let id of computeSitesService.appidentities | async">
<mat-expansion-panel (click)=selectId(id)>
<mat-expansion-panel-header>
{{ id.displayName() }}
</mat-expansion-panel-header>
<!-- <div *ngFor="let app of id.site.appCatalog.value">
<div *ngIf="app.startscript != null">
<button mat-button (click)=openLaunchWindow(app,id)>{{ app.name }}</button>
</div>
</div> -->
<app-strudelapplist [applist]=id.site.appCatalog [identity]="id"></app-strudelapplist>
</mat-expansion-panel>
</div>
<!-- <mat-accordion> -->
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
More Services
</mat-panel-title>
</mat-expansion-panel-header>
<div *ngFor="let sshauthzserver of (authService.loggedOutAuthZ | async)" style="width: 100%">
<button mat-button (click)=login(sshauthzserver) fxFlex style="text-align: left"> Run on {{ sshauthzserver.name }}</button>
<button mat-icon-button *ngIf="sshauthzserver.userdefined === true"><mat-icon>remove</mat-icon></button>
</div>
<button mat-button (click) =logout() style="width: 100%; text-align: left">Logout</button>
<button mat-button (click) ="authService.updateAgentContents()" style="width: 100%; text-align: left">Refresh Services</button>
</mat-expansion-panel>
<div *ngFor="let id of computeSitesService.appidentities | async">
<mat-expansion-panel (click)=selectId(id)>
<mat-expansion-panel-header>
{{ id.displayName() }}
</mat-expansion-panel-header>
<app-strudelapplist [applist]=id.site.appCatalog [identity]="id"></app-strudelapplist>
</mat-expansion-panel>
</div>
<mat-expansion-panel>
<mat-expansion-panel-header>
Advanced Options
</mat-expansion-panel-header>
Select an API server
<mat-select (selectionChange)="tesService.apiserver.next($event.value)" [value]="tesService.apiserver|async">
<mat-option *ngFor="let apis of tesService.apiservers|async" [value]="apis">
{{ apis.name }}
</mat-option>
</mat-select>
</mat-expansion-panel>
</mat-accordion>
</mat-sidenav>
</mat-sidenav>
<app-joblist [identity]="identitySubject | async"></app-joblist>
<div fxFlex></div>
......
......@@ -47,7 +47,7 @@ export class LauncherComponent implements OnInit {
private authService: AuthorisationService,
public computeSitesService: ComputesitesService,
) {
this.authService.SshAuthzServers.subscribe(o => {this.sshauthzservers = o});
this.authService.sshAuthzServers.subscribe(o => {this.sshauthzservers = o});
this.identitySubject = new BehaviorSubject(undefined);
}
......@@ -68,6 +68,16 @@ export class LauncherComponent implements OnInit {
//}
logout() {
let dialogRef = this.dialog.open(LogoutdialogComponent, {
width: '250px',
height: '400px',
});
}
login (sshauthzserver) {
this.authService.login(sshauthzserver);
}
selectId(id: Identity) {
......
......@@ -2,15 +2,18 @@
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Login
More Services
</mat-panel-title>
</mat-expansion-panel-header>
<div *ngFor="let sshauthzserver of (authService.SshAuthzServers | async)">
<div style="width: 100%">
<button mat-button (click)=login(sshauthzserver) fxFlex style="text-align: left">Login to {{ sshauthzserver.name }} </button>
<button mat-icon-button *ngIf="sshauthzserver.userdefined === true"><mat-icon>remove</mat-icon></button>
</div>
<div *ngFor="let sshauthzserver of (authService.loggedInAuthZ | async)" style="width: 100%">
<button mat-button (click) =logout()>Logout {{ sshauthzserver.name }}</button>
</div>
<div *ngFor="let sshauthzserver of (authService.loggedOutAuthZ | async)" style="width: 100%">
<button mat-button (click)=login(sshauthzserver) fxFlex style="text-align: left"> Run on {{ sshauthzserver.name }}</button>
<button mat-icon-button *ngIf="sshauthzserver.userdefined === true"><mat-icon>remove</mat-icon></button>
</div>
<div style="width: 100%">
<button mat-button (click) ="authService.updateAgentContents()"> Refresh </button>
</div>
<button mat-button (click)=logout() style="width: 100%; text-align: left" >Logout</button>
</mat-expansion-panel>
<!-- </mat-accordion> -->
......@@ -9,9 +9,10 @@ import {BehaviorSubject} from 'rxjs/BehaviorSubject';
import { Subject } from 'rxjs/Subject';
import { Strudelapp, StrudelappInstance } from './strudelapp';
import { Computesite } from './computesite';
import { APIServer } from './apiserver';
import { Identity, AuthToken, KeyCert, SshAuthzServer } from './identity';
import { BatchInterface} from './batchinterface';
import {ComputesitesService} from './computesites.service';
import { BatchInterface } from './batchinterface';
import { ComputesitesService } from './computesites.service';
import { StrudelappsService } from './strudelapps.service';
import { timer } from 'rxjs/observable/timer';
import { repeat } from 'rxjs/operators';
......@@ -32,6 +33,7 @@ Its also responsible for querying a compute site for running jobs */
})
export class TesService {
public Base=environment.tesurl;
public twsproxy = environment.twsurl;
// public Base='http://localhost:5000';
public statusMsg: BehaviorSubject<any>;
public jobs: any[];
......@@ -42,6 +44,8 @@ public joblist: BehaviorSubject<Job[]>;
private timerSubscription: any;
private appwindow: any;
private appwindowWatcher: any;
public apiserver: BehaviorSubject<APIServer>;
public apiservers: BehaviorSubject<APIServer[]>;
// public batchinterface: {[id: string] : BatchInterface};
constructor(private http: HttpClient,
......@@ -54,9 +58,13 @@ private appwindowWatcher: any;
this.busy = new BehaviorSubject<boolean>(false);
// this.joblist = new BehaviorSubject<{[id: string]: Job[]}>({});
this.joblist = new BehaviorSubject<Job[]>([]);
this.apiserver = new BehaviorSubject<APIServer>(undefined);
this.apiservers = new BehaviorSubject<APIServer[]>([]);
this.apiserver.subscribe((r)=>this.logApiServerChange(r));
this.timerSubscription = null;
this.appwindowWatcher = null;
this.getAPIServers();
// this.batchinterface = {};
// this.computesitesService.identities.subscribe(identities => this.startPolling(identities));
}
......@@ -65,6 +73,29 @@ public setStatusMsg(statusMsg: BehaviorSubject<any>) {
this.statusMsg = statusMsg;
}
private logApiServerChange(r) {
console.log('api server was updated');
console.log(this.apiserver.value);
}
setApiServer(server: APIServer) {
console.log('calling setAPIServer');
this.apiserver.next(server);
}
getAPIServers() {
let headers = new HttpHeaders();
let options = { headers: headers, withCredentials: false};
this.http.get<SshAuthzServer[]>('./assets/config/apiservers.json',options)
.subscribe(resp => this.updateAPIServers(resp));
}
private updateAPIServers(resp) {
this.apiservers.next(<APIServer[]>resp);
this.apiserver.next(this.apiservers.value[0]);
}
private buildParams(app: Strudelapp, identity: Identity, batchinterface: BatchInterface, appinst?: any): string {
let params = new URLSearchParams();
let id = identity.copy_skip_catalog();
......@@ -166,8 +197,8 @@ public setStatusMsg(statusMsg: BehaviorSubject<any>) {
let body = {'app': app, 'appparams': appparams, 'keys': keys}
console.log('tes is submitting the job with body',body);
this.http.post<any>(this.Base+'/submit'+'?'+paramstr, body, options)
// .pipe(catchError(this.handleError))
.subscribe(resp => {
.pipe(catchError(this.handleError))
.subscribe(resp => {
this.busy.next(false);
this.statusMsg.next(null)
},
......@@ -255,8 +286,10 @@ public setStatusMsg(statusMsg: BehaviorSubject<any>) {
this.getAppInstance(job);
}
public openAppWindow(url: string) {
let windowloc = url;
public openAppWindow(url: any) {
console.log('in open window url is',url,this.twsproxy);
let windowloc = url.replace(/\{twsproxy\}/g,this.twsproxy);
console.log('window loc is ',windowloc);
// let windowloc = this.router.config
this.appwindow = window.open(windowloc);
if (!(this.appwindowWatcher === null)) {
......@@ -342,6 +375,8 @@ private httperror(errorstr: string) {
private handleError(error: HttpErrorResponse) {
console.error('in handleError');
console.error(error);
if (error.error instanceof ErrorEvent) {
// A client-side or network error occurred. Handle it accordingly.
return throwError("Hmm, that didn't work. If you're using a local connection, please make sure Strudel-TES is running.");
......
[
{
"name": "Testing",
"tes": "https://strudel2-test.cloud.cvl.org.au/tes",
"tws": "https://strudel2-test.cloud.cvl.org.au"
},
{
"name": "Dev",
"tes": "https://vm-118-138-240-255.erc.monash.edu.au/tes",
"tws": "https://vm-118-138-240-255.erc.monash.edu.au/"
}
]
......@@ -8,7 +8,8 @@
"logout": "https://sshauthz.cloud.cvl.org.au/pysshauthz/oauth2/logout",
"name": "M3 via AAF Central",
"icon": null,
"scope": "user:email"
"scope": "user:email",
"cafp": "RSA SHA256:cmDxHrZQSPlBMUUcI/BWmruXho1XOzfXPDHSqVTwV2I"
},
{
"authorise": "https://sshauthz.cloud.cvl.org.au/pysshauthz/oauth2/oauth/authorize/google",
......@@ -18,7 +19,8 @@
"logout": "https://sshauthz.cloud.cvl.org.au/pysshauthz/oauth2/logout",
"name": "M3 via Google",
"icon": null,
"scope": "user:email"
"scope": "user:email",
"cafp": "RSA SHA256:cmDxHrZQSPlBMUUcI/BWmruXho1XOzfXPDHSqVTwV2I"
},
{
"authorise": "https://sshauthz.cloud.cvl.org.au/pysshauthz/oauth2/oauth/authorize/aafcentral",
......@@ -28,7 +30,8 @@
"logout": "https://sshauthz.cloud.cvl.org.au/pysshauthz/oauth2/logout",
"name": "OzStar via AAF Central",
"icon": null,
"scope": "user:email"
"scope": "user:email",
"cafp": "RSA SHA256:uRYwTJSLksZbwSXYYmOjXh6JzSXpwVnY6o7BYFJc60g"
}
]
[
{
"url": "http://localhost:5200/",
"url": "https://vm-118-138-240-255.erc.monash.edu.au/sbatch/",
"name": "M3",
"host": "m3-login2.massive.org.au",
"dtn": "m3-dtn1.massive.org.au",
"cafingerprint": "RSA SHA256:cmDxHrZQSPlBMUUcI/BWmruXho1XOzfXPDHSqVTwV2I",
"appCatalog": [],
"appCatalogUri": "./assets/config/m3apps.json",
"cancelcmd": "scancel {jobid}",
"statcmd": "/usr/local/sv2/sv2stat.py"
"cancelcmd": "/usr/local/sv2/sv2scancel.sh {jobid}",
"statcmd": "/home/chines/sv2stat.py"
},
{
"url": "https://vm-118-138-240-255.erc.monash.edu.au/m3siteconfig/",
"url": "https://vm-118-138-240-255.erc.monash.edu.au/sbatch/",
"name": "OzStar",
"host": "ozstar.swin.edu.au",
"dtn": "ozstar.swin.edu.au",
......@@ -22,7 +22,7 @@
"statcmd": "/usr/local/sv2/sv2stat.py"
},
{
"url": "https://vm-118-138-240-255.erc.monash.edu.au/m3siteconfig_dev/",
"url": "https://vm-118-138-240-255.erc.monash.edu.au/m3siteconfig/",
"name": "CVL@UWA",
"host": "146.118.65.246",
"dtn": "146.118.65.246",
......
[
{ "url": null,
"name": "Desktop",
"startscript": "#!/bin/bash\n/home/chines/sv2/desktop_novnc/desktop.sh\n ",
"paramscmd": "/home/chines/sv2/desktop_novnc/params.py",
"client": {"cmd": null, "redir": "vnc.html?host=vm-118-138-240-255.erc.monash.edu.au&port=443&password={password}" },
"startscript": "#!/bin/bash\n/usr/local/sv2/desktop/desktop.slurm\n ",
"paramscmd": "/usr/local/sv2/desktop/params.py",
"client": {"cmd": null, "redir": "vnc.html?password={password}" },
"localbind": true,
"applist": null
},
......@@ -19,9 +19,18 @@
{ "url": "transfer",
"name": "Transfer files",
"startscript": "#!/bin/bash\n echo '{appparams}' | /usr/local/sv2/copytool.py\n",
"paramscmd": "/home/chines/sv2/desktop_novnc/params.py",
"paramscmd": "/usr/local/sv2/desktop/params.py",
"client": {"cmd": null, "redir": null },
"localbind": true,
"applist": null
},
{
"url": null,
"name": "CryoSPARC",
"startscript": null,
"paramscmd": "/home/chines/cryosparc_params.py",
"client": {"cmd": null, "redir": ""},
"localbind": true,
"applist": null
}
]
[
{ "url": null,
"name": "Desktop",
"startscript": "#!/bin/bash\n/home/chines/sv2/desktop_novnc/desktop.sh\n ",
"paramscmd": "/home/chines/sv2/desktop_novnc/params.py",
"client": {"cmd": null, "redir": "vnc.html?host=vm-118-138-240-255.erc.monash.edu.au&port=443&password={password}" },
"localbind": true,
"applist": null
},
{ "url": null,
"name": "Guacamole Desktop",
"startscript": "#!/bin/bash\n/home/chines/desktop.sh\n ",
"paramscmd": "/home/chines/vdiparam.py",
"client": {"cmd": null, "redir": "guacamole?username={username}&password={password}" },
"localbind": true,
"applist": null
},
{
"url": null,
"name": "Jupyter Lab",
"startscript": "#!/bin/bash\n/home/chines/jupyter.slurm\n",
"paramscmd": "/home/chines/jupyter_params.py",
"client": {"cmd": null, "redir": "?token={token}"},
"localbind": true,
"applist": null
},
{
"url": null,
"name": "LiberTEM",
"startscript": "eval $(cat /home/chines/libertembatch)",
"paramscmd": "/projects/pMOSP/chines/libertem_venv/bin/python /projects/pMOSP/chines/libertem_venv/bin/server_stat.py",
"client": {"cmd": null, "redir": ""},
"localbind": true,
"applist": null
},
{
"url": null,
"name": "CryoSPARC",
"startscript": null,
"paramscmd": "/home/chines/cryosparc_params.py",
"client": {"cmd": null, "redir": ""},
"localbind": true,
"applist": null
},
{
"url": null,
"name": "R Studio Server",
"startscript": "#!/bin/bash\n/usr/local/sv2/rstudioserver/run.sh\n",
"paramscmd": "/usr/local/sv2/rstudioserver/params.py",
"client": {"cmd": null, "redir": ""},
"localbind": true,
"applist": null
},
{ "url": "transfer",
"name": "Transfer files",
"startscript": "#!/bin/bash\n echo '{appparams}' | /usr/local/sv2/copytool.py\n",
"paramscmd": "/home/chines/sv2/desktop_novnc/params.py",
"client": {"cmd": null, "redir": null },
"localbind": true,
"applist": null
}
]
export const environment = {
production: true,
tesurl: "https://vm-118-138-240-255.erc.monash.edu.au/tes"
tesurl: "https://vm-118-138-240-255.erc.monash.edu.au/tes",
twsurl: "https://vm-118-138-240-255.erc.monash.edu.au/"
};
......@@ -5,5 +5,6 @@
export const environment = {
production: false,
tesurl: "http://localhost:5000"
tesurl: "https://strudel2-test.cloud.cvl.org.au/tes",
twsurl: "https://strudel2-test.cloud.cvl.org.au"
};
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