fix(core): update

This commit is contained in:
Philipp Kunz 2024-06-20 19:00:58 +02:00
parent cdbab26008
commit a7ee92cde9
11 changed files with 1273 additions and 2667 deletions

View File

@ -16,26 +16,37 @@
"githost": "gitlab.com",
"gitscope": "servezone/private",
"gitrepo": "cloudly",
"description": "A cloud manager leveraging Docker Swarmkit for multi-cloud operations including DigitalOcean, Hetzner Cloud, and Cloudflare, with integration support and robust configuration management system.",
"description": "A comprehensive multi-cloud manager leveraging Docker Swarmkit to orchestrate containerized applications across various cloud services and integrate robust configuration and API management capabilities.",
"npmPackagename": "@serve.zone/cloudly",
"license": "UNLICENSED",
"keywords": [
"cloud management",
"Docker Swarmkit",
"multi-cloud",
"Docker Swarmkit",
"DigitalOcean",
"Hetzner Cloud",
"Cloudflare",
"container orchestration",
"TypeScript",
"node.js",
"infrastructure automation",
"Cloudron",
"configuration management",
"SSL management",
"APIs",
"API integration",
"TypeScript",
"node.js",
"cloud integration",
"infrastructure automation",
"devOps",
"cloud integration"
"cloud API client",
"system logging",
"secret management",
"CI/CD integration",
"task scheduling",
"frontend",
"backend",
"cli",
"web interface",
"cloud providers",
"security",
"logging"
]
}
},

View File

@ -2,7 +2,7 @@
"name": "@serve.zone/cloudly",
"version": "1.1.4",
"private": false,
"description": "A cloud manager leveraging Docker Swarmkit for multi-cloud operations including DigitalOcean, Hetzner Cloud, and Cloudflare, with integration support and robust configuration management system.",
"description": "A comprehensive multi-cloud manager leveraging Docker Swarmkit to orchestrate containerized applications across various cloud services and integrate robust configuration and API management capabilities.",
"type": "module",
"exports": {
".": "./dist/index.js",
@ -26,7 +26,7 @@
"@git.zone/tstest": "^1.0.90",
"@git.zone/tswatch": "^2.0.23",
"@push.rocks/tapbundle": "^5.0.23",
"@types/node": "^20.14.2"
"@types/node": "^20.14.6"
},
"dependencies": {
"@api.global/typedrequest": "3.0.30",
@ -34,20 +34,21 @@
"@api.global/typedsocket": "^3.0.1",
"@apiclient.xyz/cloudflare": "^6.0.1",
"@apiclient.xyz/docker": "^1.2.2",
"@apiclient.xyz/hetznercloud": "^1.0.18",
"@apiclient.xyz/hetznercloud": "^1.2.0",
"@apiclient.xyz/slack": "^3.0.9",
"@design.estate/dees-catalog": "^1.0.289",
"@design.estate/dees-domtools": "^2.0.57",
"@design.estate/dees-element": "^2.0.34",
"@git.zone/tsrun": "^1.2.37",
"@push.rocks/early": "^4.0.3",
"@push.rocks/npmextra": "^5.0.17",
"@push.rocks/npmextra": "^5.0.23",
"@push.rocks/projectinfo": "^5.0.1",
"@push.rocks/qenv": "^6.0.5",
"@push.rocks/smartacme": "^4.0.8",
"@push.rocks/smartbucket": "^3.0.15",
"@push.rocks/smartacme": "^5.0.0",
"@push.rocks/smartbucket": "^3.0.20",
"@push.rocks/smartcli": "^4.0.11",
"@push.rocks/smartdata": "^5.2.4",
"@push.rocks/smartclickhouse": "^2.0.17",
"@push.rocks/smartdata": "^5.2.6",
"@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartexit": "^1.0.23",
"@push.rocks/smartfile": "^11.0.20",
@ -55,7 +56,7 @@
"@push.rocks/smartjson": "^5.0.19",
"@push.rocks/smartjwt": "^2.0.4",
"@push.rocks/smartlog": "^3.0.7",
"@push.rocks/smartlog-destination-clickhouse": "^1.0.11",
"@push.rocks/smartlog-destination-clickhouse": "^1.0.13",
"@push.rocks/smartpath": "^5.0.18",
"@push.rocks/smartpromise": "^4.0.3",
"@push.rocks/smartrequest": "^2.0.22",
@ -67,8 +68,8 @@
"@push.rocks/smartunique": "^3.0.9",
"@push.rocks/taskbuffer": "^3.0.2",
"@push.rocks/webjwt": "^1.0.9",
"@serve.zone/interfaces": "^1.0.72",
"@tsclass/tsclass": "^4.0.55"
"@serve.zone/interfaces": "^1.0.74",
"@tsclass/tsclass": "^4.0.60"
},
"files": [
"ts/**/*",
@ -95,20 +96,31 @@
"homepage": "https://gitlab.com/servezone/private/cloudly#readme",
"keywords": [
"cloud management",
"Docker Swarmkit",
"multi-cloud",
"Docker Swarmkit",
"DigitalOcean",
"Hetzner Cloud",
"Cloudflare",
"container orchestration",
"TypeScript",
"node.js",
"infrastructure automation",
"Cloudron",
"configuration management",
"SSL management",
"APIs",
"API integration",
"TypeScript",
"node.js",
"cloud integration",
"infrastructure automation",
"devOps",
"cloud integration"
"cloud API client",
"system logging",
"secret management",
"CI/CD integration",
"task scheduling",
"frontend",
"backend",
"cli",
"web interface",
"cloud providers",
"security",
"logging"
]
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
- This repository contains 4 projects around serve.zone
- the cloudly backend under ts/*
- the cloudly frontend under ts_web/*
- the api client under ts_apiclient
- the cli client under ts_cliclient
- the easiest method to spawn up a cloudly instance is to use the docker image:
`code.foss.global/serve.zone/cloudly:latest`
- Note: the exports are defined in the package.json.

View File

@ -1,21 +1,28 @@
# @serve.zone/cloudly
A cloud manager utilizing Docker Swarmkit, designed for operations on Cloudron, and supports various cloud platforms like DigitalOcean, Hetzner Cloud, and Cloudflare.
A comprehensive multi-cloud manager leveraging Docker Swarmkit for orchestrating containerized applications and integrating various cloud services like DigitalOcean, Hetzner Cloud, and Cloudflare, with robust configuration and API management capabilities.
## Install
To install `@serve.zone/cloudly`, run the following command in your terminal:
```bash
npm install @serve.zone/cloudly --save
```
This will install the package and add it to your project's `package.json` dependencies.
## Usage
`@serve.zone/cloudly` is designed to help you manage and configure cloud environments. This package provides a comprehensive TypeScript and ESM-based interface for interacting with various cloud services, including Docker Swarmkit cluster management, and integration with cloud providers such as DigitalOcean, Hetzner Cloud, and Cloudflare.
### Getting Started
Before diving into the specifics, ensure your environment is properly set up. This includes having Node.js installed (preferably the latest LTS version), and if you are working in a TypeScript project, ensure TypeScript is configured.
#### Initializing Cloudly
First, import `Cloudly` class from the package and initialize it as shown below:
First, import the `Cloudly` class from the package and initialize it as shown below:
```typescript
import { Cloudly } from '@serve.zone/cloudly';
@ -26,6 +33,7 @@ const myCloudlyInstance = new Cloudly();
The `Cloudly` class is the entry point to using the library features. It prepares the environment for configuring the cloud services.
#### Configuration
Configuration plays a pivotal role in how `@serve.zone/cloudly` operates. The library expects certain configurations to be provided, which can include credentials for cloud services, database connections, etc.
For example, to configure a connection to MongoDB, specify your MongoDB details as shown:
@ -38,16 +46,22 @@ const myCloudlyConfig = {
mongoDbUser: 'myUser',
mongoDbPass: 'myPassword',
},
// Additional configuration values...
cfToken: 'your_cloudflare_api_token',
environment: 'development',
letsEncryptEmail: 'lets_encrypt_email@example.com',
publicUrl: 'example.com',
publicPort: 8443,
hetznerToken: 'your_hetzner_api_token',
};
const myCloudlyInstance = new Cloudly(myCloudlyConfig);
```
#### Managing Docker Swarmkit Cluster
### Managing Docker Swarmkit Clusters
Cloudly allows managing Docker Swarmkit clusters through an abstracted interface, simplifying operations such as deployment and scaling. Below are examples to demonstrate these capabilities.
### Example: Start a Cloudly Instance and Add a Cluster
#### Example: Initializing a Cloudly Instance and Adding a Cluster
```typescript
import { Cloudly, ClusterManager } from '@serve.zone/cloudly';
@ -65,7 +79,7 @@ async function main() {
letsEncryptEmail: 'lets_encrypt_email@example.com',
publicUrl: 'example.com',
publicPort: 8443,
hetznerToken: 'your_hetzner_api_token'
hetznerToken: 'your_hetzner_api_token',
};
const myCloudlyInstance = new Cloudly(myCloudlyConfig);
@ -88,10 +102,15 @@ async function main() {
console.log('Cluster added:', newCluster);
}
main();
```
### Example: Manage Cloudflare DNS Records
### Additional Use Cases
#### Managing Cloudflare DNS Records
You can manage Cloudflare DNS records using the `CloudflareConnector` provided by Cloudly.
```typescript
import { Cloudly, CloudflareConnector } from '@serve.zone/cloudly';
@ -109,7 +128,7 @@ async function manageDNSRecords() {
letsEncryptEmail: 'lets_encrypt_email@example.com',
publicUrl: 'example.com',
publicPort: 8443,
hetznerToken: 'your_hetzner_api_token'
hetznerToken: 'your_hetzner_api_token',
};
const myCloudlyInstance = new Cloudly(myCloudlyConfig);
@ -135,7 +154,9 @@ async function manageDNSRecords() {
manageDNSRecords();
```
### Example: Integrate with DigitalOcean
#### Integrating with DigitalOcean
Integrate with DigitalOcean to manage droplets and other resources.
```typescript
import { Cloudly, DigitalOceanConnector } from '@serve.zone/cloudly';
@ -153,7 +174,7 @@ async function manageDroplet() {
letsEncryptEmail: 'lets_encrypt_email@example.com',
publicUrl: 'example.com',
publicPort: 8443,
hetznerToken: 'your_hetzner_api_token'
hetznerToken: 'your_hetzner_api_token',
};
const myCloudlyInstance = new Cloudly(myCloudlyConfig);
@ -180,8 +201,11 @@ manageDroplet();
```
### Using Cloudly Web Interface
If your project includes a web interface to manage various sections like DNS, deployments, clusters, etc., you can use the provided elements and state management. Below is an example of setting up a dashboard using the components defined:
#### Web Dashboard Example
```typescript
import { commitinfo } from '../00_commitinfo_data.js';
import * as plugins from '../plugins.js';
@ -212,7 +236,7 @@ import { CloudlyViewServices } from './cloudly-view-services.js';
declare global {
interface HTMLElementTagNameMap {
'cvault-dashboard': CloudlyDashboard;
'cloudly-dashboard': CloudlyDashboard;
}
}
@ -227,6 +251,7 @@ export class CloudlyDashboard extends DeesElement {
constructor() {
super();
document.title = `cloudly v${commitinfo.version}`;
const subcription = appstate.dataState
.select((stateArg) => stateArg)
.subscribe((dataArg) => {
@ -309,6 +334,10 @@ export class CloudlyDashboard extends DeesElement {
name: 'Backups',
element: CloudlyViewBackups,
},
{
name: 'Fleet',
element: CloudlyViewBackups,
}
] as plugins.deesCatalog.IView[]}
></dees-simple-appdash>
</dees-simple-login>
@ -329,7 +358,7 @@ export class CloudlyDashboard extends DeesElement {
action: async () => {
await plugins.deesCatalog.DeesModal.createAndShow({
heading: 'About',
content: html`configvault ${commitinfo.version}`,
content: html`cloudly ${commitinfo.version}`,
menuOptions: [
{
name: 'close',
@ -352,11 +381,12 @@ export class CloudlyDashboard extends DeesElement {
if (loginState.jwt) {
this.jwt = loginState.jwt;
await simpleLogin.switchToSlottedContent();
await appstate.dataState.dispatchAction(appstate.getDataAction, null);
await appstate.dataState.dispatchAction(appstate.getAllDataAction, null);
}
}
private async login(username: string, password: string) {
const domtools = await this.domtoolsPromise;
console.log(`attempting to login...`);
const simpleLogin = this.shadowRoot.querySelector('dees-simple-login');
const form = simpleLogin.shadowRoot.querySelector('dees-form');
@ -370,7 +400,7 @@ export class CloudlyDashboard extends DeesElement {
this.jwt = state.jwt;
form.setStatus('success', 'Logged in!');
await simpleLogin.switchToSlottedContent();
await appstate.dataState.dispatchAction(appstate.getDataAction, null);
await appstate.dataState.dispatchAction(appstate.getAllDataAction, null);
} else {
form.setStatus('error', 'Login failed!');
await domtools.convenience.smartdelay.delayFor(2000);
@ -382,8 +412,6 @@ export class CloudlyDashboard extends DeesElement {
}
```
This script sets up a cloud management dashboard for interacting with various cloud services seamlessly. It covers creating clusters, managing DNS records, handling cloud-provider-specific resources, and much more.
With the examples provided above, you should now have a good understanding of how to use `@serve.zone/cloudly` to manage your cloud infrastructure programmatically. For deeper insights and additional features, refer to the documentation relevant to specific modules and methods used in your application.
## License and Legal Information

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@serve.zone/cloudly',
version: '1.1.4',
description: 'A cloud manager leveraging Docker Swarmkit for multi-cloud operations including DigitalOcean, Hetzner Cloud, and Cloudflare, with integration support and robust configuration management system.'
version: '1.1.5',
description: 'A comprehensive multi-cloud manager leveraging Docker Swarmkit to orchestrate containerized applications across various cloud services and integrate robust configuration and API management capabilities.'
}

5
ts/manager.cert/cert.ts Normal file
View File

@ -0,0 +1,5 @@
import * as plugins from '../plugins.js';
export class Cert extends plugins.smartdata.SmartDataDbDoc<> {
}

View File

@ -0,0 +1,14 @@
import type { Cloudly } from '../classes.cloudly.js';
import * as plugins from '../plugins.js';
export class CertManager {
public cloudlyRef: Cloudly;
public get db() {
return this.cloudlyRef.mongodbConnector.smartdataDb;
}
constructor(cloudly: Cloudly) {
this.cloudlyRef = cloudly;
}
}

View File

@ -29,11 +29,14 @@ apt-get install -y nodejs zsh
zsh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
npm config set unsafe-perm true
# lets install pnpm
curl -fsSL https://get.pnpm.io/install.sh | sh -
# lets make sure we use the correct npm registry
bash -c "npm config set registry ${this.optionsArg.npmRegistry}"
# lets install spark
bash -c "npm install -g @serve.zone/spark"
bash -c "pnpm install -g @serve.zone/spark"
# lets install the spark daemon
bash -c "spark installdaemon"

View File

@ -29,6 +29,7 @@ import * as qenv from '@push.rocks/qenv';
import * as smartacme from '@push.rocks/smartacme';
import * as smartbucket from '@push.rocks/smartbucket';
import * as smartcli from '@push.rocks/smartcli';
import * as smartclickhouse from '@push.rocks/smartclickhouse';
import * as smartdata from '@push.rocks/smartdata';
import * as smartdelay from '@push.rocks/smartdelay';
import * as smartexit from '@push.rocks/smartexit';
@ -53,6 +54,7 @@ export {
smartacme,
smartbucket,
smartcli,
smartclickhouse,
smartdata,
smartexit,
smartdelay,

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@serve.zone/cloudly',
version: '1.1.4',
description: 'A cloud manager leveraging Docker Swarmkit for multi-cloud operations including DigitalOcean, Hetzner Cloud, and Cloudflare, with integration support and robust configuration management system.'
version: '1.1.5',
description: 'A comprehensive multi-cloud manager leveraging Docker Swarmkit to orchestrate containerized applications across various cloud services and integrate robust configuration and API management capabilities.'
}