fix(core): Removed GitLab CI configuration and updated npm, gitzone settings

This commit is contained in:
Philipp Kunz 2024-12-29 22:51:34 +01:00
parent 44ec964814
commit 9d2e3e640a
11 changed files with 4230 additions and 809 deletions

View File

@ -1,112 +0,0 @@
# gitzone ci_docker
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci-cache/
key: '$CI_BUILD_STAGE'
before_script:
- npmci npm prepare
stages:
- security
- test
- release
- metadata
- pages
# ====================
# security stage
# ====================
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- lossless
- docker
allow_failure: true
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=dev
tags:
- lossless
- docker
allow_failure: true
# ====================
# test stage
# ====================
testStable:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
testBuild:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- notpriv
# ====================
# release stage
# ====================
release:
image: registry.gitlab.com/hosttoday/ht-docker-dbase:npmci
services:
- docker:stable-dind
stage: release
script:
- npmci node install stable
- npmci docker login
- npmci docker build
- npmci docker test
- npmci docker push registry.gitlab.com
only:
- tags
tags:
- lossless
- docker
- priv
# ====================
# metadata stage
# ====================
trigger:
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- lossless
- docker

14
changelog.md Normal file
View File

@ -0,0 +1,14 @@
# Changelog
## 2024-12-29 - 1.0.186 - fix(core)
Removed GitLab CI configuration and updated npm, gitzone settings
- Deleted .gitlab-ci.yml, removing GitLab CI pipeline configuration.
- Updated baseImage and gitscope in npmextra.json for new docker settings.
- Corrected and updated dependencies and package details in package.json.
- Enhanced readme with initialization, running, and task management examples.
## 2024-05-15 - 1.0.183 to 1.0.185 - Core Updates
Minor updates and maintenance.
- Two minor fixes to core functionality were applied.

View File

@ -1,6 +1,6 @@
{ {
"npmdocker": { "npmdocker": {
"baseImage": "hosttoday/ht-docker-node:npmci", "baseImage": "host.today/ht-docker-node:npmci",
"command": "echo \"inside docker now\"", "command": "echo \"inside docker now\"",
"dockerSock": true "dockerSock": true
}, },
@ -18,11 +18,23 @@
"projectType": "service", "projectType": "service",
"module": { "module": {
"githost": "gitlab.com", "githost": "gitlab.com",
"gitscope": "servezone/private", "gitscope": "serve.zone",
"gitrepo": "coretraffic", "gitrepo": "coretraffic",
"shortDescription": "route traffic within your docker setup. TypeScript ready.", "shortDescription": "route traffic within your docker setup. TypeScript ready.",
"npmPackagename": "@servezone_private/coretraffic", "npmPackagename": "@serve.zone/coretraffic",
"license": "UNLICENSED" "license": "MIT",
"description": "CoreTraffic is a TypeScript-based solution for routing and managing network traffic within a Docker setup, featuring SSL redirection and Coreflow integration for real-time configuration updates.",
"keywords": [
"traffic management",
"Docker",
"TypeScript",
"routing",
"network proxy",
"SSL redirection",
"Coreflow",
"real-time updates",
"task management"
]
} }
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"name": "coretraffic", "name": "coretraffic",
"version": "1.0.185", "version": "1.0.185",
"description": "route traffic within your docker setup. TypeScript ready.", "description": "CoreTraffic is a TypeScript-based solution for routing and managing network traffic within a Docker setup, featuring SSL redirection and Coreflow integration for real-time configuration updates.",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",
"type": "module", "type": "module",
@ -16,7 +16,15 @@
"url": "git+ssh://git@gitlab.com/servezone/coretraffic.git" "url": "git+ssh://git@gitlab.com/servezone/coretraffic.git"
}, },
"keywords": [ "keywords": [
"traffic" "traffic management",
"Docker",
"TypeScript",
"routing",
"network proxy",
"SSL redirection",
"Coreflow",
"real-time updates",
"task management"
], ],
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
@ -25,29 +33,29 @@
}, },
"homepage": "https://gitlab.com/servezone/coretraffic#README", "homepage": "https://gitlab.com/servezone/coretraffic#README",
"dependencies": { "dependencies": {
"@api.global/typedrequest": "^3.0.23", "@api.global/typedrequest": "^3.1.10",
"@api.global/typedsocket": "^3.0.1", "@api.global/typedsocket": "^3.0.1",
"@losslessone_private/loint-cloudly": "^2.0.85",
"@losslessone_private/lole-log": "^2.0.16",
"@push.rocks/projectinfo": "^5.0.1", "@push.rocks/projectinfo": "^5.0.1",
"@push.rocks/qenv": "^6.0.5", "@push.rocks/qenv": "^6.1.0",
"@push.rocks/smartdelay": "^3.0.5", "@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartlog": "^3.0.3", "@push.rocks/smartlog": "^3.0.7",
"@push.rocks/smartlog-destination-receiver": "^2.0.3", "@push.rocks/smartlog-destination-receiver": "^2.0.3",
"@push.rocks/smartpath": "^5.0.5", "@push.rocks/smartpath": "^5.0.5",
"@push.rocks/smartpromise": "^4.0.3", "@push.rocks/smartpromise": "^4.0.4",
"@push.rocks/smartproxy": "^3.0.58", "@push.rocks/smartproxy": "^3.1.0",
"@push.rocks/smartrequest": "^2.0.10", "@push.rocks/smartrequest": "^2.0.23",
"@push.rocks/smartshell": "^3.0.5", "@push.rocks/smartshell": "^3.2.2",
"@push.rocks/smartstring": "^4.0.2", "@push.rocks/smartstring": "^4.0.2",
"@push.rocks/taskbuffer": "^3.0.10" "@push.rocks/taskbuffer": "^3.0.10",
"@serve.zone/interfaces": "^4.10.0",
"@tsclass/tsclass": "^4.2.0"
}, },
"devDependencies": { "devDependencies": {
"@git.zone/tsbuild": "^2.1.65", "@git.zone/tsbuild": "^2.2.0",
"@git.zone/tsrun": "^1.2.39", "@git.zone/tsrun": "^1.3.3",
"@git.zone/tstest": "^1.0.74", "@git.zone/tstest": "^1.0.74",
"@push.rocks/tapbundle": "^5.0.4", "@push.rocks/tapbundle": "^5.5.3",
"@types/node": "^18.11.18" "@types/node": "^22.10.2"
}, },
"private": true, "private": true,
"files": [ "files": [

4591
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

0
readme.hints.md Normal file
View File

239
readme.md
View File

@ -1,41 +1,224 @@
# @servezone/private/coretraffic # CoreTraffic
route traffic within your docker setup. TypeScript ready. route traffic within your docker setup. TypeScript ready.
## Availabililty and Links ## Install
* [npmjs.org (npm package)](https://www.npmjs.com/package/@servezone_private/coretraffic)
* [gitlab.com (source)](https://gitlab.com/servezone/private/coretraffic)
* [github.com (source mirror)](https://github.com/servezone/private/coretraffic)
* [docs (typedoc)](https://servezone/private.gitlab.io/coretraffic/)
## Status for master To install `coretraffic`, you should have Node.js already set up on your system. Assuming Node.js and npm are ready, install the package via the npm registry with the following command:
Status Category | Status Badge ```bash
-- | -- npm install coretraffic
GitLab Pipelines | [![pipeline status](https://gitlab.com/servezone/private/coretraffic/badges/master/pipeline.svg)](https://lossless.cloud) ```
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/servezone/private/coretraffic/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@servezone_private/coretraffic)](https://lossless.cloud) To make the most out of `coretraffic`, ensure TypeScript is set up in your development environment, as this module is TypeScript ready and provides enhanced IntelliSense.
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/servezone/private/coretraffic)](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/@servezone_private/coretraffic)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@servezone_private/coretraffic)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@servezone_private/coretraffic)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage ## Usage
Use TypeScript for best in class instellisense. `coretraffic` is designed to manage and route traffic within a Docker setup, offering robust solutions to your traffic management needs with an emphasis on efficiency and reliability. Utilizing TypeScript for static typing, you get enhanced code completion and fewer runtime errors. The module is set up to handle the intricacies of proxy configuration and routing, providing a powerful foundation for any Docker-based traffic management application.
For further information read the linked docs at the top of this README. Below, we'll delve into the capabilities and features of `coretraffic`, complete with comprehensive examples to get you started.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) ### Initializing CoreTraffic
[![repo-footer](https://servezone.gitlab.io/assets/repo-footer.svg)](https://push.rocks) First, you'll want to create an instance of the `CoreTraffic` class. This serves as the entry point to accessing the module's capabilities.
For further information read the linked docs at the top of this readme. ```typescript
import { CoreTraffic } from 'coretraffic';
> UNLICENSED licensed | **©** [Lossless GmbH](https://lossless.gmbh) // Create an instance of CoreTraffic
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) const coreTrafficInstance = new CoreTraffic();
```
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com) This initializes the `coreTrafficInstance` with default properties, ready to configure routing settings and handle proxy configurations.
### Starting and Stopping CoreTraffic
Controlling the lifecycle of your `CoreTraffic` instance is key to effective traffic management. You can start and stop the instance with straightforward method calls.
#### Starting CoreTraffic
To begin managing traffic, start the instance. This sets up the internal network proxy and SSL redirection services, making them ready to handle incoming requests.
```typescript
async function startCoreTraffic() {
await coreTrafficInstance.start();
console.log('CoreTraffic is now running.');
}
startCoreTraffic();
```
This code initializes all internal components, including `NetworkProxy` and `SslRedirect`, beginning to route traffic as configured.
#### Stopping CoreTraffic
When you no longer need to route traffic, shutting down the instance cleanly is important. `CoreTraffic` provides a `stop` method for this purpose.
```typescript
async function stopCoreTraffic() {
await coreTrafficInstance.stop();
console.log('CoreTraffic has stopped.');
}
stopCoreTraffic();
```
This ensures all background tasks are halted, and network configurations are cleaned up.
### Configuring Network Proxy
A core feature of `CoreTraffic` is its ability to configure network proxies dynamically. At its heart is the `NetworkProxy` class, a powerful tool for managing routing configurations.
#### Adding Default Headers
You may wish to integrate unique headers across all routed requests, possible with the `addDefaultHeaders` method. This is useful for tagging requests or managing CORS.
```typescript
coreTrafficInstance.networkProxy.addDefaultHeaders({
'x-powered-by': 'coretraffic',
'custom-header': 'custom-value'
});
```
This injects custom headers into all outgoing responses managed by `coretraffic`, thereby allowing customized interaction with requests as needed.
#### Proxy Configuration Updates
Dynamic updates to proxy configurations can be facilitated via tasks managed by `CoretrafficTaskManager`. This feature allows adjustment of routing rules without interrupting service.
```typescript
import { IReverseProxyConfig } from '@tsclass/network';
const configureRouting = async () => {
const reverseProxyConfig: IReverseProxyConfig[] = [{
// Example configuration, adjust as needed
host: 'example.com',
target: 'http://internal-service:3000',
}];
await coreTrafficInstance.taskmanager.setupRoutingTask.trigger(reverseProxyConfig);
console.log('Updated routing configurations');
};
configureRouting();
```
In this example, a reverse proxy configuration is defined, specifying that requests to `example.com` should be directed to an internal service.
### SSL Redirection
`CoreTraffic` supports SSL redirection, an essential feature for secure communications. The `SslRedirect` component listens on one port to redirect traffic to the secure version on another port.
```typescript
// SslRedirect is initialized on port 7999 by default
console.log('SSL Redirection is active!');
```
Out-of-the-box, this listens on the configurable port and safely forwards insecure HTTP traffic to its HTTPS counterpart.
### Coreflow Connector
A unique aspect of `coretraffic` is its integration capability with `Coreflow`, allowing communication between different network nodes. The `CoreflowConnector` facilitates receiving configuration updates via a socket connection.
#### Setting up the CoreflowConnector
```typescript
const coreflowConnector = coreTrafficInstance.coreflowConnector;
async function connectCoreflow() {
await coreflowConnector.start();
console.log('Coreflow connector activated.');
}
connectCoreflow();
```
This method enables a persistent connection to a Coreflow server, allowing real-time configuration updates and management of routing policies.
#### Stopping the CoreflowConnector
To disconnect cleanly:
```typescript
async function disconnectCoreflow() {
await coreflowConnector.stop();
console.log('Coreflow connector terminated.');
}
disconnectCoreflow();
```
This halts the connection, ensuring no dangling resources remain when shutting down your application.
### Task Management
The `CoretrafficTaskManager` handles complex, buffered tasks. Flexibility and power are at your fingertips with this system, ideal for timed or queued execution needs.
#### Managing Tasks
Here is how you would initiate the task manager:
```typescript
const taskManager = coreTrafficInstance.taskmanager;
// Start tasks
taskManager.start()
.then(() => console.log('Task manager is running'))
.catch(err => console.error('Failed to start task manager', err));
```
Stop tasks once processing is no longer required:
```typescript
taskManager.stop()
.then(() => console.log('Task manager stopped'))
.catch(err => console.error('Failed to stop task manager', err));
```
### Logging and Debugging
Effective logging is provided using `Smartlog`, designed to track detailed application insights and report on activity and actions within `coretraffic`.
#### Configuring Log Levels
`coretraffic` supports log levels which can be adjusted as per your requirements:
```typescript
import { logger } from './coretraffic.logging.ts';
logger.log('info', 'System initialized');
logger.log('debug', 'Detailed debugging process');
logger.log('warn', 'Potential issue detected');
logger.log('error', 'An error has occurred');
```
These log entries help monitor logic flow and catch issues during development or deployment in production environments.
### Test Setup
For those interested in testing, `coretraffic` uses `tapbundle` and `tstest` to ensure reliability and correctness. A sample test module is provided to demonstrate initialization and lifecycle actions.
Heres an example of a non-CI test scenario:
```typescript
import * as coretraffic from '../ts/index.js';
import { tap, expect } from '@push.rocks/tapbundle';
let testCoreTraffic;
tap.test('should create and handle coretraffic instances', async () => {
testCoreTraffic = new coretraffic.CoreTraffic();
expect(testCoreTraffic).toBeInstanceOf(coretraffic.CoreTraffic);
await testCoreTraffic.start();
await new Promise(resolve => setTimeout(resolve, 10000)); // Keep alive for demonstration
await testCoreTraffic.stop();
});
tap.start();
```
This test suite validates essential functionality within development iterations, ensuring `coretraffic` performs as expected.
`coretraffic` offers a vast landscape of operations within Docker environments, handling traffic with modularity and efficiency. Whether starting simple routing tasks or integrating with complex systems like Coreflow, this module provides robust support where needed most. Embrace your traffic management challenges with the dedicated features of `coretraffic`.
undefined

View File

@ -1,8 +1,8 @@
/** /**
* autocreated commitinfo by @pushrocks/commitinfo * autocreated commitinfo by @push.rocks/commitinfo
*/ */
export const commitinfo = { export const commitinfo = {
name: 'coretraffic', name: 'coretraffic',
version: '1.0.185', version: '1.0.186',
description: 'route traffic within your docker setup. TypeScript ready.' description: 'CoreTraffic is a TypeScript-based solution for routing and managing network traffic within a Docker setup, featuring SSL redirection and Coreflow integration for real-time configuration updates.'
} }

View File

@ -15,7 +15,7 @@ export class CoreflowConnector {
this.coretrafficRef.typedrouter.addTypedRouter(this.typedrouter) this.coretrafficRef.typedrouter.addTypedRouter(this.typedrouter)
this.typedrouter.addTypedHandler< this.typedrouter.addTypedHandler<
plugins.lointCloudly.request.routing.IRequest_Coreflow_Coretraffic_RoutingUpdate plugins.servezoneInterfaces.requests.routing.IRequest_Coreflow_Coretraffic_RoutingUpdate
>(new plugins.typedrequest.TypedHandler('updateRouting', async (requestData) => { >(new plugins.typedrequest.TypedHandler('updateRouting', async (requestData) => {
console.log(requestData); console.log(requestData);
await this.coretrafficRef.taskmanager.setupRoutingTask.trigger(requestData.reverseConfigs); await this.coretrafficRef.taskmanager.setupRoutingTask.trigger(requestData.reverseConfigs);

View File

@ -9,7 +9,7 @@ export class CoretrafficTaskManager {
/** /**
* a task to run setup routing, runs buffered * a task to run setup routing, runs buffered
*/ */
public setupRoutingTask: plugins.taskbuffer.Task; public setupRoutingTask: plugins.taskbuffer.Task<plugins.tsclass.network.IReverseProxyConfig[]>;
constructor(coretrafficRefArg: CoreTraffic) { constructor(coretrafficRefArg: CoreTraffic) {
this.coretrafficRef = coretrafficRefArg; this.coretrafficRef = coretrafficRefArg;
@ -18,7 +18,7 @@ export class CoretrafficTaskManager {
this.setupRoutingTask = new plugins.taskbuffer.Task({ this.setupRoutingTask = new plugins.taskbuffer.Task({
buffered: true, buffered: true,
bufferMax: 2, bufferMax: 2,
taskFunction: async (reverseConfigs: plugins.lointCloudly.traffic.IReverseProxyConfig[]) => { taskFunction: async (reverseConfigs: plugins.tsclass.network.IReverseProxyConfig[]) => {
console.log('this is what got to the task:'); console.log('this is what got to the task:');
console.log(reverseConfigs); console.log(reverseConfigs);
logger.log('info', `routing setup task triggered`); logger.log('info', `routing setup task triggered`);

View File

@ -4,9 +4,9 @@ import * as path from 'path';
export { path }; export { path };
// @serve.zone scope // @serve.zone scope
import * as lointCloudly from '@losslessone_private/loint-cloudly'; import * as servezoneInterfaces from '@serve.zone/interfaces';
export { lointCloudly }; export { servezoneInterfaces };
// @api.global scope // @api.global scope
import * as typedrequest from '@api.global/typedrequest'; import * as typedrequest from '@api.global/typedrequest';
@ -42,3 +42,8 @@ export {
smartstring, smartstring,
taskbuffer, taskbuffer,
}; };
// @tsclass scope
import * as tsclass from '@tsclass/tsclass';
export { tsclass };