cyberia 3.0.1 → 3.0.2

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.
Files changed (49) hide show
  1. package/.github/workflows/engine-cyberia.cd.yml +1 -0
  2. package/CHANGELOG.md +56 -1
  3. package/CLI-HELP.md +2 -4
  4. package/README.md +139 -0
  5. package/bin/build.js +5 -0
  6. package/bin/cyberia.js +385 -71
  7. package/bin/deploy.js +18 -26
  8. package/bin/file.js +3 -0
  9. package/bin/index.js +385 -71
  10. package/conf.js +32 -3
  11. package/deployment.yaml +2 -2
  12. package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +1 -1
  13. package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +1 -1
  14. package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
  15. package/manifests/deployment/dd-test-development/deployment.yaml +2 -2
  16. package/manifests/ipfs/configmap.yaml +7 -0
  17. package/package.json +8 -8
  18. package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.controller.js +2 -0
  19. package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.model.js +7 -0
  20. package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.service.js +93 -2
  21. package/src/api/file/file.controller.js +3 -13
  22. package/src/api/file/file.ref.json +0 -21
  23. package/src/api/ipfs/ipfs.controller.js +104 -0
  24. package/src/api/ipfs/ipfs.model.js +71 -0
  25. package/src/api/ipfs/ipfs.router.js +31 -0
  26. package/src/api/ipfs/ipfs.service.js +193 -0
  27. package/src/api/object-layer/README.md +139 -0
  28. package/src/api/object-layer/object-layer.controller.js +3 -0
  29. package/src/api/object-layer/object-layer.model.js +15 -1
  30. package/src/api/object-layer/object-layer.router.js +6 -10
  31. package/src/api/object-layer/object-layer.service.js +311 -182
  32. package/src/cli/cluster.js +30 -38
  33. package/src/cli/index.js +0 -1
  34. package/src/cli/run.js +14 -0
  35. package/src/client/components/core/LoadingAnimation.js +2 -3
  36. package/src/client/components/core/Modal.js +1 -1
  37. package/src/client/components/cyberia/ObjectLayerEngineModal.js +4 -5
  38. package/src/client/components/cyberia/ObjectLayerEngineViewer.js +280 -29
  39. package/src/client/services/ipfs/ipfs.service.js +144 -0
  40. package/src/client/services/object-layer/object-layer.management.js +161 -8
  41. package/src/index.js +1 -1
  42. package/src/runtime/express/Express.js +1 -1
  43. package/src/server/auth.js +18 -18
  44. package/src/server/ipfs-client.js +433 -0
  45. package/src/server/object-layer.js +649 -18
  46. package/src/server/semantic-layer-generator.js +1083 -0
  47. package/src/server/shape-generator.js +952 -0
  48. package/test/shape-generator.test.js +457 -0
  49. package/bin/ssl.js +0 -63
@@ -37,7 +37,6 @@ class UnderpostCluster {
37
37
  * @param {boolean} [options.postgresql=false] - Deploy PostgreSQL.
38
38
  * @param {boolean} [options.valkey=false] - Deploy Valkey.
39
39
  * @param {boolean} [options.ipfs=false] - Deploy ipfs-cluster statefulset.
40
- * @param {boolean} [options.full=false] - Deploy a full set of common components.
41
40
  * @param {boolean} [options.info=false] - Display extensive Kubernetes cluster information.
42
41
  * @param {boolean} [options.certManager=false] - Deploy Cert-Manager for certificate management.
43
42
  * @param {boolean} [options.listPods=false] - List Kubernetes pods.
@@ -75,7 +74,6 @@ class UnderpostCluster {
75
74
  postgresql: false,
76
75
  valkey: false,
77
76
  ipfs: false,
78
- full: false,
79
77
  info: false,
80
78
  certManager: false,
81
79
  listPods: false,
@@ -102,26 +100,22 @@ class UnderpostCluster {
102
100
  replicas: '',
103
101
  },
104
102
  ) {
105
- // Handles initial host setup (installing docker, podman, kind, kubeadm, helm)
106
- if (options.initHost === true) return Underpost.cluster.initHost();
103
+ if (options.initHost) return Underpost.cluster.initHost();
107
104
 
108
- // Handles initial host setup (installing docker, podman, kind, kubeadm, helm)
109
- if (options.uninstallHost === true) return Underpost.cluster.uninstallHost();
105
+ if (options.uninstallHost) return Underpost.cluster.uninstallHost();
110
106
 
111
- // Applies general host configuration (SELinux, containerd, sysctl)
112
- if (options.config === true) return Underpost.cluster.config();
107
+ if (options.config) return Underpost.cluster.config();
113
108
 
114
- // Sets up kubectl configuration for the current user
115
- if (options.chown === true) return Underpost.cluster.chown();
109
+ if (options.chown) return Underpost.cluster.chown();
116
110
 
117
111
  const npmRoot = getNpmRootPath();
118
- const underpostRoot = options?.dev === true ? '.' : `${npmRoot}/underpost`;
112
+ const underpostRoot = options.dev ? '.' : `${npmRoot}/underpost`;
119
113
 
120
- if (options.listPods === true) return console.table(Underpost.deploy.get(podName ?? undefined));
114
+ if (options.listPods) return console.table(Underpost.deploy.get(podName ?? undefined));
121
115
  // Set default namespace if not specified
122
116
  if (!options.namespace) options.namespace = 'default';
123
117
 
124
- if (options.nsUse && typeof options.nsUse === 'string') {
118
+ if (options.nsUse) {
125
119
  // Verify if namespace exists, create if not
126
120
  const namespaceExists = shellExec(`kubectl get namespace ${options.nsUse} --ignore-not-found -o name`, {
127
121
  stdout: true,
@@ -142,8 +136,8 @@ class UnderpostCluster {
142
136
  }
143
137
 
144
138
  // Reset Kubernetes cluster components (Kind/Kubeadm/K3s) and container runtimes
145
- if (options.reset === true) {
146
- const clusterType = options.k3s === true ? 'k3s' : options.kubeadm === true ? 'kubeadm' : 'kind';
139
+ if (options.reset) {
140
+ const clusterType = options.k3s ? 'k3s' : options.kubeadm ? 'kubeadm' : 'kind';
147
141
  return await Underpost.cluster.safeReset({
148
142
  underpostRoot,
149
143
  removeVolumeHostPaths: options.removeVolumeHostPaths,
@@ -160,7 +154,7 @@ class UnderpostCluster {
160
154
  // --- Kubeadm/Kind/K3s Cluster Initialization ---
161
155
  if (!alreadyKubeadmCluster && !alreadyKindCluster && !alreadyK3sCluster) {
162
156
  Underpost.cluster.config();
163
- if (options.k3s === true) {
157
+ if (options.k3s) {
164
158
  logger.info('Initializing K3s control plane...');
165
159
  // Install K3s
166
160
  logger.info('Installing K3s...');
@@ -172,7 +166,7 @@ class UnderpostCluster {
172
166
  logger.info('Waiting for K3s to be ready...');
173
167
  shellExec(`sudo systemctl is-active --wait k3s || sudo systemctl wait --for=active k3s.service`);
174
168
  logger.info('K3s service is active.');
175
- } else if (options.kubeadm === true) {
169
+ } else if (options.kubeadm) {
176
170
  logger.info('Initializing Kubeadm control plane...');
177
171
  // Set default values if not provided
178
172
  const podNetworkCidr = options.podNetworkCidr || '192.168.0.0/16';
@@ -208,7 +202,7 @@ class UnderpostCluster {
208
202
  logger.info('Initializing Kind cluster...');
209
203
  shellExec(
210
204
  `cd ${underpostRoot}/manifests && kind create cluster --config kind-config${
211
- options?.dev === true ? '-dev' : ''
205
+ options.dev ? '-dev' : ''
212
206
  }.yaml`,
213
207
  );
214
208
  Underpost.cluster.chown('kind'); // Pass 'kind' to chown
@@ -218,14 +212,12 @@ class UnderpostCluster {
218
212
  // --- Optional Component Deployments (Databases, Ingress, Cert-Manager) ---
219
213
  // These deployments happen after the base cluster is up.
220
214
 
221
- if (options.full === true || options.dedicatedGpu === true) {
215
+ if (options.dedicatedGpu) {
222
216
  shellExec(`node ${underpostRoot}/bin/deploy nvidia-gpu-operator`);
223
- shellExec(
224
- `node ${underpostRoot}/bin/deploy kubeflow-spark-operator${options.kubeadm === true ? ' kubeadm' : ''}`,
225
- );
217
+ shellExec(`node ${underpostRoot}/bin/deploy kubeflow-spark-operator${options.kubeadm ? ' kubeadm' : ''}`);
226
218
  }
227
219
 
228
- if (options.grafana === true) {
220
+ if (options.grafana) {
229
221
  shellExec(`kubectl delete deployment grafana -n ${options.namespace} --ignore-not-found`);
230
222
  shellExec(`kubectl apply -k ${underpostRoot}/manifests/grafana -n ${options.namespace}`);
231
223
  const yaml = `${fs
@@ -238,7 +230,7 @@ EOF
238
230
  `);
239
231
  }
240
232
 
241
- if (options.prom && typeof options.prom === 'string') {
233
+ if (options.prom) {
242
234
  shellExec(`kubectl delete deployment prometheus --ignore-not-found`);
243
235
  shellExec(`kubectl delete configmap prometheus-config --ignore-not-found`);
244
236
  shellExec(`kubectl delete service prometheus --ignore-not-found`);
@@ -257,8 +249,8 @@ EOF
257
249
  `);
258
250
  }
259
251
 
260
- if (options.full === true || options.valkey === true) {
261
- if (options.pullImage === true) Underpost.cluster.pullImage('valkey/valkey:latest', options);
252
+ if (options.valkey) {
253
+ if (options.pullImage) Underpost.cluster.pullImage('valkey/valkey:latest', options);
262
254
  shellExec(`kubectl delete statefulset valkey-service -n ${options.namespace} --ignore-not-found`);
263
255
  shellExec(`kubectl apply -k ${underpostRoot}/manifests/valkey -n ${options.namespace}`);
264
256
  await Underpost.test.statusMonitor('valkey-service', 'Running', 'pods', 1000, 60 * 10);
@@ -266,17 +258,17 @@ EOF
266
258
  if (options.ipfs) {
267
259
  await Underpost.ipfs.deploy(options, underpostRoot);
268
260
  }
269
- if (options.full === true || options.mariadb === true) {
261
+ if (options.mariadb) {
270
262
  shellExec(
271
263
  `sudo kubectl create secret generic mariadb-secret --from-file=username=/home/dd/engine/engine-private/mariadb-username --from-file=password=/home/dd/engine/engine-private/mariadb-password --dry-run=client -o yaml | kubectl apply -f - -n ${options.namespace}`,
272
264
  );
273
265
  shellExec(`kubectl delete statefulset mariadb-statefulset -n ${options.namespace} --ignore-not-found`);
274
266
 
275
- if (options.pullImage === true) Underpost.cluster.pullImage('mariadb:latest', options);
267
+ if (options.pullImage) Underpost.cluster.pullImage('mariadb:latest', options);
276
268
  shellExec(`kubectl apply -f ${underpostRoot}/manifests/mariadb/storage-class.yaml -n ${options.namespace}`);
277
269
  shellExec(`kubectl apply -k ${underpostRoot}/manifests/mariadb -n ${options.namespace}`);
278
270
  }
279
- if (options.full === true || options.mysql === true) {
271
+ if (options.mysql) {
280
272
  shellExec(
281
273
  `sudo kubectl create secret generic mysql-secret --from-file=username=/home/dd/engine/engine-private/mysql-username --from-file=password=/home/dd/engine/engine-private/mysql-password --dry-run=client -o yaml | kubectl apply -f - -n ${options.namespace}`,
282
274
  );
@@ -285,15 +277,15 @@ EOF
285
277
  shellExec(`sudo chown -R $(whoami):$(whoami) /mnt/data`);
286
278
  shellExec(`kubectl apply -k ${underpostRoot}/manifests/mysql -n ${options.namespace}`);
287
279
  }
288
- if (options.full === true || options.postgresql === true) {
289
- if (options.pullImage === true) Underpost.cluster.pullImage('postgres:latest', options);
280
+ if (options.postgresql) {
281
+ if (options.pullImage) Underpost.cluster.pullImage('postgres:latest', options);
290
282
  shellExec(
291
283
  `sudo kubectl create secret generic postgres-secret --from-file=password=/home/dd/engine/engine-private/postgresql-password --dry-run=client -o yaml | kubectl apply -f - -n ${options.namespace}`,
292
284
  );
293
285
  shellExec(`kubectl apply -k ${underpostRoot}/manifests/postgresql -n ${options.namespace}`);
294
286
  }
295
- if (options.mongodb4 === true) {
296
- if (options.pullImage === true) Underpost.cluster.pullImage('mongo:4.4', options);
287
+ if (options.mongodb4) {
288
+ if (options.pullImage) Underpost.cluster.pullImage('mongo:4.4', options);
297
289
  shellExec(`kubectl apply -k ${underpostRoot}/manifests/mongodb-4.4 -n ${options.namespace}`);
298
290
 
299
291
  const deploymentName = 'mongodb-deployment';
@@ -314,8 +306,8 @@ EOF
314
306
  --eval 'rs.initiate(${JSON.stringify(mongoConfig)})'`,
315
307
  );
316
308
  }
317
- } else if (options.full === true || options.mongodb === true) {
318
- if (options.pullImage === true) Underpost.cluster.pullImage('mongo:latest', options);
309
+ } else if (options.mongodb) {
310
+ if (options.pullImage) Underpost.cluster.pullImage('mongo:latest', options);
319
311
  shellExec(
320
312
  `sudo kubectl create secret generic mongodb-keyfile --from-file=/home/dd/engine/engine-private/mongodb-keyfile --dry-run=client -o yaml | kubectl apply -f - -n ${options.namespace}`,
321
313
  );
@@ -344,11 +336,11 @@ EOF
344
336
  }
345
337
  }
346
338
 
347
- if (options.full === true || options.contour === true) {
339
+ if (options.contour) {
348
340
  shellExec(
349
341
  `kubectl apply -f https://cdn.jsdelivr.net/gh/projectcontour/contour@release-1.33/examples/render/contour.yaml`,
350
342
  );
351
- if (options.kubeadm === true) {
343
+ if (options.kubeadm) {
352
344
  // Envoy service might need NodePort for kubeadm
353
345
  shellExec(
354
346
  `sudo kubectl apply -f ${underpostRoot}/manifests/envoy-service-nodeport.yaml -n ${options.namespace}`,
@@ -358,7 +350,7 @@ EOF
358
350
  // so a specific NodePort service might not be needed or can be configured differently.
359
351
  }
360
352
 
361
- if (options.full === true || options.certManager === true) {
353
+ if (options.certManager) {
362
354
  if (!Underpost.deploy.get('cert-manager').find((p) => p.STATUS === 'Running')) {
363
355
  shellExec(`helm repo add jetstack https://charts.jetstack.io --force-update`);
364
356
  shellExec(
package/src/cli/index.js CHANGED
@@ -218,7 +218,6 @@ program
218
218
  .option('--contour', 'Initializes the cluster with Project Contour base HTTPProxy and Envoy.')
219
219
  .option('--cert-manager', "Initializes the cluster with a Let's Encrypt production ClusterIssuer.")
220
220
  .option('--dedicated-gpu', 'Initializes the cluster with dedicated GPU base resources and environment settings.')
221
- .option('--full', 'Initializes the cluster with all available statefulsets and services.')
222
221
  .option(
223
222
  '--ns-use <ns-name>',
224
223
  "Switches the current Kubernetes context to the specified namespace (creates if it doesn't exist).",
package/src/cli/run.js CHANGED
@@ -217,6 +217,20 @@ class UnderpostRun {
217
217
  }
218
218
  },
219
219
 
220
+ /**
221
+ * @method ipfs-expose
222
+ * @description Exposes IPFS Cluster services on specified ports for local access.
223
+ * @type {Function}
224
+ * @memberof UnderpostRun
225
+ */
226
+ 'ipfs-expose': (path, options = DEFAULT_OPTION) => {
227
+ const ports = [5001, 9094, 8080];
228
+ for (const port of ports)
229
+ shellExec(`node bin deploy --expose ipfs-cluster --expose-port ${port} --disable-update-underpost-config`, {
230
+ async: true,
231
+ });
232
+ },
233
+
220
234
  /**
221
235
  * @method metadata
222
236
  * @description Generates metadata for the specified path after exposing the development cluster.
@@ -27,8 +27,8 @@ const LoadingAnimation = {
27
27
  ? subThemeManager.darkColor
28
28
  : `#66e400`
29
29
  : subThemeManager.lightColor
30
- ? subThemeManager.lightColor
31
- : `#157e00`};"
30
+ ? subThemeManager.lightColor
31
+ : `#157e00`};"
32
32
  ></div>
33
33
  `,
34
34
  );
@@ -131,7 +131,6 @@ const LoadingAnimation = {
131
131
  if (!backgroundContainer) backgroundContainer = '.ssr-background';
132
132
  if (s(backgroundContainer)) {
133
133
  s(backgroundContainer).style.display = 'none';
134
- if (s(`.main-body-btn-container`)) s(`.main-body-btn-container`).classList.remove('hide');
135
134
  if (callBack) callBack();
136
135
  }
137
136
  },
@@ -322,7 +322,7 @@ const Modal = {
322
322
  'body',
323
323
  html`
324
324
  <div
325
- class="abs main-body-btn-container hide"
325
+ class="abs main-body-btn-container"
326
326
  style="top: ${options.heightTopBar + 50}px; z-index: 9; ${true ||
327
327
  (options.mode && options.mode.match('right'))
328
328
  ? 'right'
@@ -195,7 +195,7 @@ const ObjectLayerEngineModal = {
195
195
  const itemTypes = ['skin', 'weapon', 'armor', 'artifact', 'floor'];
196
196
  const statTypes = ['effect', 'resistance', 'agility', 'range', 'intelligence', 'utility'];
197
197
 
198
- // Check if we have a 'cid' query parameter to load existing object layer
198
+ // Check if we have an 'id' query parameter to load existing object layer
199
199
  const queryParams = getQueryParams();
200
200
  let loadedData = null;
201
201
 
@@ -302,9 +302,9 @@ const ObjectLayerEngineModal = {
302
302
  });
303
303
  };
304
304
 
305
- if (queryParams.cid) {
306
- ObjectLayerEngineModal.existingObjectLayerId = queryParams.cid;
307
- loadedData = await ObjectLayerEngineModal.loadFromDatabase(queryParams.cid);
305
+ if (queryParams.id) {
306
+ ObjectLayerEngineModal.existingObjectLayerId = queryParams.id;
307
+ loadedData = await ObjectLayerEngineModal.loadFromDatabase(queryParams.id);
308
308
 
309
309
  if (loadedData) {
310
310
  const { metadata, objectLayerRenderFramesId } = loadedData;
@@ -1257,7 +1257,6 @@ const ObjectLayerEngineModal = {
1257
1257
  setPath(`${getProxyPath()}object-layer-engine-management`);
1258
1258
  const queryParams = getQueryParams();
1259
1259
  queryParams.id = id ? id : '';
1260
- queryParams.cid = '';
1261
1260
  queryParams.page = 1;
1262
1261
  setQueryParams(queryParams, { replace: true });
1263
1262