Show your support by giving us a star!

Initialize a Cluster

This guide walks you through initializing and deploying a Dosei cluster. Before starting, ensure you have:

  1. Node.js installed on your system
  2. The Dosei CLI installed and configured

Dosei uses code to define your infrastructure, allowing you to configure everything programmatically. While we support both JavaScript and Python, this guide focuses on JavaScript.

Initializing a Cluster Project

To create a new Dosei Cluster project, run:

dosei init your-domain.com -t cluster-js

This command creates a new directory named your-domain.com with the following structure:

your-domain.com/
├── dosei.js
├── package.json
└── package-lock.json

Configuring Your Cluster

  1. Navigate to the newly created project directory and install the dependencies:
cd your-domain.com && npm i
  1. Open the dosei.js file to see the default configuration:
import dosei from '@dosei/dosei';

new dosei.Cluster({
  name: "dosei.your-domain.com",
  servers: ["ubuntu@dosei.your-domain.com"]
});

Configuration Options

You can customize your cluster by modifying this configuration. The primary options include:

  • name: The hostname for your cluster
  • servers: An array of servers to deploy to (in the format username@hostname)
  • identity: Path to your SSH key (defaults to ~/.ssh/id_ed25519 or ~/.ssh/id_rsa)

For a complete list of configuration options, refer to the cluster.ts definitions.

Was this page helpful?