Add docker compose service for control center

This commit is contained in:
David Eder 2021-06-12 12:47:04 +02:00
parent 8ac8c994d6
commit 9d4727d681
6 changed files with 16 additions and 61 deletions

View File

@ -6,7 +6,6 @@ import {LandingComponent} from './component/landing/landing.component';
import {RestService} from './services/rest.service';
import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http';
import {InterceptorService} from './services/interceptor.service';
import {WebsocketService} from './services/websocket.service';
import {LoggerModule, NgxLoggerLevel} from 'ngx-logger';
import {environment} from '../environments/environment';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
@ -39,7 +38,6 @@ import {AgmCoreModule, GoogleMapsAPIWrapper} from '@agm/core';
providers: [
GoogleMapsAPIWrapper,
RestService,
WebsocketService,
{
provide: HTTP_INTERCEPTORS, useClass: InterceptorService, multi: true
},

View File

@ -1,52 +0,0 @@
import {Injectable} from '@angular/core';
import {NGXLogger} from 'ngx-logger';
import {fromEvent, interval, Observable} from 'rxjs';
import {environment} from '../../environments/environment';
import {WSEvents} from '../interfaces/interface';
@Injectable({
providedIn: 'root'
})
export class WebsocketService {
private wsEndpoint = environment.ws_location + ':' + environment.ws_port + '/test-ws-endpoint/';
private readonly ws: WebSocket;
private wsEvents: WSEvents;
constructor(private logger: NGXLogger) {
this.logger.debug('Initiating ws connection on', this.wsEndpoint);
this.ws = new WebSocket(this.wsEndpoint);
interval(5000).subscribe(() => {
// continuously check if the connection is still open
if (this.ws.readyState !== WebSocket.OPEN) {
this.logger.error('Lost websocket connection ...', this.ws);
}
});
}
wsTestCall(msg: string): WSEvents {
this.logger.debug(
'Performing ws test call',
'current ws ready state ==', this.ws.readyState + ',',
'expected == 1 == open');
if (this.ws.readyState === WebSocket.OPEN) {
this.ws.send(msg);
} else {
return undefined;
}
if (!this.wsEvents) {
this.wsEvents = {
message: fromEvent(this.ws, 'message'),
error: fromEvent(this.ws, 'error'),
close: fromEvent(this.ws, 'close')
};
}
return this.wsEvents;
}
}

View File

@ -2,8 +2,7 @@ import {NgxLoggerLevel} from 'ngx-logger';
export const environment = {
production: true,
location: window.location.hostname,
location: 'xway',
port: 5004,
ws_url_root: 'ws://' + window.location.hostname + ':' + window.location.port + '/',
log_level: NgxLoggerLevel.WARN,
};

View File

@ -6,10 +6,8 @@ import {NgxLoggerLevel} from 'ngx-logger';
export const environment = {
production: false,
location: 'xwayserver',
location: 'xway',
port: 5004,
ws_location: 'ws://127.0.0.1',
ws_port: 8000,
log_level: NgxLoggerLevel.DEBUG,
};

View File

@ -1,3 +1,5 @@
flask
Flask-Cors
requests
requests
Flask-PyMongo
jsonify

View File

@ -75,4 +75,14 @@ services:
depends_on:
- entityident
- orchestration
- eventstore
- eventstore
controlcenter:
build:
context: ../components/control_center
dockerfile: Dockerfile
expose:
- 80
ports:
- 80:80
depends_on:
- xway