ramm 0.0.2 → 0.0.4
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/README.md +151 -0
- package/dist/bun.sh +2 -6
- package/dist/ramm.js +180 -32
- package/dist/types/base.d.ts +12 -0
- package/dist/types/context.d.ts +13 -0
- package/dist/types/debug.d.ts +3 -0
- package/dist/types/init.d.ts +2 -0
- package/dist/types/nft.d.ts +2 -0
- package/dist/types/packages.d.ts +1 -0
- package/dist/types/podman.d.ts +6 -0
- package/dist/types/ramm.d.ts +9 -13
- package/dist/types/systemd.d.ts +6 -0
- package/package.json +4 -1
package/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
## Overview
|
|
2
|
+
|
|
3
|
+
RAMM is a Bun library designed to simplify remote server management, deployment automation, and container operations with JS. Ansibsle inspired mechanism, but in JS with imperative commands
|
|
4
|
+
|
|
5
|
+
It provides utilities for:
|
|
6
|
+
|
|
7
|
+
- Remote command execution over SSH
|
|
8
|
+
- File synchronization using rsync
|
|
9
|
+
- System package management
|
|
10
|
+
- Podman container management
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
bun add ramm
|
|
16
|
+
# or
|
|
17
|
+
npm install ramm
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start Example
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { $, build } from "bun";
|
|
24
|
+
import { Context, exec, copyFiles, debug, installBun } from "ramm";
|
|
25
|
+
|
|
26
|
+
const context = new Context("root", "example.com");
|
|
27
|
+
|
|
28
|
+
debug("Install bun");
|
|
29
|
+
await installBun(context);
|
|
30
|
+
|
|
31
|
+
debug("Build project");
|
|
32
|
+
await build({
|
|
33
|
+
outdir: "dist",
|
|
34
|
+
entrypoints: ["src/server.ts"],
|
|
35
|
+
target: "bun",
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
debug("Deploy files");
|
|
39
|
+
await copyFiles(context, "./dist/", "./dist");
|
|
40
|
+
|
|
41
|
+
debug("Start server");
|
|
42
|
+
await exec(context, "bun run ./dist/server.js");
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Core API Reference
|
|
46
|
+
|
|
47
|
+
### Context Class
|
|
48
|
+
|
|
49
|
+
Data storage to connect server
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
class Context {
|
|
53
|
+
constructor(name: string, address: string);
|
|
54
|
+
getAddress(): string;
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- name: Server username
|
|
59
|
+
- address: Server IP/hostname
|
|
60
|
+
- getAddress(): Returns "user@host" format
|
|
61
|
+
|
|
62
|
+
### copyFiles
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
copyFiles(context: Context, from: string, to: string)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Uses rsync to copy files to remote server. Supports directories.
|
|
69
|
+
|
|
70
|
+
Example
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
await copyFiles(context, "./local", "/remote/path");
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Exec
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
exec(context: Context, command: string)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Executes command on remote server via SSH.
|
|
83
|
+
|
|
84
|
+
Example
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
await exec(ctx, "systemctl restart nginx");
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Install system package
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
installSystemPackage(packageName: string)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Auto-detects OS and uses appropriate package manager.
|
|
97
|
+
|
|
98
|
+
Example
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
await installSystemPackage("nginx");
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Install podman
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
installPodman(packageName: string)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Installs Podman if not present.
|
|
111
|
+
|
|
112
|
+
Example
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
await installPodman();
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Install podman
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
runPodmanContainer(command: string, name: string)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Smart container management:
|
|
125
|
+
|
|
126
|
+
- Checks if container exists
|
|
127
|
+
- Recreates if configuration changed
|
|
128
|
+
- Skips if already running
|
|
129
|
+
|
|
130
|
+
Example
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
await runPodmanContainer("podman run -d --name web nginx", "web");
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Install bun
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
installBun(context: Context)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Smart container management:
|
|
143
|
+
|
|
144
|
+
- Copies installation script to server
|
|
145
|
+
- Executes bun.sh on remote host
|
|
146
|
+
|
|
147
|
+
Example
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
await installBun(context);
|
|
151
|
+
```
|
package/dist/bun.sh
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
-
# Проверка наличия файла /etc/os-release
|
|
4
3
|
if ! command -v unzip &> /dev/null; then
|
|
5
4
|
. /etc/os-release
|
|
6
|
-
echo "Дистрибутив: $NAME"
|
|
7
5
|
|
|
8
6
|
if [[ "$ID" == "ubuntu" ]]; then
|
|
9
7
|
sudo apt update
|
|
@@ -12,12 +10,10 @@ if ! command -v unzip &> /dev/null; then
|
|
|
12
10
|
fi
|
|
13
11
|
|
|
14
12
|
if ! command -v bun &> /dev/null; then
|
|
15
|
-
echo "
|
|
13
|
+
echo "Installing..."
|
|
16
14
|
|
|
17
15
|
curl -fsSL https://bun.sh/install | bash
|
|
18
16
|
ln -s "$HOME/.bun/bin/bun" /usr/local/bin/bun
|
|
19
|
-
|
|
20
|
-
echo "Bun установлен!"
|
|
21
17
|
else
|
|
22
|
-
echo "
|
|
18
|
+
echo "Already installed."
|
|
23
19
|
fi
|
package/dist/ramm.js
CHANGED
|
@@ -1,80 +1,228 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// src/
|
|
3
|
-
var {
|
|
2
|
+
// src/base.ts
|
|
3
|
+
var {spawn } = globalThis.Bun;
|
|
4
|
+
|
|
5
|
+
// src/debug.ts
|
|
4
6
|
var debugInternal = (func, command) => {
|
|
5
7
|
console.info(`>>>${func}<<< ${command}`);
|
|
6
8
|
};
|
|
9
|
+
var debugSilentCommand = (command) => {
|
|
10
|
+
debugInternal("\x1B[32mCommand (silent)\x1B[0m", `\x1B[38;5;85m${command}\x1B[0m`);
|
|
11
|
+
};
|
|
7
12
|
var debugCommand = (command) => {
|
|
8
13
|
debugInternal("\x1B[32mCommand\x1B[0m", `\x1B[38;5;85m${command}\x1B[0m`);
|
|
9
14
|
};
|
|
10
15
|
var debug = (text) => {
|
|
11
16
|
debugInternal("\x1B[34mBlock\x1B[0m", `\x1B[38;5;81m${text}\x1B[0m`);
|
|
12
17
|
};
|
|
13
|
-
var execCommand = async (command) => {
|
|
14
|
-
debugCommand(command);
|
|
15
|
-
const result = await spawn(["bash", "-c", command], {
|
|
16
|
-
stdin: "inherit",
|
|
17
|
-
stdout: "inherit",
|
|
18
|
-
stderr: "inherit"
|
|
19
|
-
});
|
|
20
|
-
await result.exited;
|
|
21
|
-
};
|
|
22
18
|
|
|
19
|
+
// src/context.ts
|
|
23
20
|
class Context {
|
|
24
21
|
name;
|
|
25
22
|
domain;
|
|
26
|
-
|
|
23
|
+
userspace;
|
|
24
|
+
sudo;
|
|
25
|
+
constructor({
|
|
26
|
+
name,
|
|
27
|
+
address,
|
|
28
|
+
userspace = false,
|
|
29
|
+
sudo = false
|
|
30
|
+
}) {
|
|
27
31
|
this.name = name;
|
|
28
32
|
this.domain = address;
|
|
33
|
+
this.sudo = sudo;
|
|
34
|
+
this.userspace = userspace;
|
|
29
35
|
}
|
|
30
36
|
getAddress() {
|
|
31
37
|
return `${this.name}@${this.domain}`;
|
|
32
38
|
}
|
|
33
39
|
}
|
|
34
|
-
|
|
40
|
+
|
|
41
|
+
// src/base.ts
|
|
42
|
+
var defaultContext = new Context({
|
|
43
|
+
name: "root",
|
|
44
|
+
address: "0.0.0.0",
|
|
45
|
+
userspace: false,
|
|
46
|
+
sudo: false
|
|
47
|
+
});
|
|
48
|
+
var tee = async (read) => {
|
|
49
|
+
const reader = read.getReader();
|
|
50
|
+
let output = "";
|
|
51
|
+
while (true) {
|
|
52
|
+
const { value, done: doneReading } = await reader.read();
|
|
53
|
+
if (doneReading) {
|
|
54
|
+
return output;
|
|
55
|
+
}
|
|
56
|
+
const decoder = new TextDecoder("utf-8");
|
|
57
|
+
output += decoder.decode(value);
|
|
58
|
+
process.stdout.write(value);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var readStreamToStr = async (read) => {
|
|
62
|
+
const reader = read.getReader();
|
|
63
|
+
let output = "";
|
|
64
|
+
while (true) {
|
|
65
|
+
const { value, done: doneReading } = await reader.read();
|
|
66
|
+
if (doneReading) {
|
|
67
|
+
return output;
|
|
68
|
+
}
|
|
69
|
+
const decoder = new TextDecoder("utf-8");
|
|
70
|
+
output += decoder.decode(value);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var execCommand = async (command) => {
|
|
74
|
+
debugCommand(command);
|
|
75
|
+
const result = spawn(["bash", "-c", command], {
|
|
76
|
+
stdin: "inherit",
|
|
77
|
+
stdout: "pipe",
|
|
78
|
+
stderr: "inherit"
|
|
79
|
+
});
|
|
80
|
+
const output = await tee(result.stdout);
|
|
81
|
+
await result.exited;
|
|
82
|
+
return {
|
|
83
|
+
output,
|
|
84
|
+
spawnResult: result
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
var execCommandSilent = async (command) => {
|
|
88
|
+
debugSilentCommand(command);
|
|
89
|
+
const result = spawn(["bash", "-c", command]);
|
|
90
|
+
const output = await readStreamToStr(result.stdout);
|
|
91
|
+
await result.exited;
|
|
92
|
+
return {
|
|
93
|
+
output,
|
|
94
|
+
spawnResult: result
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
var copyFiles = async (from, to, context) => {
|
|
35
98
|
await execCommand(`rsync -avz ${from} ${context.getAddress()}:${to}`);
|
|
36
99
|
};
|
|
37
|
-
var exec = async (
|
|
100
|
+
var exec = async (command, context) => {
|
|
38
101
|
await execCommand(`ssh ${context.getAddress()} "${command}"`);
|
|
39
102
|
};
|
|
103
|
+
// src/init.ts
|
|
104
|
+
var installBun = async (context) => {
|
|
105
|
+
const bunPath = new URL(import.meta.resolve("./bun.sh")).pathname;
|
|
106
|
+
await copyFiles(bunPath, "./bun.sh", context);
|
|
107
|
+
await exec("./bun.sh", context);
|
|
108
|
+
};
|
|
109
|
+
// src/podman.ts
|
|
110
|
+
var {$: $2 } = globalThis.Bun;
|
|
111
|
+
|
|
112
|
+
// src/packages.ts
|
|
113
|
+
var {$ } = globalThis.Bun;
|
|
40
114
|
var installSystemPackage = async (packageName) => {
|
|
41
|
-
const osName = await $`cat /etc/os-release | grep ^ID= | cut -d'=' -f2`.text();
|
|
115
|
+
const osName = (await $`cat /etc/os-release | grep ^ID= | cut -d'=' -f2`.text()).trim();
|
|
42
116
|
if (osName === "ubuntu") {
|
|
43
|
-
execCommand(`apt-get install -y ${packageName}`);
|
|
117
|
+
await execCommand(`apt-get install -y ${packageName}`);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// src/systemd.ts
|
|
122
|
+
var systemctlWordLangth = "systemctl ".length;
|
|
123
|
+
var formatUserspace = (context, command) => {
|
|
124
|
+
const userPart = context.userspace ? "--user" : "";
|
|
125
|
+
return `systemctl ${userPart} ${command.slice(systemctlWordLangth)}`;
|
|
126
|
+
};
|
|
127
|
+
var getSysyemdServiceName = (name) => {
|
|
128
|
+
return `${name}.service`;
|
|
129
|
+
};
|
|
130
|
+
var getSystemdPathToService = (context, serviceName) => {
|
|
131
|
+
if (context.userspace) {
|
|
132
|
+
return `~/.config/systemd/user/${serviceName}`;
|
|
44
133
|
}
|
|
134
|
+
return `/etc/systemd/system/${serviceName}`;
|
|
135
|
+
};
|
|
136
|
+
var stopSystemdService = async (constext, name) => {
|
|
137
|
+
await execCommand(formatUserspace(constext, `systemctl stop ${name}`));
|
|
138
|
+
};
|
|
139
|
+
var restartSystemdService = async (name, constext = defaultContext) => {
|
|
140
|
+
await execCommand(formatUserspace(constext, `systemctl restart ${name}`));
|
|
45
141
|
};
|
|
142
|
+
var checkSystemdService = async (context, serviceName) => {
|
|
143
|
+
const { spawnResult } = await execCommand(formatUserspace(context, `systemctl is-active ${serviceName}`));
|
|
144
|
+
return spawnResult.exitCode === 0;
|
|
145
|
+
};
|
|
146
|
+
var createSystemdService = async (context, serviceName, pathToServiceFile) => {
|
|
147
|
+
const pathToSeviceTarget = getSystemdPathToService(context, serviceName);
|
|
148
|
+
await execCommand(`cp -v ${pathToServiceFile} ${pathToSeviceTarget}`);
|
|
149
|
+
await execCommand(formatUserspace(context, "systemctl daemon-reload"));
|
|
150
|
+
await execCommand(formatUserspace(context, `systemctl enable ${serviceName}`));
|
|
151
|
+
await execCommand(formatUserspace(context, `sysyemctl start ${serviceName}`));
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// src/nft.ts
|
|
155
|
+
var localNftChainName = "local_chain";
|
|
156
|
+
var setupNftable = async (allowedIpSsh) => {
|
|
157
|
+
const listTable = await execCommandSilent("nft list table inet ramm");
|
|
158
|
+
if (listTable.spawnResult.exitCode === 0) {
|
|
159
|
+
await execCommand("nft delete table inet ramm");
|
|
160
|
+
}
|
|
161
|
+
await execCommand("nft add table inet ramm");
|
|
162
|
+
await execCommand("nft add chain inet ramm input '{ type filter hook input priority 0 ; }'");
|
|
163
|
+
await execCommand(`nft add set inet ramm allowed_ssh_ipv4 '{ type ipv4_addr; flags dynamic; elements = { ${allowedIpSsh} } }'`);
|
|
164
|
+
await execCommand(`nft add chain inet ramm ${localNftChainName}`);
|
|
165
|
+
await execCommand(`nft add rule inet ramm ${localNftChainName} iif lo accept`);
|
|
166
|
+
await execCommand(`nft add rule inet ramm ${localNftChainName} ct state established,related accept`);
|
|
167
|
+
await execCommand(`nft add rule inet ramm ${localNftChainName} ip saddr @allowed_ssh_ipv4 tcp dport 22 accept`);
|
|
168
|
+
await execCommand(`nft add rule inet ramm ${localNftChainName} tcp dport 22 ct state new limit rate over 3/minute drop`);
|
|
169
|
+
await execCommand(`nft add rule inet ramm ${localNftChainName} tcp dport 22 accept`);
|
|
170
|
+
await execCommand(`nft add rule inet ramm ${localNftChainName} tcp dport 80 accept`);
|
|
171
|
+
await execCommand(`nft add rule inet ramm ${localNftChainName} tcp dport 443 accept`);
|
|
172
|
+
await execCommand(`nft add rule inet ramm ${localNftChainName} drop`);
|
|
173
|
+
await execCommand("nft add rule inet ramm input fib daddr type local jump local_chain ");
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
// src/podman.ts
|
|
46
177
|
var installPodman = async () => {
|
|
47
|
-
if ((await
|
|
48
|
-
|
|
178
|
+
if ((await $2`command -v podman`.nothrow().quiet()).exitCode !== 0) {
|
|
179
|
+
await installSystemPackage("podman");
|
|
49
180
|
}
|
|
50
|
-
await
|
|
181
|
+
await createNetwork();
|
|
182
|
+
};
|
|
183
|
+
var createNetwork = async () => {
|
|
184
|
+
await execCommand("podman network create --interface-name=podman_ramm ramm");
|
|
185
|
+
};
|
|
186
|
+
var getCreateCommand = async (name) => {
|
|
187
|
+
const podmanCreateCommand = await $2`podman inspect --format '{{.Config.CreateCommand}}' ${name}`.nothrow().quiet();
|
|
188
|
+
return podmanCreateCommand.text().slice(0, -1).slice(1, -1) || "";
|
|
51
189
|
};
|
|
52
|
-
var runPodmanContainer = async (
|
|
53
|
-
|
|
54
|
-
|
|
190
|
+
var runPodmanContainer = async (name, command) => {
|
|
191
|
+
if (await getCreateCommand(name) !== command) {
|
|
192
|
+
await $2`podman rm -f ${name}`;
|
|
55
193
|
await execCommand(command);
|
|
56
194
|
return;
|
|
57
195
|
}
|
|
58
|
-
const podmanCreateCommandText = podmanCreateCommand.text().slice(0, -1);
|
|
59
|
-
if (podmanCreateCommandText !== `[${command}]`) {
|
|
60
|
-
await $`podman rm -f ${name}`;
|
|
61
|
-
execCommand(command);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
196
|
console.info("Podman container is already running");
|
|
65
197
|
};
|
|
66
|
-
var
|
|
67
|
-
const
|
|
68
|
-
await
|
|
69
|
-
|
|
198
|
+
var runPodmanContainerService = async (name, command, context = defaultContext) => {
|
|
199
|
+
const serviceName = getSysyemdServiceName(name);
|
|
200
|
+
if (await checkSystemdService(context, serviceName)) {
|
|
201
|
+
await stopSystemdService(context, serviceName);
|
|
202
|
+
}
|
|
203
|
+
await runPodmanContainer(name, command);
|
|
204
|
+
await execCommand(`podman generate systemd --name --new ${name} > ${serviceName}`);
|
|
205
|
+
await createSystemdService(context, serviceName, serviceName);
|
|
206
|
+
};
|
|
207
|
+
var addNftPodmanRule = async () => {
|
|
208
|
+
const podmanNetworksResult = await execCommand("podman network inspect $(podman network ls -q) -f '{{.NetworkInterface}}'");
|
|
209
|
+
const podmanNetworks = podmanNetworksResult.output.trim().split(`
|
|
210
|
+
`);
|
|
211
|
+
await execCommand(`nft add set inet ramm podman_interfaces '{ type ifname; flags dynamic; elements = { ${podmanNetworks.join(", ")} }; }'`);
|
|
212
|
+
await execCommand("nft add chain inet ramm forward '{ type filter hook input priority 0 ; }'");
|
|
213
|
+
await execCommand(`nft add rule inet ramm forward iifname @podman_interfaces jump ${localNftChainName}`);
|
|
70
214
|
};
|
|
71
215
|
export {
|
|
216
|
+
setupNftable,
|
|
217
|
+
runPodmanContainerService,
|
|
72
218
|
runPodmanContainer,
|
|
219
|
+
restartSystemdService,
|
|
73
220
|
installSystemPackage,
|
|
74
221
|
installPodman,
|
|
75
222
|
installBun,
|
|
76
223
|
exec,
|
|
77
224
|
debug,
|
|
78
225
|
copyFiles,
|
|
226
|
+
addNftPodmanRule,
|
|
79
227
|
Context
|
|
80
228
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Context } from "./context.ts";
|
|
2
|
+
export declare const defaultContext: Context;
|
|
3
|
+
export declare const execCommand: (command: string) => Promise<{
|
|
4
|
+
output: string;
|
|
5
|
+
spawnResult: import("bun").Subprocess<"inherit", "pipe", "inherit">;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const execCommandSilent: (command: string) => Promise<{
|
|
8
|
+
output: string;
|
|
9
|
+
spawnResult: import("bun").Subprocess<"ignore", "pipe", "inherit">;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const copyFiles: (from: string, to: string, context: Context) => Promise<void>;
|
|
12
|
+
export declare const exec: (command: string, context: Context) => Promise<void>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class Context {
|
|
2
|
+
name: string;
|
|
3
|
+
domain: string;
|
|
4
|
+
userspace: boolean;
|
|
5
|
+
sudo: boolean;
|
|
6
|
+
constructor({ name, address, userspace, sudo, }: {
|
|
7
|
+
name: string;
|
|
8
|
+
address: string;
|
|
9
|
+
userspace?: boolean;
|
|
10
|
+
sudo?: boolean;
|
|
11
|
+
});
|
|
12
|
+
getAddress(): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const installSystemPackage: (packageName: string) => Promise<void>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Context } from "./context.ts";
|
|
2
|
+
export declare const installPodman: () => Promise<void>;
|
|
3
|
+
export declare const getCreateCommand: (name: string) => Promise<string>;
|
|
4
|
+
export declare const runPodmanContainer: (name: string, command: string) => Promise<void>;
|
|
5
|
+
export declare const runPodmanContainerService: (name: string, command: string, context?: Context) => Promise<void>;
|
|
6
|
+
export declare const addNftPodmanRule: () => Promise<void>;
|
package/dist/types/ramm.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export declare const installSystemPackage: (packageName: string) => Promise<void>;
|
|
11
|
-
export declare const installPodman: () => Promise<void>;
|
|
12
|
-
export declare const runPodmanContainer: (command: string, name: string) => Promise<void>;
|
|
13
|
-
export declare const installBun: (context: Context) => Promise<void>;
|
|
1
|
+
export { exec, copyFiles } from "./base.ts";
|
|
2
|
+
export { Context } from "./context.ts";
|
|
3
|
+
export { installBun } from "./init.ts";
|
|
4
|
+
export { installPodman, runPodmanContainer } from "./podman.ts";
|
|
5
|
+
export { runPodmanContainerService, addNftPodmanRule } from "./podman.ts";
|
|
6
|
+
export { restartSystemdService } from "./systemd.ts";
|
|
7
|
+
export { installSystemPackage } from "./packages.ts";
|
|
8
|
+
export { debug } from "./debug.ts";
|
|
9
|
+
export { setupNftable } from "./nft.ts";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Context } from "./context.ts";
|
|
2
|
+
export declare const getSysyemdServiceName: (name: string) => string;
|
|
3
|
+
export declare const stopSystemdService: (constext: Context, name: string) => Promise<void>;
|
|
4
|
+
export declare const restartSystemdService: (name: string, constext?: Context) => Promise<void>;
|
|
5
|
+
export declare const checkSystemdService: (context: Context, serviceName: string) => Promise<boolean>;
|
|
6
|
+
export declare const createSystemdService: (context: Context, serviceName: string, pathToServiceFile: string) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ramm",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.4",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "bun build ./src/ramm.ts --target bun --outdir ./dist && cp ./src/bun.sh ./dist/bun.sh && bun run types",
|
|
7
7
|
"types": "tsc --project tsconfig.types.json"
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"dist/*"
|
|
13
13
|
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"bun": ">=1.0.0"
|
|
16
|
+
},
|
|
14
17
|
"devDependencies": {
|
|
15
18
|
"@types/bun": "latest",
|
|
16
19
|
"typescript": "^5.8.2"
|