Skip to content

Getting Started

SysopKit works with all Node-compatible runtimes.

Terminal window
npm install sysopkit

Create a file setup.ts:

import { apply, task } from 'sysopkit';
import { resolveInventory } from 'sysopkit/inventory';
import { start } from 'sysopkit/start';
import { sudo } from 'sysopkit/middleware/sudo';
import { createFile } from 'sysopkit/op/file';
import { sh } from 'sysopkit/op/sh';
const INVENTORY = {
groups: {
web: {
hosts: {
'web-1': { host: '192.168.1.10', user: 'sysop' },
'web-2': { host: '192.168.1.11', user: 'sysop' },
},
},
},
};
await start(async () => {
await using hosts = resolveInventory(INVENTORY);
await apply('setup nginx', hosts.getByGroup('web'), async () => {
await sudo(async () => {
await task('install nginx', async () => {
await sh('apt install -y nginx');
});
await createFile({
path: '/etc/nginx/sites-available/default',
content: 'server { listen 80; }',
mode: 0o644,
});
await task('enable nginx', async () => {
await sh('systemctl enable --now nginx');
});
});
});
});

Run it:

Terminal window
node setup.ts
  • Tutorial — walk through a complete provisioning scenario
  • Concepts — understand the execution model and architecture