@kapeta/local-cluster-service 0.16.5 → 0.16.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.16.6](https://github.com/kapetacom/local-cluster-service/compare/v0.16.5...v0.16.6) (2023-08-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Add timeout when testing docker ([#62](https://github.com/kapetacom/local-cluster-service/issues/62)) ([c6e373e](https://github.com/kapetacom/local-cluster-service/commit/c6e373eab81f466b5a4fd8dbd9ca9f085f9b91de))
7
+
1
8
  ## [0.16.5](https://github.com/kapetacom/local-cluster-service/compare/v0.16.4...v0.16.5) (2023-08-14)
2
9
 
3
10
 
package/dist/cjs/index.js CHANGED
@@ -100,6 +100,7 @@ exports.default = {
100
100
  throw new Error('Server already started');
101
101
  }
102
102
  try {
103
+ console.log('Testing docker runtime...');
103
104
  await containerManager_1.containerManager.initialize();
104
105
  }
105
106
  catch (e) {
@@ -62,7 +62,10 @@ class ContainerManager {
62
62
  ];
63
63
  for (const opts of connectOptions) {
64
64
  try {
65
- const client = new node_docker_api_1.Docker(opts);
65
+ const client = new node_docker_api_1.Docker({
66
+ ...opts,
67
+ timeout: 10000,
68
+ });
66
69
  await client.ping();
67
70
  this._docker = client;
68
71
  const versionInfo = await client.version();
@@ -18,7 +18,7 @@ class ProviderManager {
18
18
  const id = `${handle}/${name}/${version}/web.js${sourceMap ? '.map' : ''}`;
19
19
  const cacheKey = `provider:web:${id}`;
20
20
  const file = cacheManager_1.cacheManager.get(cacheKey);
21
- if (file && await fs_extra_1.default.pathExists(file)) {
21
+ if (file && (await fs_extra_1.default.pathExists(file))) {
22
22
  return fs_extra_1.default.readFile(file, 'utf8');
23
23
  }
24
24
  await repositoryManager_1.repositoryManager.ensureAsset(handle, name, version, true);
@@ -43,6 +43,7 @@ if (providerDefinitions.length > 0) {
43
43
  console.log(' - %s[%s:%s]', providerDefinition.definition.kind, providerDefinition.definition.metadata.name, providerDefinition.version);
44
44
  console.log(' from %s', providerDefinition.path);
45
45
  });
46
+ console.log('##');
46
47
  }
47
48
  else {
48
49
  console.log('## No providers found ##');
package/dist/esm/index.js CHANGED
@@ -95,6 +95,7 @@ export default {
95
95
  throw new Error('Server already started');
96
96
  }
97
97
  try {
98
+ console.log('Testing docker runtime...');
98
99
  await containerManager.initialize();
99
100
  }
100
101
  catch (e) {
@@ -56,7 +56,10 @@ class ContainerManager {
56
56
  ];
57
57
  for (const opts of connectOptions) {
58
58
  try {
59
- const client = new Docker(opts);
59
+ const client = new Docker({
60
+ ...opts,
61
+ timeout: 10000,
62
+ });
60
63
  await client.ping();
61
64
  this._docker = client;
62
65
  const versionInfo = await client.version();
@@ -2,7 +2,7 @@ import Path from 'path';
2
2
  import FSExtra from 'fs-extra';
3
3
  import { repositoryManager } from './repositoryManager';
4
4
  import { definitionsManager } from './definitionsManager';
5
- import { cacheManager } from "./cacheManager";
5
+ import { cacheManager } from './cacheManager';
6
6
  class ProviderManager {
7
7
  getWebProviders() {
8
8
  return definitionsManager.getProviderDefinitions().filter((providerDefinition) => providerDefinition.hasWeb);
@@ -12,7 +12,7 @@ class ProviderManager {
12
12
  const id = `${handle}/${name}/${version}/web.js${sourceMap ? '.map' : ''}`;
13
13
  const cacheKey = `provider:web:${id}`;
14
14
  const file = cacheManager.get(cacheKey);
15
- if (file && await FSExtra.pathExists(file)) {
15
+ if (file && (await FSExtra.pathExists(file))) {
16
16
  return FSExtra.readFile(file, 'utf8');
17
17
  }
18
18
  await repositoryManager.ensureAsset(handle, name, version, true);
@@ -37,6 +37,7 @@ if (providerDefinitions.length > 0) {
37
37
  console.log(' - %s[%s:%s]', providerDefinition.definition.kind, providerDefinition.definition.metadata.name, providerDefinition.version);
38
38
  console.log(' from %s', providerDefinition.path);
39
39
  });
40
+ console.log('##');
40
41
  }
41
42
  else {
42
43
  console.log('## No providers found ##');
package/index.ts CHANGED
@@ -114,6 +114,7 @@ export default {
114
114
  }
115
115
 
116
116
  try {
117
+ console.log('Testing docker runtime...');
117
118
  await containerManager.initialize();
118
119
  } catch (e: any) {
119
120
  console.error(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kapeta/local-cluster-service",
3
- "version": "0.16.5",
3
+ "version": "0.16.6",
4
4
  "description": "Manages configuration, ports and service discovery for locally running Kapeta systems",
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -110,7 +110,10 @@ class ContainerManager {
110
110
  ];
111
111
  for (const opts of connectOptions) {
112
112
  try {
113
- const client = new Docker(opts);
113
+ const client = new Docker({
114
+ ...opts,
115
+ timeout: 10000,
116
+ });
114
117
  await client.ping();
115
118
  this._docker = client;
116
119
  const versionInfo: any = await client.version();
@@ -4,11 +4,9 @@ import { repositoryManager } from './repositoryManager';
4
4
  import ClusterConfiguration from '@kapeta/local-cluster-config';
5
5
  import { StringMap } from './types';
6
6
  import { definitionsManager } from './definitionsManager';
7
- import {cacheManager} from "./cacheManager";
7
+ import { cacheManager } from './cacheManager';
8
8
 
9
9
  class ProviderManager {
10
-
11
-
12
10
  getWebProviders() {
13
11
  return definitionsManager.getProviderDefinitions().filter((providerDefinition) => providerDefinition.hasWeb);
14
12
  }
@@ -20,7 +18,7 @@ class ProviderManager {
20
18
  const cacheKey = `provider:web:${id}`;
21
19
 
22
20
  const file = cacheManager.get<string>(cacheKey);
23
- if (file && await FSExtra.pathExists(file)) {
21
+ if (file && (await FSExtra.pathExists(file))) {
24
22
  return FSExtra.readFile(file, 'utf8');
25
23
  }
26
24
 
@@ -34,7 +32,7 @@ class ProviderManager {
34
32
  //Check locally installed providers
35
33
  const path = Path.join(installedProvider.path, 'web', handle, `${name}.js${sourceMap ? '.map' : ''}`);
36
34
  if (await FSExtra.pathExists(path)) {
37
- cacheManager.set(cacheKey, path, 24* 60 * 60 * 1000);
35
+ cacheManager.set(cacheKey, path, 24 * 60 * 60 * 1000);
38
36
  return FSExtra.readFile(path);
39
37
  }
40
38
  }
@@ -56,6 +54,7 @@ if (providerDefinitions.length > 0) {
56
54
  );
57
55
  console.log(' from %s', providerDefinition.path);
58
56
  });
57
+ console.log('##');
59
58
  } else {
60
59
  console.log('## No providers found ##');
61
60
  }