cleaned nix env and included pre-commit flake

This commit is contained in:
Sebastian Wendel 2022-11-22 23:26:57 +01:00
parent b51c572134
commit b3861e2812
No known key found for this signature in database
GPG key ID: 1422B7DF78144640
15 changed files with 343 additions and 307 deletions

5
.envrc
View file

@ -1 +1,6 @@
use flake
watch_file ./nix/checks.nix
watch_file ./nix/shell.nix
eval "$shellHook"

1
.gitattributes vendored
View file

@ -1 +0,0 @@
*.go text eol=lf

1
.gitignore vendored
View file

@ -5,3 +5,4 @@
.direnv
temp
charts
.pre-commit-config.yaml

View file

@ -1,12 +0,0 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-yaml
exclude: ^templates/
- id: mixed-line-ending
- id: trailing-whitespace
- id: fix-byte-order-marker
- id: end-of-file-fixer
- id: check-merge-conflict

View file

@ -1,187 +1,66 @@
# Contributing <!-- omit in toc -->
First of all, thank you for contributing to FabCityOS! The goal of this document is to provide everything you need to know in order to contribute to FabCityOS and its different integrations.
First of all, thank you for contributing to FCOS! The goal of this document is to provide everything you need to know in order to contribute to FCOS.
- [Assumptions](#assumptions)
- [How to Contribute](#how-to-contribute)
- [Development Workflow](#development-workflow)
- [Realease the chart](#realease-the-chart)
- [Install the helm push plugin](#install-the-helm-push-plugin)
- [Add the Gitlab repository](#add-the-gitlab-repository)
- [Build a package](#build-a-package)
- [Push the package to Gitlab](#push-the-package-to-gitlab)
- [Git Guidelines](#git-guidelines)
- [Release Process (for internal team only)](#release-process-for-internal-team-only)
- [🚩 Assumptions](#-assumptions)
- [🚧 How to Contribute](#-how-to-contribute)
- [🎮 Setup a development environment](#-setup-a-development-environment)
- [👩‍💻 Development Workflow](#-development-workflow)
- [🌐 Realease Workflow](#-realease-workflow)
## Assumptions
## 🚩 Assumptions
1. **You're familiar with [Gitlab](https://about.gitlab.com/learn/) and the [Merge Request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)(PR) workflow.**
2. **You've read the FabCityOS [documentation](https://www.interfacerproject.eu/) and the [README](/README.md).**
3. **You know about the FabCityOS [community](https://matrix.to/#/#fcos:fabcity.hamburg). Please use this for help.**
1. **You're familiar with [Kubernetes](https://kubernetes.io/docs/tutorials/kubernetes-basics/)**
2. **You're familiar with [Gitlab](https://about.gitlab.com/learn/) and the [Merge Request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)(PR) workflow.**
3. **You've read the FCOS [documentation](https://www.interfacerproject.eu/) and the [README](/README.md).**
4. **You know about the FCOS [community](https://matrix.to/#/#fcos:fabcity.hamburg). Please use this for help.**
## How to Contribute
## 🚧 How to Contribute
1. Make sure that the contribution you want to make is explained or detailed in a GitHub issue! Find an [existing issue](https://gitlab.fabcity.hamburg/software/fabcity-os-core-chart/-/issues) or [open a new one](https://gitlab.fabcity.hamburg/software/fabcity-os-core-chart/-/issues/new).
2. Once done, [fork the FabCityOS Core Chart repository](https://docs.gitlab.com/ee/user/project/repository/forking_workflow.html) in your Gitlab account. Ask a maintainer if you want your issue to be checked before making a PR.
1. Make sure that the contribution you want to make is explained or detailed in a Gitlab issue! Find an [existing issue](https://gitlab.fabcity.hamburg/software/fabcity-os-core-chart/-/issues) or [open a new one](https://gitlab.fabcity.hamburg/software/fabcity-os-core-chart/-/issues/new).
2. Once done, [fork the FCOS Core Chart repository](https://docs.gitlab.com/ee/user/project/repository/forking_workflow.html) in your Gitlab account. Ask a maintainer if you want your issue to be checked before making a PR.
3. [Create a new Git branch](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-new-branch).
4. Review the [Development Workflow](#development-workflow) section that describes the steps to maintain the repository.
5. Make the changes on your branch.
6. [Submit the branch as a PR](https://docs.gitlab.com/ee/user/project/merge_requests/index.html) pointing to the `main` branch of the main fabcity-os-core-chart repository. A maintainer should comment and/or review your Pull Request within a few days. Although depending on the circumstances, it may take longer.<br>
We do not enforce a naming convention for the PRs, but **please use something descriptive of your changes**, having in mind that the title of your PR will be automatically added to the next [release changelog](https://gitlab.fabcity.hamburg/software/fabcity-os-core-chart/releases/).
## Development Workflow
### Setup <!-- omit in toc -->
## 🎮 Setup a development environment
In order to use the different tools on this repository, you will first need to:
- [Install GNU Make](https://www.gnu.org/doc/doc.html) on your machine. This allows you to execute our predefined subset of commands with the `make` command.
- [Install Kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) on your machine. This will allow you to run commands against your Kubernetes cluster with the `kubectl` command.
- [Install Helm](https://helm.sh/docs/intro/install/). This will allow you to run the `helm` command, enabling the installation and manipulation of Helm charts.
- A Kubernetes cluster up and running. Any Kubernetes cluster can be used, on the cloud or locally installed on your machine. This can be easily achieved by [installing k3d](https://k3d.io/#installation), and creating a local cluster by running:
- [Install k3d](https://k3d.io/#installation). This will allow you to bootstrap creating a local Kubernetes cluster with the `k3d` command.
- [Optional: Use the Nix Package Manager](https://nix.dev/tutorials/install-nix). This will allow you to make use of the [nixpkgs](https://github.com/NixOS/nixpkgs), automatically managing all required dependencies from the [`nix shell env`](shell.nix). In addition you also need the [nixpkgs: direnv](https://search.nixos.org/packages?query=direnv) for automatic environment selection.
- [Optional: Use the Nix Package Manager](https://nix.dev/tutorials/install-nix). This will allow you to make use of the [nixpkgs](https://Gitlab.com/NixOS/nixpkgs), automatically managing all required dependencies from the [`nix develop`](shell.nix). In addition you also need the [nixpkgs: direnv](https://search.nixos.org/packages?query=direnv) for automatic environment selection.
```sh
k3d cluster create --config k3d-fcoscore-dev.yaml
```
## 👩‍💻 Development Workflow
Validate chart rendering
```sh
helm install --dry-run fcoscore .
```
You can install and test the Helm chart by running:
```sh
helm install fcoscore .
```
Watch all resources to be fully applied to the cluster:
```sh
watch -n 1 kubectl get all --all-namespaces
```
An easy way to access your FabCityOS instance and test that it is up and running is by using port-forwarding. This can be achieved by running:
```sh
kubectl port-forward --namespace default svc/fcoscore 7700:7700
```
Finally, to uninstall the chart, run:
```sh
helm uninstall fcoscore
```
Validate chart rendering
```sh
helm install --dry-run fcoscore .
```
1. 🔀 [Fork the Project](https://gitlab.fabcity.hamburg/software/fabcity-os-core-chart/-/forks/new)
2. Check out `make help`
3. Create your feature branch `git checkout -b feature/branch`
4. Start the development Cluster `make up`
5. Make your changes
6. Validate chart rendering `make dry-run`
7. 📋 Testing and Linting `make lint`
8. Install the chart `make install`
9. 🐛 Watch all resources to be fully applied `make watch-all`
10. Commit your changes `git commit -am 'Add some fooBar'`
11. Push to the branch `git push origin feature/branch`
12. 🙏 Thank you
> Please note that when deploying the helm chart during development, there may be a situation where the `zenflow` container crashes constantly. In this case, please rebuild the `k3d` development environment to delete any leftover `postgres` configuration.
### Tests and Linter <!-- omit in toc -->
## 🌐 Realease Workflow
Each PR should pass the linter to be accepted.
1. Install the helm plugins `make get-plugins`
2. Add the Gitlab repository `helm repo add --username <username> --password <access_token> fcoscore-alpha https://gitlab.fabcity.hamburg/api/v4/projects/248/packages/helm/alpha`
3. Build the package `make build`
4. Push the package to Gitlab `make push`
```sh
# Linter
helm lint .
```
Each PR should also check if the generated file `manifests/fcoscore.yaml` is updated with the new modifications.
You can generated the manifest with the command line:
```sh
helm template fcoscore . | grep -v 'helm.sh/chart:\|app.kubernetes.io/managed-by:' > manifests/FabCityOS.yaml
```
Or just by comment the PR:
```txt
@FabCityOS sync-manifest
```
Additionally, the CI will run a test to check if there are changes introduced to the charts. If changes were introduced, it will require you to update the Chart version.
### Realease the chart
#### Install the helm push plugin
```sh
helm plugin install https://github.com/chartmuseum/helm-push
```
#### Add the Gitlab repository
```sh
helm repo add --username <username> --password <access_token> fabcity-os-core-chart https://gitlab.fabcity.hamburg/api/v4/projects/248/packages/helm/alpha
```
#### Build a package
```sh
helm package .
```
#### Push the package to Gitlab
```sh
helm cm-push fcoscore-0.0.1.tgz fabcity-os-core-chart
```
## Git Guidelines
### Git Branches <!-- omit in toc -->
All changes must be made in a branch and submitted as PR.
We do not enforce any branch naming style, but please use something descriptive of your changes.
### Git Commits <!-- omit in toc -->
As minimal requirements, your commit message should:
- be capitalized
- not finish by a dot or any other punctuation character (!,?)
- start with a verb so that we can read your commit message this way: "This commit will ...", where "..." is the commit message.
e.g.: "Fix the home page button" or "Add more tests for create_index method"
We don't follow any other convention, but if you want to use one, we recommend [this one](https://chris.beams.io/posts/git-commit/).
### Pull Requests <!-- omit in toc -->
Some notes on PRs:
<!-- TODO: fix links -->
- [Convert your PR as a draft]() if your changes are a work in progress: no one will review it until you pass your PR as ready for review.<br>
The draft PR can be very useful if you want to show that you are working on something and make your work visible.
- The branch related to the PR must be **up-to-date with `main`** before merging. Fortunately, this project [integrates a bot]() to automatically enforce this requirement without the PR author having to do it manually.
- All PRs must be reviewed and approved by at least one maintainer.
- The PR title should be accurate and descriptive of the changes. The title of the PR will be indeed automatically added to the next [release changelogs]().
## Release Process (for internal team only)
FabCityOS tools follow the [Semantic Versioning Convention](https://semver.org/).
### Automation to Rebase and Merge the PRs <!-- omit in toc -->
This project integrates a bot that helps us manage pull requests merging.<br>
_[Read more about this]()._
### How to Publish the Release <!-- omit in toc -->
⚠️ Before doing anything, make sure you got through the guide about [Releasing an Integration]().
⚠️ Every PR that is merged to `main` introducing changes to the Helm Chart needs to modify the file [`charts/fcoscore/Chart.yaml`](charts/fcoscore/Chart.yaml), by increasing the version of the chart accordingly.
Every PR that is merged to `main` triggers the automated release process, as specified at [``](). A GitHub Action will be triggered and publish a new release on the GitHub repository [releases](). This will enable users to start using the new version of the chart immediately after publishing.
<hr>
Thank you again for reading this through, we can not wait to begin to work with you if you made your way through this contributing guide ❤️
Thank you again for reading this through, we can not wait to begin to work with you if you made your way through this contributing guide 😍.

View file

@ -1,7 +1,7 @@
---
name: fcoscore
description: Fab City OS Core Kubernetes Helm Chart
version: 0.0.1
version: 0.1.0
type: application
appVersion: latest
home: https://gitlab.fabcity.hamburg/software/fabcity-os-core-chart

View file

@ -29,25 +29,6 @@ info: ## Show k3d cluster info
@k3d cluster list
@kubectl cluster-info
##@ Helm
update: ## Update helm dependencies
@helm dependency update
build: ## Build helm dependencies
@helm dependency build
dry-run: ## Run helm dry run
@helm install --dry-run fcoscore .
install: ## Run helm install
@helm install fcoscore .
uninstall: ## Run helm uninstall
@helm uninstall fcoscore || true
reinstall: uninstall install ## Run helm reinstall
clean: down up ## Clean the local Kubernetes development cluster.
##@ Lint
@ -68,9 +49,6 @@ lint-helm: ## Lint Helm files.
##@ Show
get: ## Get specific Kubernetes resources from all namespaces.
@kubectl get --all-namespaces $(filter-out $@, $(MAKECMDGOALS))
get-pods: ## Get Kubernetes pods from all namespaces.
@kubectl get --all-namespaces pods
@ -100,10 +78,36 @@ watch-all: ## Watch the state of all Kubernetes resources.
events: ## Show all Kubernetes cluster events.
@kubectl get events --watch --all-namespaces
##@ Tools
##@ Helm
nav: ## Start K9s to view and manage your Kubernetes clusters.
@k9s --all-namespaces --headless
get-plugins: ## Get the required helm plugins.
@helm plugin install https://github.com/chartmuseum/helm-push
add-repo: ## Add the Gitlab helm repository.
@helm repo add fcoscore-alpha https://gitlab.fabcity.hamburg/api/v4/projects/248/packages/helm/alpha
update: ## Update helm dependencies.
@helm dependency update
build: ## Build helm dependencies.
@helm dependency build
dry-run: ## Run helm dry run.
@helm install --dry-run fcoscore .
install: ## Run helm install.
@helm install fcoscore .
uninstall: ## Run helm uninstall.
@helm uninstall fcoscore || true
reinstall: uninstall install ## Run helm reinstall.
package: ## Package the helm chart.
@helm package . --destination charts
push: ## Publish the helm chart.
@helm cm-push charts/fcoscore-*.tgz fabcity-os-core-chart
%:
@true

View file

@ -1,33 +1,35 @@
<p align="center">
<img src="https://www.fabcity.hamburg/wp-content/uploads/2021/04/cropped-Fab_City_Hamburg@4x-192x192.png" alt="FabCity Hamburg" width="192" height="192" />
<img src="https://raw.githubusercontent.com/dyne/interfacer-docs/main/docs/_media/general/interfacer-logo.png" alt="Interfacer" />
</p>
<h1 align="center">FabCityOS Core Kubernetes Helm Chart</h1>
<h1 align="center">FCOS Core Helm Chart</h1>
<h4 align="center">
<a href="https://github.com/FabCityOS Core/FabCityOS Core">Helm Chart</a> |
<a href="https://reflowos.dyne.org/docs/what_is_reflowOS">Documentation</a> |
<a href="https://matrix.to/#/#fcos:fabcity.hamburg">Element</a> |
<a href="https://www.interfacerproject.eu/">Website</a> |
<a href="https://www.interfacerproject.eu/#news">Blog</a> |
<a href="https://www.interfacerproject.eu/#news">Blog</a>
</h4>
<p align="center">
<a href="https://gitlab.fabcity.hamburg/software/fabcity-os-core-chart/LICENSE"><img src="https://img.shields.io/badge/license-AGPL-informational" alt="License"></a>
<a href="https://matrix.to/#/#fcos:fabcity.hamburg"><img src="https://img.shields.io/badge/Matrix-FCOS-blue.svg?logo=element" alt="Element"></a>
<a href="https://matrix.to/#/#fcos:fabcity.hamburg"><img src="https://img.shields.io/badge/Matrix-FCOS-blue.svg?logo=element" alt="Matrix"></a>
</p>
<p align="center">The FabCityOS Core Helm Chart for Kubernetes ⚓️</p>
<p align="center">The FCOS Core Helm Chart for Kubernetes ⚓️</p>
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 <!-- omit in toc -->
- [📖 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 <!-- omit in toc -->
### 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 <!-- omit in toc -->
#### Install helm <!-- omit in toc -->
### 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 <!-- omit in toc -->
### Install FCOS Core
```bash
#### From the source files
```sh
helm install fcoscore .
```
#### Uninstalling the Chart <!-- omit in toc -->
#### 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 <!-- omit in toc -->
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

View file

@ -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

View file

@ -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"
}
}
},

View file

@ -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;
};
});
}

39
nix/checks.nix Normal file
View file

@ -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"
];
};
}

36
nix/shell.nix Normal file
View file

@ -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}
'';
}

View file

@ -1,32 +0,0 @@
{pkgs ? import <nixpkgs> {}}:
with pkgs;
mkShell {
name = "fcoscore-chart";
nativeBuildInputs = with pkgs; [
chart-testing
editorconfig-checker
git
gnumake
k9s
kube3d
kubectl
kubectx
kubernetes-helm
mdl
nixpkgs-fmt
pre-commit
rnix-lsp
vscodium-fhs
yaml-language-server
yamllint
oras
];
postInstall = ''
. <(helm completion $(basename $SHELL))
. <(k3d completion $(basename $SHELL))
. <(k9s completion $(basename $SHELL))
. <(kubectl completion $(basename $SHELL))
. <(ct completion $(basename $SHELL))
'';
}

View file

@ -1,10 +1,10 @@
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
____ __ ____ ____ _____
/ _/___ / /____ _____/ __/___ _________ _____/ __ \/ ___/
/ // __ \/ __/ _ \/ ___/ /_/ __ `/ ___/ _ \/ ___/ / / /\__ \
_/ // / / / /_/ __/ / / __/ /_/ / /__/ __/ / / /_/ /___/ /
/___/_/ /_/\__/\___/_/ /_/ \__,_/\___/\___/_/ \____//____/
________________ _____ __________ ____ ______
/ ____/ ____/ __ \/ ___/ / ____/ __ \/ __ \/ ____/
/ /_ / / / / / /\__ \______/ / / / / / /_/ / __/
/ __/ / /___/ /_/ /___/ /_____/ /___/ /_/ / _, _/ /___
/_/ \____/\____//____/ \____/\____/_/ |_/_____/
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@ -18,10 +18,12 @@ Get the application URL by running these commands:
{{- end }}
{{- else if contains "NodePort" .Values.frontend.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "fcoscore.fullname" . }})
export FRONTEND_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "fcoscore.fullname" . }})
export BACKEND_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "fcoscore.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
echo http://$NODE_IP:$FRONTEND_PORT
echo http://$NODE_IP:$BACKEND_PORT
{{- else if contains "LoadBalancer" .Values.frontend.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
@ -67,6 +69,5 @@ Get a database connection by running these commands:
Monitor all artifacts by running these commands:
watch -n 1 kubectl get all --all-namespaces
k9s --all-namespaces
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>