Skip to main content

Trusted CGI

Table of Contents

  reddec/trusted-cgi

Lightweight self-hosted lambda/applications/cgi/serverless-functions engine.

  • No specific requirements: just one binary. Working “as-is”
  • Rich API
  • Scheduler: run actions in cron-tab like style

There is simplified version - nano-run

# Idea behind

The idea came from the past: CGI. At the beginning of the Internet, people have been making a simple script that receives incoming bytes over STDIN (standard input) and writes to STDOUT (standard output). The application server (aka CGI server), accepts clients, invokes scripts and redirects socket input/output to the script. There are a lot of details here but this is a brief explanation.

After more than 20 years the world spin around and arrived at the beginning: serverless functions/lambda and so on. It is almost CGI, except scripts became docker containers, and we need many more servers to do the same things as before.

So let’s cut the corners a bit: we have a trusted developer (our self, company workers - means it’s not arbitrary clients), so we don’t need a heavy restriction for the application, so let’s throw away docker and another heavy staff.

See documentation

# Features

  • Actions - arbitrary actions that could be invoked by UI or by scheduler
  • Scheduler - cron-like scheduling system to automatically call actions by time
  • Aliases - permanent links and aliases/links
  • Security - security and restrictions by IP, Origin and tokens
  • GIT repo - using GIT repo as a function

# Motivation

Because I want to write small handlers that will be 99% of the time just do nothing. I am already paying for the cheapest Digital Ocean (thanks guys for your existence) and do not want to pay additionally to Lambda providers like Google/Amazon/Azure.

I also tried self-hosted solutions based on k3s but it too heavy for 1GB server (yep, it is, don’t believe in marketing).

So, ‘cause I am a developer I decided to make my own wheels ;-)