fix(core): update

This commit is contained in:
2019-09-08 16:34:26 +02:00
parent b5c4727bae
commit 424e911804
6 changed files with 526 additions and 197 deletions

View File

@ -29,9 +29,12 @@ export class DockerHost {
* @param userArg
* @param passArg
*/
public async auth(registryArg: string, userArg: string, passArg: string) {
// TODO: implement Docker Registry authentication
await this.request('POST', '');
public async auth(registryUrl: string, userArg: string, passArg: string) {
const response = await this.request('POST', '/auth', {
serveraddress: registryUrl,
username: userArg,
password: passArg,
});
}
/**
@ -74,9 +77,21 @@ export class DockerHost {
* activates docker swarm
*/
public async activateSwarm(addvertisementIpArg?: string) {
// determine advertisement address
let addvertisementIp: string;
if (addvertisementIpArg) {
addvertisementIp = addvertisementIpArg;
} else {
const smartnetworkInstance = new plugins.smartnetwork.SmartNetwork();
const defaultGateway = await smartnetworkInstance.getDefaultGateway();
if (defaultGateway) {
addvertisementIp = defaultGateway.ipv4.address;
}
}
const response = await this.request('POST', '/swarm/init', {
ListenAddr: '0.0.0.0:2377',
AdvertiseAddr: addvertisementIpArg ? `${addvertisementIpArg}:2377` : undefined,
AdvertiseAddr: addvertisementIp,
DataPathPort: 4789,
DefaultAddrPool: ['10.10.0.0/8', '20.20.0.0/8'],
SubnetSize: 24,

View File

@ -58,6 +58,6 @@ export class DockerService {
}
update() {
// TODO: implemnt updating service
}
}

View File

@ -1,12 +1,13 @@
// @pushrocks scope
import * as lik from '@pushrocks/lik';
import * as smartlog from '@pushrocks/smartlog';
import * as smartnetwork from '@pushrocks/smartnetwork';
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartrequest from '@pushrocks/smartrequest';
smartlog.defaultLogger.enableConsole();
export { lik, smartlog, smartpromise, smartrequest };
export { lik, smartlog, smartnetwork, smartpromise, smartrequest };
// third party
import * as rxjs from 'rxjs';