From 4e73bf7a0e1a62483f5ffd40fa14f4815468fd8f Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Wed, 8 May 2024 20:53:35 +0200 Subject: [PATCH] fix(core): update --- npmextra.json | 17 +++++- package.json | 19 +++++-- readme.hints.md | 2 + readme.md | 111 +++++++++++++++++++++++++++++---------- ts/00_commitinfo_data.ts | 4 +- 5 files changed, 117 insertions(+), 36 deletions(-) create mode 100644 readme.hints.md diff --git a/npmextra.json b/npmextra.json index 3e9ef4a..8edd1d7 100644 --- a/npmextra.json +++ b/npmextra.json @@ -5,10 +5,23 @@ "githost": "gitlab.com", "gitscope": "losslessone/services/initzone", "gitrepo": "spark", - "description": "sparks the servezone services", + "description": "A tool to maintain and configure servers on the base OS level for the Servezone infrastructure.", "npmPackagename": "@losslessone_private/spark", "license": "MIT", - "projectDomain": "https://lossless.one" + "projectDomain": "https://lossless.one", + "keywords": [ + "server management", + "devops", + "automation", + "docker", + "configuration management", + "daemon service", + "continuous integration", + "continuous deployment", + "deployment automation", + "service orchestration", + "node.js" + ] } }, "npmci": { diff --git a/package.json b/package.json index 1ce2195..0fcc838 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@serve.zone/spark", "version": "1.0.83", "private": false, - "description": "sparks the servezone services", + "description": "A tool to maintain and configure servers on the base OS level for the Servezone infrastructure.", "main": "dist_ts/index.js", "typings": "dist_ts/index.d.ts", "author": "Task Venture Capital GmbH", @@ -54,5 +54,18 @@ "browserslist": [ "last 1 chrome versions" ], - "type": "module" -} + "type": "module", + "keywords": [ + "server management", + "devops", + "automation", + "docker", + "configuration management", + "daemon service", + "continuous integration", + "continuous deployment", + "deployment automation", + "service orchestration", + "node.js" + ] +} \ No newline at end of file diff --git a/readme.hints.md b/readme.hints.md new file mode 100644 index 0000000..9658612 --- /dev/null +++ b/readme.hints.md @@ -0,0 +1,2 @@ +- this package is part of serve.zone +- it is used to maintain and configure servers on the base OS level \ No newline at end of file diff --git a/readme.md b/readme.md index a140ad3..04d1901 100644 --- a/readme.md +++ b/readme.md @@ -1,40 +1,93 @@ -# @losslessone/services/initzone/spark +# @serve.zone/spark sparks the servezone services -## Availabililty and Links -* [npmjs.org (npm package)](https://www.npmjs.com/package/@losslessone_private/spark) -* [gitlab.com (source)](https://gitlab.com/losslessone/services/initzone/spark) -* [github.com (source mirror)](https://github.com/losslessone/services/initzone/spark) -* [docs (typedoc)](https://losslessone/services/initzone.gitlab.io/spark/) - -## Status for master - -Status Category | Status Badge --- | -- -GitLab Pipelines | [![pipeline status](https://gitlab.com/losslessone/services/initzone/spark/badges/master/pipeline.svg)](https://lossless.cloud) -GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/losslessone/services/initzone/spark/badges/master/coverage.svg)](https://lossless.cloud) -npm | [![npm downloads per month](https://badgen.net/npm/dy/@losslessone_private/spark)](https://lossless.cloud) -Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/losslessone/services/initzone/spark)](https://lossless.cloud) -TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud) -node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) -Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud) -PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@losslessone_private/spark)](https://lossless.cloud) -PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@losslessone_private/spark)](https://lossless.cloud) -BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@losslessone_private/spark)](https://lossless.cloud) +## Install +To install `@serve.zone/spark`, run the following command in your terminal: +```sh +npm install @serve.zone/spark --save +``` ## Usage -## Contribution +### Getting Started +To use `@serve.zone/spark` in your project, you need to include and initiate it in your TypeScript project. Ensure you have TypeScript and the necessary build tools set up in your project. -We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) +First, import `@serve.zone/spark`: +```typescript +import { Spark } from '@serve.zone/spark'; +``` +### Initializing Spark +Create an instance of the `Spark` class to start using Spark. This instance will serve as the main entry point for interacting with the Spark functionalities. -## Contribution +```typescript +const sparkInstance = new Spark(); +``` -We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) +### Running Spark as a Daemon +To run Spark as a daemon, which is useful for maintaining and configuring servers on the base OS level, use the CLI feature bundled with Spark. This should ideally be handled outside of your code through a command-line terminal but can also be automated within your Node.js scripts if required. -For further information read the linked docs at the top of this readme. +```shell +spark installdaemon +``` -## Legal -> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc) -| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) +The command above sets up Spark as a system service, enabling it to run and maintain server configurations automatically. + +### Updating Spark or Maintained Services +Spark can self-update and manage updates for its maintained services. Trigger an update check and process by calling the `updateServices` method on the Spark instance. + +```typescript +await sparkInstance.sparkUpdateManager.updateServices(); +``` + +### Managing Configuration and Logging +Spark allows for extensive configuration and logging customization. Use the `SparkLocalConfig` and logging features to tailor Spark's operation to your needs. + +```typescript +// Accessing the local configuration +const localConfig = sparkInstance.sparkLocalConfig; + +// Utilizing the logger for custom log messages +import { logger } from '@serve.zone/spark'; + +logger.log('info', 'Custom log message'); +``` + +### Advanced Usage +`@serve.zone/spark` offers a suite of tools for detailed server and service management, including but not limited to task scheduling, daemon management, and service updates. Explore the `SparkTaskManager` for scheduling specific tasks, `SparkUpdateManager` for handling service updates, and `SparkLocalConfig` for configuration. + +### Example: Scheduling Custom Tasks +```typescript +import { SparkTaskManager } from '@serve.zone/spark'; + +const sparkInstance = new Spark(); +const myTask = { + name: 'customTask', + taskFunction: async () => { + console.log('Running custom task'); + }, +}; + +sparkInstance.sparkTaskManager.taskmanager.addAndScheduleTask(myTask, '* * * * * *'); +``` + +The example above creates a simple task that logs a message every second, demonstrating how to use Spark's task manager for custom scheduled tasks. + +### Advanced Configuration +For advanced configurations, including Docker and service management: + +- Use `SparkUpdateManager` to handle Docker image updates, service creation, and management. +- Access and modify Docker and service configurations through Spark's integration with configuration files and environment variables. + +```typescript +// Managing Docker services with Spark +await sparkInstance.sparkUpdateManager.dockerHost.someDockerMethod(); + +// Example: Creating a Docker service +const newServiceDefinition = {...}; +await sparkInstance.sparkUpdateManager.createService(newServiceDefinition); +``` + +### Conclusion +`@serve.zone/spark` provides a comprehensive toolkit for orchestrating and managing server environments and Docker-based services. By leveraging its CLI and programmatic interfaces, you can automate and streamline server operations, configurations, updates, and task scheduling, ensuring your infrastructure is responsive, updated, and maintained efficiently. +undefined \ No newline at end of file diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 8515d1b..e9602c4 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@serve.zone/spark', - version: '1.0.83', - description: 'sparks the servezone services' + version: '1.0.84', + description: 'A tool to maintain and configure servers on the base OS level for the Servezone infrastructure.' }