- +
-The FabCityOS Core Helm Chart for Kubernetes ⚓️
+The FCOS Core Helm Chart for Kubernetes ⚓️
-This Helm chart is designed to be a lightweight way to configure FabCityOS Core official Docker images. +This Helm chart is designed to be a lightweight way to configure FCOS Core official Docker images. -**FabCityOS Core** is an operating system for communities who want to create federated and secure economic networks to foster the creation and coordination of distributed value chains. +**FCOS Core** is an operating system for communities who want to create federated and secure economic networks to foster the creation and coordination of distributed value chains. ## Table of Contents - [📖 Documentation](#-documentation) - [🚀 Getting Started](#-getting-started) -- [🤖 Compatibility with FabCityOS Core](#-compatibility-with-fabcityos-core) + - [Install kubectl](#install-kubectl) + - [Install helm](#install-helm) + - [Install FCOS Core](#install-fcos-core) + - [From the source files](#from-the-source-files) + - [From the repository](#from-the-repository) - [⚙️ Development Workflow and Contributing](#️-development-workflow-and-contributing) ## 📖 Documentation @@ -36,42 +38,41 @@ See our [Documentation](https://reflowos.dyne.org/docs/what_is_reflowOS). ## 🚀 Getting Started -Kubernetes (K8s), is an open-source system for automating deployment, scaling, and management of containerized applications. You can run a FabCityOS Core instance inside your Kubernetes cluster, either if you want to expose it to the outside world or just let some other applications use it inside your cluster and take advantage of the instant and powerful search engine. +Kubernetes (K8s), is an open-source system for automating deployment, scaling, and management of containerized applications. You can run a FCOS Core instance inside your Kubernetes cluster, either if you want to expose it to the outside world or just let some other applications use it inside your cluster and take advantage of the instant and powerful search engine. First of all, you will need a Kubernetes cluster up and running. If you are not familiar with how Kuberentes works or need some help with this step, please check the [Kubernetes documentation](https://kubernetes.io/docs/home/). -### Install kubectl +### Install kubectl `kubectl` is the most commonly used CLI to manage a Kubernetes cluster. The installation instructions are [available here](https://kubernetes.io/docs/tasks/tools/install-kubectl/). -### Deploy FabCityOS Core using Helm - -#### Install helm +### Install helm Helm CLI is a Command Line Interface which will automate chart management and installation on your Kubernetes cluster. To install Helm, follow the [Helm installation instructions](https://helm.sh/docs/intro/install/). -#### Install and run FabCityOS Core +### Install FCOS Core -```bash +#### From the source files + +```sh helm install fcoscore . ``` -#### Uninstalling the Chart +#### From the repository -To uninstall/delete the FabCityOS Core deployment: - -```bash -helm uninstall fcoscore +```sh +helm repo add fcoscore-alpha https://gitlab.fabcity.hamburg/api/v4/projects/248/packages/helm/alpha +helm repo update fcoscore-alpha +helm install fcoscore fcoscore-alpha/fcoscore ``` -## 🤖 Compatibility with FabCityOS Core +### Uninstalling the Chart -We recommend that the Helm chart version is aligned to the version of the product you want to deploy. This will ensure that you are using a chart version that has been tested against the corresponding production version. -This will also ensure that the documentation and examples for the chart will work with the version of the product, you are installing. +To uninstall/delete the FCOS Core deployment: -For example, if you want to deploy an fcoscore `0.1.0` cluster, use the corresponding `0.1.0` [tag][fcoscore-010]. - -The `master` version of these charts is intended to support the latest pre-release versions of our products, and therefore may or may not work with current released versions. +```sh +helm uninstall fcoscore +``` ## ⚙️ Development Workflow and Contributing diff --git a/default.nix b/default.nix index 2cccff2..c7d0c26 100644 --- a/default.nix +++ b/default.nix @@ -1,10 +1,14 @@ -(import +( + import ( - let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; - sha256 = lock.nodes.flake-compat.locked.narHash; - } + let + lock = builtins.fromJSON (builtins.readFile ./flake.lock); + in + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; + } ) - { src = ./.; } -).defaultNix + {src = ./.;} +) +.defaultNix diff --git a/flake.lock b/flake.lock index 64e1c48..6829ac7 100644 --- a/flake.lock +++ b/flake.lock @@ -16,42 +16,148 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1668681692, + "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1652739558, - "narHash": "sha256-znGkjGugajqF/sFS+H4+ENmGTaVPFE0uu1JjQZJLEaQ=", + "lastModified": 1668994630, + "narHash": "sha256-1lqx6HLyw6fMNX/hXrrETG1vMvZRGm2XVC9O/Jt0T6c=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ff691ed9ba21528c1b4e034f36a04027e4522c58", + "rev": "af50806f7c6ab40df3e6b239099e8f8385f6c78b", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1668984258, + "narHash": "sha256-0gDMJ2T3qf58xgcSbYoXiRGUkPWmKyr5C3vcathWhKs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "cf63ade6f74bbc9d2a017290f1b2e33e8fbfa70a", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable-small", + "ref": "nixos-22.05", "repo": "nixpkgs", "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1668994630, + "narHash": "sha256-1lqx6HLyw6fMNX/hXrrETG1vMvZRGm2XVC9O/Jt0T6c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "af50806f7c6ab40df3e6b239099e8f8385f6c78b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_2", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs_2", + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1669152228, + "narHash": "sha256-FEDReoTLWJHXcNso7aaAlAUU7uOqIR6Hc/C/nqlfooE=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "078b0dee35e2da01334af682ec347463b70a9986", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "flake-compat": "flake-compat", + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", - "utils": "utils" - } - }, - "utils": { - "locked": { - "lastModified": 1652776076, - "narHash": "sha256-gzTw/v1vj4dOVbpBSJX4J0DwUR6LIyXo7/SuuTJp1kM=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "04c1b180862888302ddfb2e3ad9eaa63afc60cf8", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" + "pre-commit-hooks": "pre-commit-hooks" } } }, diff --git a/flake.nix b/flake.nix index 254d2b2..e8fcdd6 100644 --- a/flake.nix +++ b/flake.nix @@ -1,21 +1,26 @@ { - description = "fcoscore k8s runtime flake"; - + description = "fcoscore runtime flake"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small"; - utils.url = "github:numtide/flake-utils"; - + nixpkgs.url = "nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; flake-compat = { url = "github:edolstra/flake-compat"; flake = false; }; + pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; }; - - outputs = { self, nixpkgs, utils, ... }@inputs: - utils.lib.eachDefaultSystem (system: - let pkgs = nixpkgs.legacyPackages.${system}; in - { - devShell = import ./shell.nix { inherit pkgs; }; - } - ); + outputs = { + nixpkgs, + flake-utils, + ... + } @ inputs: + flake-utils.lib.eachSystem ["x86_64-linux" "aarch64-linux"] (localSystem: { + devShells.default = import ./nix/shell.nix inputs localSystem; + checks = import ./nix/checks.nix inputs localSystem; + pkgs = import nixpkgs { + inherit localSystem; + config.allowUnfree = true; + config.allowAliases = true; + }; + }); } diff --git a/nix/checks.nix b/nix/checks.nix new file mode 100644 index 0000000..7c7c9cb --- /dev/null +++ b/nix/checks.nix @@ -0,0 +1,39 @@ +{ + self, + pre-commit-hooks, + ... +}: system: +with self.pkgs.${system}; { + pre-commit-check = + pre-commit-hooks.lib.${system}.run + { + src = lib.cleanSource ../.; + hooks = { + alejandra.enable = true; + nix-linter.enable = true; + statix .enable = true; + }; + settings.nix-linter.checks = [ + "DIYInherit" + "EmptyInherit" + "EmptyLet" + "EtaReduce" + "LetInInheritRecset" + "ListLiteralConcat" + "NegateAtom" + "SequentialLet" + "SetLiteralUpdate" + "UnfortunateArgName" + "UnneededRec" + "UnusedArg" + "UnusedLetBind" + "UpdateEmptySet" + "BetaReduction" + "EmptyVariadicParamSet" + "UnneededAntiquote" + "no-FreeLetInFunc" + "no-AlphabeticalArgs" + "no-AlphabeticalBindings" + ]; + }; +} diff --git a/nix/shell.nix b/nix/shell.nix new file mode 100644 index 0000000..20dcdf4 --- /dev/null +++ b/nix/shell.nix @@ -0,0 +1,36 @@ +{self, ...}: system: +with self.pkgs.${system}; + mkShell { + name = "fcoscore-chart"; + nativeBuildInputs = + [ + chart-testing + editorconfig-checker + git + gnumake + kube3d + kubectl + kubectx + kubernetes-helm + mdl + alejandra + pre-commit + rnix-lsp + yaml-language-server + yamllint + ] + ++ lib.optionals (pkgs.hostPlatform.system == "x86_64-linux") [ + vscodium-fhs + ]; + + postInstall = '' + . <(helm completion $(basename $SHELL)) + . <(k3d completion $(basename $SHELL)) + . <(kubectl completion $(basename $SHELL)) + . <(ct completion $(basename $SHELL)) + ''; + + shellHook = '' + ${self.checks.${system}.pre-commit-check.shellHook} + ''; + } diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 1917fd5..0000000 --- a/shell.nix +++ /dev/null @@ -1,32 +0,0 @@ -{pkgs ? import