1
0
Fork 0
selfhostblocks/README.md
2024-02-01 22:38:36 -08:00

6.7 KiB

Self Host Blocks

Building blocks for self-hosting with battery included.

Tests Demo Documentation

SHB's (Self Host Blocks) is yet another server management tool whose goal is to provide a lower entry-bar for self-hosting. SHB provides opinionated building blocks fitting together to self-host any service you'd want. Some common services are provided out of the box.

To achieve this, SHB is using the full power of NixOS modules. Indeed, each building block and each service is a NixOS module and uses the modules defined in Nixpkgs.

TOC

Usage

Caution: You should know that although I am using everything in this repo for my personal production server, this is really just a one person effort for now and there are most certainly bugs that I didn't discover yet.

Self Host Blocks is available as a flake. To use it in your project, add the following flake input:

inputs.selfhostblocks.url = "github:ibizaman/selfhostblocks";

See the manual for more information about installing Self Host Blocks.

  • You are new to self hosting and want pre-configured services to deploy easily. Look at the services section.
  • You are a seasoned self-hoster but want to enhance some services you deploy already. Go to the blocks section.
  • You are a user of Self Host Blocks but would like to use your own implementation for a block. Head over to the matrix channel to talk about it (this is WIP).

Why yet another self hosting tool?

By using Self Host Blocks, you get all the benefits of NixOS which are, for self hosted applications specifically:

  • declarative configuration;
  • atomic configuration rollbacks;
  • real programming language to define configurations;
  • user-defined abstractions (create your own functions or NixOS modules on top of SHB!);
  • integration with the rest of nixpkgs.

Also, SHB intends to be a library, not a framework, so you can make it fit in your existing deployment, slowly transitioning to using SHB one block or service at a time.

Each building block defines a part of what a self-hosted app should provide. For example, HTTPS access through a subdomain or Single Sign-On. The goal of SHB is to make sure those blocks all fit together, whatever the actual implementation you choose. For example, the subdomain access could be done using Caddy or Nginx. This is achieved by providing an explicit contract for each block like for the SSL block and validating that contract using NixOS VM integration tests.

Manual

The manual can be found at shb.skarabox.com.

Currently, only some services and blocks are documented. For the rest, unfortunately the source code is the best place to read about them. Here for services and here for blocks.

Roadmap

Currently, the Nextcloud service and SSL block are the most advanced and most documented.

Documenting all services and blocks will be done as I make all blocks and services use the contracts.

Upstreaming changes is also on the roadmap.

Check the issues to see planned works.

That being said, I am personally using all the blocks and services in this project, so they do work.

Available Blocks

Provided Services

Demos

Demos that start and deploy a service on a Virtual Machine on your computer are located under the demo folder. These show the onboarding experience you would get if you deployed one of the services on your own server.

Community

All issues and PRs are welcome. For PRs, if they are substantial changes, please open an issue to discuss the details first.

Come hang out in the Matrix channel. :)

One important goal of SHB is to be the smallest amount of code above what is available in nixpkgs. It should be the minimum necessary to make packages available there conform with the contracts. This way, there are less chance of breakage when nixpkgs gets updated. I intend to upstream to nixpkgs as much of those as makes sense.

License

I'm following the Nextcloud license which is AGPLv3. See this article from the FSF that explains what this license adds to the GPL one.