fix(core): update

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

676
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -27,19 +27,20 @@
},
"homepage": "https://gitlab.com/pushrocks/dockersock#README",
"dependencies": {
"@pushrocks/lik": "^3.0.10",
"@pushrocks/lik": "^3.0.11",
"@pushrocks/smartlog": "^2.0.19",
"@pushrocks/smartnetwork": "^1.1.14",
"@pushrocks/smartpromise": "^3.0.2",
"@pushrocks/smartrequest": "^1.1.16",
"rxjs": "^6.5.2"
"@pushrocks/smartrequest": "^1.1.23",
"rxjs": "^6.5.3"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.11",
"@gitzone/tsbuild": "^2.1.17",
"@gitzone/tsrun": "^1.2.8",
"@gitzone/tstest": "^1.0.24",
"@pushrocks/tapbundle": "^3.0.11",
"@types/node": "^12.7.1",
"tslint": "^5.18.0",
"@pushrocks/tapbundle": "^3.0.13",
"@types/node": "^12.7.4",
"tslint": "^5.19.0",
"tslint-config-prettier": "^1.18.0"
},
"files": [

View File

@ -9,6 +9,10 @@ tap.test('should create a new Dockersock instance', async () => {
return expect(testDockerHost).to.be.instanceof(docker.DockerHost);
});
tap.test('should create a docker swarm', async () => {
});
// Containers
tap.test('should list containers', async () => {
const containers = await testDockerHost.getContainers();

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';