ramm
v0.0.45
Published
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
Readme
Overview
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
It provides utilities for:
- Remote command execution over SSH
- File synchronization using rsync
- System package management
- Podman container management
Installation
bun add ramm
# or
npm install rammQuick Start Example
import { $, build } from "bun";
import { Context, exec, copyFiles, debug, installBun } from "ramm";
const context = new Context("root", "example.com");
debug("Install bun");
await installBun(context);
debug("Build project");
await build({
outdir: "dist",
entrypoints: ["src/server.ts"],
target: "bun",
});
debug("Deploy files");
await copyFiles(context, "./dist/", "./dist");
debug("Start server");
await exec(context, "bun run ./dist/server.js");Core API Reference
Context Class
Data storage to connect server
class Context {
constructor(name: string, address: string);
getAddress(): string;
}- name: Server username
- address: Server IP/hostname
- getAddress(): Returns "user@host" format
copyFiles
copyFiles(context: Context, from: string, to: string)Uses rsync to copy files to remote server. Supports directories.
Example
await copyFiles(context, "./local", "/remote/path");Exec
exec(context: Context, command: string)Executes command on remote server via SSH.
Example
await exec(ctx, "systemctl restart nginx");Install system package
installSystemPackage(packageName: string)Auto-detects OS and uses appropriate package manager.
Example
await installSystemPackage("nginx");Install podman
installPodman(packageName: string)Installs Podman if not present.
Example
await installPodman();Install podman
runPodmanContainer(command: string, name: string)Smart container management:
- Checks if container exists
- Recreates if configuration changed
- Skips if already running
Example
await runPodmanContainer("podman run -d --name web nginx", "web");Install bun
installBun(context: Context)Smart container management:
- Copies installation script to server
- Executes bun.sh on remote host
Example
await installBun(context);