@kapeta/local-cluster-service 0.19.5 → 0.19.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.19.6](https://github.com/kapetacom/local-cluster-service/compare/v0.19.5...v0.19.6) (2023-09-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Allow more docker opts from language targets ([#71](https://github.com/kapetacom/local-cluster-service/issues/71)) ([dd9e9bb](https://github.com/kapetacom/local-cluster-service/commit/dd9e9bb91fb6aa6d082b1864b268234ece9b8920))
7
+
1
8
  ## [0.19.5](https://github.com/kapetacom/local-cluster-service/compare/v0.19.4...v0.19.5) (2023-09-07)
2
9
 
3
10
 
@@ -135,22 +135,31 @@ class BlockInstanceRunner {
135
135
  const dockerOpts = localContainer.options ?? {};
136
136
  const homeDir = localContainer.userHome ? localContainer.userHome : '/root';
137
137
  const workingDir = localContainer.workingDir ? localContainer.workingDir : '/workspace';
138
+ const customHostConfigs = localContainer.HostConfig ?? {};
139
+ const customLabels = localContainer.Labels ?? {};
140
+ const customEnvs = localContainer.Env ?? [];
141
+ delete localContainer.HostConfig;
142
+ delete localContainer.Labels;
143
+ delete localContainer.Env;
138
144
  const { PortBindings, ExposedPorts, addonEnv } = await this.getDockerPortBindings(blockInstance, assetVersion);
139
145
  let HealthCheck = undefined;
140
146
  if (localContainer.healthcheck) {
141
147
  HealthCheck = containerManager_1.containerManager.toDockerHealth({ cmd: localContainer.healthcheck });
142
148
  }
143
149
  return this.ensureContainer({
150
+ ...dockerOpts,
144
151
  Image: dockerImage,
145
152
  name: containerName,
146
153
  WorkingDir: workingDir,
147
154
  Labels: {
155
+ ...customLabels,
148
156
  instance: blockInstance.id,
149
157
  },
150
158
  HealthCheck,
151
159
  ExposedPorts,
152
160
  Cmd: startCmd ? startCmd.split(/\s+/g) : [],
153
161
  Env: [
162
+ ...customEnvs,
154
163
  ...DOCKER_ENV_VARS,
155
164
  `KAPETA_LOCAL_CLUSTER_PORT=${clusterService_1.clusterService.getClusterServicePort()}`,
156
165
  ...Object.entries({
@@ -159,13 +168,13 @@ class BlockInstanceRunner {
159
168
  }).map(([key, value]) => `${key}=${value}`),
160
169
  ],
161
170
  HostConfig: {
171
+ ...customHostConfigs,
162
172
  Binds: [
163
173
  `${(0, containerManager_1.toLocalBindVolume)(local_cluster_config_1.default.getKapetaBasedir())}:${homeDir}/.kapeta`,
164
174
  `${(0, containerManager_1.toLocalBindVolume)(baseDir)}:${workingDir}`,
165
175
  ],
166
176
  PortBindings,
167
177
  },
168
- ...dockerOpts,
169
178
  });
170
179
  }
171
180
  async _startDockerProcess(blockInstance, blockInfo, env, assetVersion) {
@@ -135,22 +135,31 @@ class BlockInstanceRunner {
135
135
  const dockerOpts = localContainer.options ?? {};
136
136
  const homeDir = localContainer.userHome ? localContainer.userHome : '/root';
137
137
  const workingDir = localContainer.workingDir ? localContainer.workingDir : '/workspace';
138
+ const customHostConfigs = localContainer.HostConfig ?? {};
139
+ const customLabels = localContainer.Labels ?? {};
140
+ const customEnvs = localContainer.Env ?? [];
141
+ delete localContainer.HostConfig;
142
+ delete localContainer.Labels;
143
+ delete localContainer.Env;
138
144
  const { PortBindings, ExposedPorts, addonEnv } = await this.getDockerPortBindings(blockInstance, assetVersion);
139
145
  let HealthCheck = undefined;
140
146
  if (localContainer.healthcheck) {
141
147
  HealthCheck = containerManager_1.containerManager.toDockerHealth({ cmd: localContainer.healthcheck });
142
148
  }
143
149
  return this.ensureContainer({
150
+ ...dockerOpts,
144
151
  Image: dockerImage,
145
152
  name: containerName,
146
153
  WorkingDir: workingDir,
147
154
  Labels: {
155
+ ...customLabels,
148
156
  instance: blockInstance.id,
149
157
  },
150
158
  HealthCheck,
151
159
  ExposedPorts,
152
160
  Cmd: startCmd ? startCmd.split(/\s+/g) : [],
153
161
  Env: [
162
+ ...customEnvs,
154
163
  ...DOCKER_ENV_VARS,
155
164
  `KAPETA_LOCAL_CLUSTER_PORT=${clusterService_1.clusterService.getClusterServicePort()}`,
156
165
  ...Object.entries({
@@ -159,13 +168,13 @@ class BlockInstanceRunner {
159
168
  }).map(([key, value]) => `${key}=${value}`),
160
169
  ],
161
170
  HostConfig: {
171
+ ...customHostConfigs,
162
172
  Binds: [
163
173
  `${(0, containerManager_1.toLocalBindVolume)(local_cluster_config_1.default.getKapetaBasedir())}:${homeDir}/.kapeta`,
164
174
  `${(0, containerManager_1.toLocalBindVolume)(baseDir)}:${workingDir}`,
165
175
  ],
166
176
  PortBindings,
167
177
  },
168
- ...dockerOpts,
169
178
  });
170
179
  }
171
180
  async _startDockerProcess(blockInstance, blockInfo, env, assetVersion) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kapeta/local-cluster-service",
3
- "version": "0.19.5",
3
+ "version": "0.19.6",
4
4
  "description": "Manages configuration, ports and service discovery for locally running Kapeta systems",
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -171,6 +171,13 @@ export class BlockInstanceRunner {
171
171
  const homeDir = localContainer.userHome ? localContainer.userHome : '/root';
172
172
  const workingDir = localContainer.workingDir ? localContainer.workingDir : '/workspace';
173
173
 
174
+ const customHostConfigs = localContainer.HostConfig ?? {};
175
+ const customLabels = localContainer.Labels ?? {};
176
+ const customEnvs = localContainer.Env ?? [];
177
+ delete localContainer.HostConfig;
178
+ delete localContainer.Labels;
179
+ delete localContainer.Env;
180
+
174
181
  const { PortBindings, ExposedPorts, addonEnv } = await this.getDockerPortBindings(blockInstance, assetVersion);
175
182
 
176
183
  let HealthCheck = undefined;
@@ -179,16 +186,19 @@ export class BlockInstanceRunner {
179
186
  }
180
187
 
181
188
  return this.ensureContainer({
189
+ ...dockerOpts,
182
190
  Image: dockerImage,
183
191
  name: containerName,
184
192
  WorkingDir: workingDir,
185
193
  Labels: {
194
+ ...customLabels,
186
195
  instance: blockInstance.id,
187
196
  },
188
197
  HealthCheck,
189
198
  ExposedPorts,
190
199
  Cmd: startCmd ? startCmd.split(/\s+/g) : [],
191
200
  Env: [
201
+ ...customEnvs,
192
202
  ...DOCKER_ENV_VARS,
193
203
  `KAPETA_LOCAL_CLUSTER_PORT=${clusterService.getClusterServicePort()}`,
194
204
  ...Object.entries({
@@ -197,13 +207,13 @@ export class BlockInstanceRunner {
197
207
  }).map(([key, value]) => `${key}=${value}`),
198
208
  ],
199
209
  HostConfig: {
210
+ ...customHostConfigs,
200
211
  Binds: [
201
212
  `${toLocalBindVolume(ClusterConfig.getKapetaBasedir())}:${homeDir}/.kapeta`,
202
213
  `${toLocalBindVolume(baseDir)}:${workingDir}`,
203
214
  ],
204
215
  PortBindings,
205
216
  },
206
- ...dockerOpts,
207
217
  });
208
218
  }
209
219