fix(core): update
This commit is contained in:
		
							
								
								
									
										4
									
								
								license
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								license
									
									
									
									
									
								
							@@ -1,4 +1,6 @@
 | 
				
			|||||||
Copyright (c) 2019 Lossless GmbH (hello@lossless.com)
 | 
					The MIT License (MIT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Copyright (c) 2019 Task Venture Capital GmbH (hello@task.vc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
					Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
				
			||||||
of this software and associated documentation files (the "Software"), to deal
 | 
					of this software and associated documentation files (the "Software"), to deal
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										19
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								package.json
									
									
									
									
									
								
							@@ -16,28 +16,29 @@
 | 
				
			|||||||
    "spark": "./cli.js"
 | 
					    "spark": "./cli.js"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "@git.zone/tsbuild": "^2.1.29",
 | 
					    "@git.zone/tsbuild": "^2.1.80",
 | 
				
			||||||
    "@git.zone/tsrun": "^1.2.39",
 | 
					    "@git.zone/tsrun": "^1.2.39",
 | 
				
			||||||
    "@git.zone/tstest": "^1.0.60",
 | 
					    "@git.zone/tstest": "^1.0.60",
 | 
				
			||||||
    "@push.rocks/tapbundle": "^5.0.4",
 | 
					    "@push.rocks/tapbundle": "^5.0.4",
 | 
				
			||||||
    "@types/node": "20.10.0"
 | 
					    "@types/node": "20.14.2"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "@apiclient.xyz/docker": "^1.0.103",
 | 
					    "@apiclient.xyz/docker": "^1.2.2",
 | 
				
			||||||
    "@push.rocks/npmextra": "^5.0.13",
 | 
					    "@push.rocks/npmextra": "^5.0.17",
 | 
				
			||||||
    "@push.rocks/projectinfo": "^5.0.1",
 | 
					    "@push.rocks/projectinfo": "^5.0.1",
 | 
				
			||||||
    "@push.rocks/qenv": "^6.0.5",
 | 
					    "@push.rocks/qenv": "^6.0.5",
 | 
				
			||||||
    "@push.rocks/smartcli": "^4.0.6",
 | 
					    "@push.rocks/smartcli": "^4.0.11",
 | 
				
			||||||
    "@push.rocks/smartdaemon": "^2.0.3",
 | 
					    "@push.rocks/smartdaemon": "^2.0.3",
 | 
				
			||||||
    "@push.rocks/smartdelay": "^3.0.5",
 | 
					    "@push.rocks/smartdelay": "^3.0.5",
 | 
				
			||||||
    "@push.rocks/smartfile": "^11.0.14",
 | 
					    "@push.rocks/smartfile": "^11.0.20",
 | 
				
			||||||
    "@push.rocks/smartjson": "^5.0.5",
 | 
					    "@push.rocks/smartjson": "^5.0.20",
 | 
				
			||||||
    "@push.rocks/smartlog": "^3.0.3",
 | 
					    "@push.rocks/smartlog": "^3.0.7",
 | 
				
			||||||
    "@push.rocks/smartlog-destination-local": "^9.0.0",
 | 
					    "@push.rocks/smartlog-destination-local": "^9.0.0",
 | 
				
			||||||
    "@push.rocks/smartpath": "^5.0.5",
 | 
					    "@push.rocks/smartpath": "^5.0.5",
 | 
				
			||||||
    "@push.rocks/smartshell": "^3.0.5",
 | 
					    "@push.rocks/smartshell": "^3.0.5",
 | 
				
			||||||
    "@push.rocks/smartupdate": "^2.0.4",
 | 
					    "@push.rocks/smartupdate": "^2.0.4",
 | 
				
			||||||
    "@push.rocks/taskbuffer": "^3.0.10"
 | 
					    "@push.rocks/taskbuffer": "^3.0.10",
 | 
				
			||||||
 | 
					    "@serve.zone/interfaces": "^1.0.74"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "files": [
 | 
					  "files": [
 | 
				
			||||||
    "ts/**/*",
 | 
					    "ts/**/*",
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										7881
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										7881
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -3,6 +3,6 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
export const commitinfo = {
 | 
					export const commitinfo = {
 | 
				
			||||||
  name: '@serve.zone/spark',
 | 
					  name: '@serve.zone/spark',
 | 
				
			||||||
  version: '1.0.85',
 | 
					  version: '1.0.86',
 | 
				
			||||||
  description: 'A tool to maintain and configure servers on the base OS level for the Servezone infrastructure.'
 | 
					  description: 'A tool to maintain and configure servers on the base OS level for the Servezone infrastructure.'
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@ export class SparkUpdateManager {
 | 
				
			|||||||
  public smartupdate: plugins.smartupdate.SmartUpdate;
 | 
					  public smartupdate: plugins.smartupdate.SmartUpdate;
 | 
				
			||||||
  constructor(sparkrefArg: Spark) {
 | 
					  constructor(sparkrefArg: Spark) {
 | 
				
			||||||
    this.sparkRef = sparkrefArg;
 | 
					    this.sparkRef = sparkrefArg;
 | 
				
			||||||
    this.dockerHost = new plugins.docker.DockerHost();
 | 
					    this.dockerHost = new plugins.docker.DockerHost({});
 | 
				
			||||||
    this.smartupdate = new plugins.smartupdate.SmartUpdate();
 | 
					    this.smartupdate = new plugins.smartupdate.SmartUpdate();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -27,9 +27,6 @@ export class SparkUpdateManager {
 | 
				
			|||||||
        plugins.path.join(paths.homeDir, 'serve.zone/spark/spark.json')
 | 
					        plugins.path.join(paths.homeDir, 'serve.zone/spark/spark.json')
 | 
				
			||||||
      ))
 | 
					      ))
 | 
				
			||||||
    ) {
 | 
					    ) {
 | 
				
			||||||
      const sparkJson = plugins.smartfile.fs.toObjectSync(
 | 
					 | 
				
			||||||
        plugins.path.join(paths.homeDir, 'serve.zone/spark/spark.json')
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
      const services: Array<{
 | 
					      const services: Array<{
 | 
				
			||||||
        name: string;
 | 
					        name: string;
 | 
				
			||||||
        image: string;
 | 
					        image: string;
 | 
				
			||||||
@@ -38,16 +35,45 @@ export class SparkUpdateManager {
 | 
				
			|||||||
        environment: string;
 | 
					        environment: string;
 | 
				
			||||||
        secretJson: any;
 | 
					        secretJson: any;
 | 
				
			||||||
      }> = [];
 | 
					      }> = [];
 | 
				
			||||||
      for (const serviceKey of Object.keys(sparkJson.services)) {
 | 
					      // lets add coreflow
 | 
				
			||||||
      services.push({
 | 
					      services.push({
 | 
				
			||||||
          name: serviceKey,
 | 
					        name: `coreflow`,
 | 
				
			||||||
          image: sparkJson.services[serviceKey].image,
 | 
					        image: `code.foss.global/serve.zone/coreflow`,
 | 
				
			||||||
          url: sparkJson.services[serviceKey].url,
 | 
					        url: `coreflow`,
 | 
				
			||||||
          environment: sparkJson.services[serviceKey].environment,
 | 
					        environment: `production`,
 | 
				
			||||||
          port: sparkJson.services[serviceKey].port,
 | 
					        port: `3000`,
 | 
				
			||||||
          secretJson: sparkJson.services[serviceKey].secretJson,
 | 
					        secretJson: {
 | 
				
			||||||
 | 
					          SERVEZONE_PORT: `3000`,
 | 
				
			||||||
 | 
					          SERVEZONE_ENVIRONMENT: `production`,
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      }
 | 
					
 | 
				
			||||||
 | 
					      services.push({
 | 
				
			||||||
 | 
					        name: `coretraffic`,
 | 
				
			||||||
 | 
					        image: `code.foss.global/serve.zone/coretraffic`,
 | 
				
			||||||
 | 
					        url: `coreflow`,
 | 
				
			||||||
 | 
					        environment: `production`,
 | 
				
			||||||
 | 
					        port: `3000`,
 | 
				
			||||||
 | 
					        secretJson: {
 | 
				
			||||||
 | 
					          SERVEZONE_PORT: `3000`,
 | 
				
			||||||
 | 
					          SERVEZONE_ENVIRONMENT: `production`,
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      services.push({
 | 
				
			||||||
 | 
					        name: `corelog`,
 | 
				
			||||||
 | 
					        image: `code.foss.global/serve.zone/corelog`,
 | 
				
			||||||
 | 
					        url: `coreflow`,
 | 
				
			||||||
 | 
					        environment: `production`,
 | 
				
			||||||
 | 
					        port: `3000`,
 | 
				
			||||||
 | 
					        secretJson: {
 | 
				
			||||||
 | 
					          SERVEZONE_PORT: `3000`,
 | 
				
			||||||
 | 
					          SERVEZONE_ENVIRONMENT: `production`,
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      // lets add coretraffic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      for (const service of services) {
 | 
					      for (const service of services) {
 | 
				
			||||||
        const existingService = await plugins.docker.DockerService.getServiceByName(
 | 
					        const existingService = await plugins.docker.DockerService.getServiceByName(
 | 
				
			||||||
          this.dockerHost,
 | 
					          this.dockerHost,
 | 
				
			||||||
@@ -61,6 +87,7 @@ export class SparkUpdateManager {
 | 
				
			|||||||
          const needsUpdate: boolean = await existingService.needsUpdate();
 | 
					          const needsUpdate: boolean = await existingService.needsUpdate();
 | 
				
			||||||
          if (!needsUpdate) {
 | 
					          if (!needsUpdate) {
 | 
				
			||||||
            logger.log('info', `not needing update.`);
 | 
					            logger.log('info', `not needing update.`);
 | 
				
			||||||
 | 
					            // we simply return here to end the functions
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          logger.log('ok', `${service.name} needs to be updated!`);
 | 
					          logger.log('ok', `${service.name} needs to be updated!`);
 | 
				
			||||||
@@ -74,7 +101,9 @@ export class SparkUpdateManager {
 | 
				
			|||||||
        const newServiceImage = await plugins.docker.DockerImage.createFromRegistry(
 | 
					        const newServiceImage = await plugins.docker.DockerImage.createFromRegistry(
 | 
				
			||||||
          this.dockerHost,
 | 
					          this.dockerHost,
 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
 | 
					            creationObject: {
 | 
				
			||||||
              imageUrl: service.image,
 | 
					              imageUrl: service.image,
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
        const newServiceSecret = await plugins.docker.DockerSecret.createSecret(this.dockerHost, {
 | 
					        const newServiceSecret = await plugins.docker.DockerSecret.createSecret(this.dockerHost, {
 | 
				
			||||||
@@ -92,8 +121,9 @@ export class SparkUpdateManager {
 | 
				
			|||||||
          secrets: [newServiceSecret],
 | 
					          secrets: [newServiceSecret],
 | 
				
			||||||
          ports: [`${service.port}:${service.secretJson.SERVEZONE_PORT}`],
 | 
					          ports: [`${service.port}:${service.secretJson.SERVEZONE_PORT}`],
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        logger.log('success', 'updated all services!');
 | 
					        logger.log('ok', `updated service >>${newService.Spec.Name}<<!`);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					      logger.log('success', `updated ${services.length} services!`);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,15 +1,7 @@
 | 
				
			|||||||
import * as plugins from './spark.plugins.js';
 | 
					import * as plugins from './spark.plugins.js';
 | 
				
			||||||
import * as paths from './spark.paths.js';
 | 
					import * as paths from './spark.paths.js';
 | 
				
			||||||
 | 
					import { commitinfo } from './00_commitinfo_data.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const projectInfoNpm = new plugins.projectinfo.ProjectinfoNpm(paths.packageDir);
 | 
					const projectInfoNpm = new plugins.projectinfo.ProjectinfoNpm(paths.packageDir);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const logger = new plugins.smartlog.Smartlog({
 | 
					export const logger = plugins.smartlog.Smartlog.createForCommitinfo(commitinfo);
 | 
				
			||||||
  logContext: {
 | 
					 | 
				
			||||||
    environment: 'production',
 | 
					 | 
				
			||||||
    runtime: 'node',
 | 
					 | 
				
			||||||
    zone: 'baremetal',
 | 
					 | 
				
			||||||
    company: null,
 | 
					 | 
				
			||||||
    companyunit: null,
 | 
					 | 
				
			||||||
    containerName: 'spark',
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,11 @@ import * as path from 'path';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export { path };
 | 
					export { path };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// @serve.zone scope
 | 
				
			||||||
 | 
					import * as servezoneInterfaces from '@serve.zone/interfaces';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export { servezoneInterfaces };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// @apiclient.xyz scope
 | 
					// @apiclient.xyz scope
 | 
				
			||||||
import * as docker from '@apiclient.xyz/docker';
 | 
					import * as docker from '@apiclient.xyz/docker';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user