DEV Community

Cover image for Introduce GreyShip
Haki
Haki

Posted on

Introduce GreyShip

I have been building Greyship, a serverless platform made only for Go. It is open source (AGPL-3.0) and runs on a server you own. Today I am releasing it publicly.

The problem

I wanted what serverless promises (push code, get a URL, pay nothing while idle) without wrapping my handlers, writing a Dockerfile, or renting capacity I do not use. The platforms that come close either run your app like an always-on server or ask you to change how you write it.

What Greyship does

You bring a normal Go project: a go.mod and one or more main packages. You run:

grey deploy
Enter fullscreen mode Exit fullscreen mode

Greyship reads your code (it never runs it) and finds every main package. One that starts an HTTP server becomes a web service with an HTTPS URL. The rest become workers. A release command, such as a migration, runs before the new version starts.

This is a real run:

$ grey deploy
Created project you/testapi

  testapi  web  .  starts a server in main.go:13 (http.ListenAndServe)

Building here with go1.27.3 for linux/amd64
Uploaded 1 binaries (2.4 MB)

Deployment 5e7c26de-6e97-422e-8ac1-4a70528e3d19 queued:
  │ using the 1 binaries built on your machine
  │ checked testapi: Go 1.27.3, linux/amd64 (5.6 MB)
  │ starting testapi on your-server
  │ live

✓ Live
  testapi  https://testapi-testapi.greyshipapp.tech
Enter fullscreen mode Exit fullscreen mode

How it behaves

  • Scale to zero. A web service with no requests pauses after 30 seconds. Its memory stays where it is, but it uses no CPU. The next request resumes it, which is usually much faster than a cold start.
  • Safe switchover. The new version starts and must pass its health check before it gets traffic. If anything fails, the live version keeps serving.
  • Rollbacks. Go back to any earlier deployment without a rebuild.
  • Sandboxes. Every app runs in its own gVisor sandbox with its own network, so apps cannot reach each other, the host or Greyship's internals.
  • Build where you like. Compile on your laptop and only changed binaries are uploaded, or let the server build inside a sandbox so you do not need Go installed.
  • Deploy your way. The CLI, the dashboard and GitHub push-to-deploy all use the same API.

Run it yourself

On a fresh Ubuntu or Debian server with 4 GB of RAM, as root:

curl -fsSL https://greyship.tech/install | sudo sh
Enter fullscreen mode Exit fullscreen mode

It installs Docker, gVisor, Postgres, an S3-compatible store and the Greyship services, then prints the address of your dashboard and asks you to create the owner account. No domain is needed to start. The owner adds everyone else and can limit how much memory, CPU and how many builds each user may use.

On your laptop:

curl -fsSL https://greyship.tech/cli/install | sh
grey server https://your-greyship-address
grey login
Enter fullscreen mode Exit fullscreen mode

What to know

Greyship runs on a single server, so how many apps you can run depends on the size of that server. Idle apps hold no CPU, which helps a small machine go a long way. There is no high availability yet, so keep backups of anything that matters. The installer includes backup, restore and upgrade commands.

Links

If you write Go, I would like to hear what breaks. Open an issue or tell me on X: https://x.com/shellhaki

Top comments (0)