ramm 0.0.63 → 0.0.64
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.
- package/dist/types/base/base.d.ts +35 -0
- package/dist/types/base/tee.d.ts +2 -0
- package/dist/types/build.d.ts +7 -0
- package/dist/types/context.d.ts +16 -0
- package/dist/types/cron.d.ts +6 -0
- package/dist/types/files.d.ts +4 -0
- package/dist/types/init.d.ts +2 -0
- package/dist/types/nft.d.ts +8 -0
- package/dist/types/packages.d.ts +13 -0
- package/dist/types/path.d.ts +1 -0
- package/dist/types/podman.d.ts +25 -0
- package/dist/types/print.d.ts +3 -0
- package/dist/types/ramm.d.ts +13 -0
- package/dist/types/ssh.d.ts +12 -0
- package/dist/types/systemd.d.ts +10 -0
- package/package.json +4 -3
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Subprocess } from "bun";
|
|
2
|
+
import { Context } from "../context.ts";
|
|
3
|
+
export declare const defaultContext: Context;
|
|
4
|
+
export type ExecCommandStore = {
|
|
5
|
+
spawnResult?: Subprocess<"inherit", "pipe", "pipe">;
|
|
6
|
+
};
|
|
7
|
+
type ExecProps = {
|
|
8
|
+
store?: ExecCommandStore;
|
|
9
|
+
env?: Record<string, string>;
|
|
10
|
+
cwd?: string;
|
|
11
|
+
prefix?: string;
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
} | void;
|
|
14
|
+
export declare const execCommandRaw: (command: string, { store, signal, env, cwd, prefix }?: ExecProps, ctx?: Context) => Promise<{
|
|
15
|
+
stderr: string;
|
|
16
|
+
stdout: string;
|
|
17
|
+
spawnResult: Subprocess<"inherit", "pipe", "pipe">;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const execCommandMayError: (command: string, props: ExecProps, context?: Context) => Promise<{
|
|
20
|
+
stderr: string;
|
|
21
|
+
stdout: string;
|
|
22
|
+
spawnResult: Subprocess<"inherit", "pipe", "pipe">;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const execCommand: (command: string, props: ExecProps, context?: Context) => Promise<{
|
|
25
|
+
stderr: string;
|
|
26
|
+
stdout: string;
|
|
27
|
+
spawnResult: Subprocess<"inherit", "pipe", "pipe">;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const copyFilesOverSsh: (from: string, to: string, context: Context) => Promise<void>;
|
|
30
|
+
export declare const execCommandOverSsh: (command: string, context: Context) => Promise<{
|
|
31
|
+
stderr: string;
|
|
32
|
+
stdout: string;
|
|
33
|
+
spawnResult: Subprocess<"inherit", "pipe", "pipe">;
|
|
34
|
+
}>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Context } from "./context.ts";
|
|
2
|
+
export declare const buildAndRunOverSsh: ({ entrypoint, context, }: {
|
|
3
|
+
entrypoint: string;
|
|
4
|
+
context: Context;
|
|
5
|
+
}) => Promise<void>;
|
|
6
|
+
export declare const passVarsClient: (data: Record<string, any>, context: Context) => Promise<void>;
|
|
7
|
+
export declare const passVarsServer: (context?: Context) => Promise<any>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class Context {
|
|
2
|
+
user: string;
|
|
3
|
+
domain: string;
|
|
4
|
+
userspace: boolean;
|
|
5
|
+
sudo: boolean;
|
|
6
|
+
sshKey?: string;
|
|
7
|
+
params: Record<string, string>;
|
|
8
|
+
constructor({ user, address, userspace, sudo, sshKey, }: {
|
|
9
|
+
user: string;
|
|
10
|
+
address: string;
|
|
11
|
+
userspace?: boolean;
|
|
12
|
+
sudo?: boolean;
|
|
13
|
+
sshKey?: string;
|
|
14
|
+
});
|
|
15
|
+
getAddress(): string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Context } from "./context.ts";
|
|
2
|
+
export declare const normalizeFileContent: (str: string) => string;
|
|
3
|
+
export declare const writeFileStrUniq: (rawFilePath: string, str: string, context?: Context) => Promise<void>;
|
|
4
|
+
export declare const writeFile: (pathToFile: string, str: string, context?: Context) => Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Context } from "./context.ts";
|
|
2
|
+
export declare const localNftChainName = "local_chain";
|
|
3
|
+
export declare const setupNftable: ({ allowedIpV4, allowedPorts, context, }: {
|
|
4
|
+
allowedIpV4: string[];
|
|
5
|
+
allowedPorts: string[];
|
|
6
|
+
context?: Context;
|
|
7
|
+
}) => Promise<void>;
|
|
8
|
+
export declare const safeNftTable: (context?: Context) => Promise<void>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Context } from "./context.ts";
|
|
2
|
+
type Manager = "dnf" | "apt";
|
|
3
|
+
type PackageConfig = {
|
|
4
|
+
name: string;
|
|
5
|
+
command: string;
|
|
6
|
+
managers?: Record<Manager, ManagerConfig>;
|
|
7
|
+
};
|
|
8
|
+
type ManagerConfig = {
|
|
9
|
+
name: string;
|
|
10
|
+
command: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const installSystemPackage: (packageEnt: string | PackageConfig, context?: Context) => Promise<void>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalizePath(rawFilePath: string): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Context } from "./context.ts";
|
|
2
|
+
export declare const installPodman: (context?: Context) => Promise<void>;
|
|
3
|
+
export declare const loginPodman: (address: string, login: string, password: string, context?: Context) => Promise<{
|
|
4
|
+
stderr: string;
|
|
5
|
+
stdout: string;
|
|
6
|
+
spawnResult: import("bun").Subprocess<"inherit", "pipe", "pipe">;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const createPodmanCommand: ({ name, replace, background, networks, envs, volumes, command, }: {
|
|
9
|
+
name?: string;
|
|
10
|
+
replace?: boolean;
|
|
11
|
+
background?: boolean;
|
|
12
|
+
networks?: string[];
|
|
13
|
+
envs?: {
|
|
14
|
+
name: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}[];
|
|
17
|
+
volumes?: {
|
|
18
|
+
from: string;
|
|
19
|
+
to: string;
|
|
20
|
+
}[];
|
|
21
|
+
command: string;
|
|
22
|
+
}) => string;
|
|
23
|
+
export declare const runPodmanContainer: (name: string, command: string, context?: Context) => Promise<void>;
|
|
24
|
+
export declare const runPodmanContainerService: (name: string, command: string, context?: Context) => Promise<void>;
|
|
25
|
+
export declare const addNftPodmanRule: (context?: Context) => Promise<void>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { execCommandOverSsh, execCommand, execCommandMayError, copyFilesOverSsh, execCommandRaw, } from "./base/base.ts";
|
|
2
|
+
export { Context } from "./context.ts";
|
|
3
|
+
export { installBunOverSsh } from "./init.ts";
|
|
4
|
+
export { installPodman, runPodmanContainer, loginPodman, runPodmanContainerService, addNftPodmanRule, createPodmanCommand, } from "./podman.ts";
|
|
5
|
+
export { startSystemdUnit, enableSystemdUnit, restartSystemdUnit, createSystemdService, getSystemdPathToUnit, createSystemdUnit, reloadSystemd, } from "./systemd.ts";
|
|
6
|
+
export { installSystemPackage } from "./packages.ts";
|
|
7
|
+
export { printBlock } from "./print.ts";
|
|
8
|
+
export { setupNftable } from "./nft.ts";
|
|
9
|
+
export { writeFileStrUniq, writeFile, normalizeFileContent, } from "./files.ts";
|
|
10
|
+
export { createAndAddSshKey, getServerFingerprint, addKeyToHostConfig, addSshKeyToUse, saveSshFingerptint, } from "./ssh.ts";
|
|
11
|
+
export { normalizePath } from "./path.ts";
|
|
12
|
+
export { createCron } from "./cron.ts";
|
|
13
|
+
export { buildAndRunOverSsh, passVarsClient, passVarsServer } from "./build.ts";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Context } from "./context.ts";
|
|
2
|
+
export declare const addKeyToHostConfig: (pathToHost: string, address: string, pathToKey: string, context?: Context) => Promise<void>;
|
|
3
|
+
export declare const getServerFingerprint: (context: Context) => Promise<string>;
|
|
4
|
+
export declare const saveSshFingerptint: (filePath: string, context: Context) => Promise<void>;
|
|
5
|
+
export declare const createAndAddSshKey: (filePath: string, comment: string, context: Context) => Promise<void>;
|
|
6
|
+
export declare const addSshKeyToUse: ({ key, fingerprint, filePath, server, context, }: {
|
|
7
|
+
key: string;
|
|
8
|
+
fingerprint: string;
|
|
9
|
+
filePath: string;
|
|
10
|
+
server: string;
|
|
11
|
+
context?: Context;
|
|
12
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Context } from "./context.ts";
|
|
2
|
+
export declare const reloadSystemd: (context?: Context) => Promise<void>;
|
|
3
|
+
export declare const startSystemdUnit: (unitName: string, context?: Context) => Promise<void>;
|
|
4
|
+
export declare const enableSystemdUnit: (unitName: string, context?: Context) => Promise<void>;
|
|
5
|
+
export declare const restartSystemdUnit: (name: string, context?: Context) => Promise<void>;
|
|
6
|
+
export declare const stopSystemdUnit: (name: string, context?: Context) => Promise<void>;
|
|
7
|
+
export declare const checkSystemdUnit: (serviceName: string, context?: Context) => Promise<boolean>;
|
|
8
|
+
export declare const createSystemdUnit: (unitName: string, content: string, context?: Context) => Promise<void>;
|
|
9
|
+
export declare const getSystemdPathToUnit: (serviceName: string, context?: Context) => string;
|
|
10
|
+
export declare const createSystemdService: (serviceName: string, content: string, context?: Context) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ramm",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.64",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "bun build
|
|
7
|
-
"
|
|
6
|
+
"build": "bun run build:js && bun run build:types",
|
|
7
|
+
"build:js": "bun build ./src/ramm.ts --target bun --outdir ./dist && cp ./src/bun.sh ./dist/bun.sh",
|
|
8
|
+
"build:types": "tsc --project tsconfig.types.json"
|
|
8
9
|
},
|
|
9
10
|
"main": "dist/ramm.js",
|
|
10
11
|
"types": "dist/types/ramm.d.ts",
|