Skip to content
@cloud-cli

Cloud CLI

A constellation of tiny modules to fully automate a personal cloud infrastructure

Cloudy

What is Cloudy?

Cloudy is a Node.JS project that works both as an API and a CLI tool. It can be used to automate the deploy and configuration of apps in a remote/cloud machine.

Everything you can run, apart from the CLI itself, is a separated module.

Concepts

We start with a new machine running GNU/Linux. We will call it the server. We configure our server to accept HTTP(S) requests and protect it with a secret string. We run a command to start a server in this machine.

Then we execute commands from anywhere: be it a Linux machine, macOS or a browser. We call this our client.

Then we install modules on the server side to add features and commands.

For example:

  • You install Cloudy on your local machine and your server (e.g. your phone, with Termux, and an instance on a cloud provider).
  • You install the @cloud-cli/sys module on your server.
  • You add a few modules, like cy sys.install px for a reverse proxy, and cy sys.install le for Let's Encrypt certificate creation.
  • You start the server with cy --serve

Note: some modules require additional programs to be present on the server, e.g. le requires certbot to be present.

Available modules

name features
dns Local DNS resolution
px Reverse Proxy
le Let's Encrypt
gd GitHub WebHooks
env Environment variables
smb SMB Mounts
vm Docker Volumes
dr Local Docker Registry
dx Run Docker Containers

Step-by-step example

On the server:

# install Cloudy CLI
npm i -g @cloud-cli/cli

# generate a random secret
head -c 5000 /dev/urandom | sha512sum | cut -d' ' -f 1

Now open cloudy.conf.mjs and configure the server:

// cloudy.conf.mjs
export const key = '[secret generated above]';

And then we start the Cloudy server:

cy --serve

On your client side:

npm i -g @cloud-cli/cli
// cloudy.conf.mjs
export const key = '[secret generated above]';

Now you can run cy --help to get a list of commands available from a terminal, or you can call the API directly via http:

GET /
Authorization: Bearer [secret generated above]

Response:

{
  "dns": [
    "add",
    "remove",
    "list"
  ],
  "env": [
    "get",
    "set",
    "show"
  ]
}

How it works and the HTTP API

  • A call to cy foo.bar --option value on the client is converted to a POST request to your-server.com/foo.bar with a JSON body { "option": "value" }.

  • The server runs your command and returns a JSON output, which is then printed back. The request looks like this:

POST /foo.bar
Host: your-server.com
Authorization: Bearer [cloudy-secret]

{ "option": "value" }

Additional settings

import { init } from '@cloud-cli/cli';

// optional, any code that you need to run when the server starts
export default {
  [init]() {
    // ...
  }
};

// optional, change remote port. Default is 1234.
export const apiPort = 8844;

// optional, change listening host. Default is 127.0.0.1 (no remote access!)
export const apiHost = '0.0.0.0';

Pinned

  1. cli cli Public

    API and CLI tool to automate server maintenance and deploys

    TypeScript 1

  2. sys sys Public

    System management commands

    TypeScript

  3. image-node image-node Public

    Base image for Node.js apps

    JavaScript 1

  4. image-nginx image-nginx Public

    Base image for static sites with Nginx

    Dockerfile

  5. px px Public

    HTTP(S) Reverse Proxy

    TypeScript

  6. exec exec Public

    Promise wrapper for child_process.spawn

    TypeScript 1

Repositories

Showing 10 of 44 repositories
  • workflows Public

    Reusable workflows

    0 0 0 0 Updated May 11, 2024
  • app-dashboard Public

    Application Dashboard

    Vue 0 0 0 0 Updated May 11, 2024
  • dx Public

    Run Docker containers

    TypeScript 0 0 0 0 Updated May 10, 2024
  • workerd Public

    A daemon to spawn and monitor workers

    JavaScript 0 0 0 0 Updated May 9, 2024
  • http Public

    Wrapper around http.createServer to provide nice logs OOB and internal metrics

    TypeScript 0 0 0 0 Updated May 9, 2024
  • proxy Public

    Minimalistic HTTP(s) reverse proxy

    TypeScript 0 0 0 1 Updated May 7, 2024
  • dns Public

    Local DNS resolution

    TypeScript 0 0 0 1 Updated May 7, 2024
  • gd Public

    Container deploy from GitHub registry via webhooks

    TypeScript 0 0 0 1 Updated May 7, 2024
  • cli Public

    API and CLI tool to automate server maintenance and deploys

    TypeScript 1 0 0 0 Updated May 7, 2024
  • env Public

    Storage for app environment variables

    JavaScript 0 0 0 0 Updated May 7, 2024

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…