feat(docs): migrate documentation site into monorepo (#5912)
This commit is contained in:
1 parent
3e464a76f2
commit
9e421c67bd
605 files changed
+26764
-219
No files matched your search
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"label": "Developer guides",
|
||||
"position": 6,
|
||||
"collapsed": true,
|
||||
"link": {
|
||||
"type": "generated-index"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
---
|
||||
title: Getting started
|
||||
tags:
|
||||
- Developer
|
||||
- Technical documentation
|
||||
- Code
|
||||
- Programming
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
## Setting up your development environment
|
||||
|
||||
This guide will help you set up your development environment to start contributing to homarr.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- **Node.js (lts)**: You can download it from the [official website](https://nodejs.org/).
|
||||
- **pnpm (latest)**: You can install it by running `npm install -g pnpm`.
|
||||
- **Git**: You can download it from the [official website](https://git-scm.com/).
|
||||
- **Docker or Docker Desktop**: You can download it from the [official website](https://www.docker.com/).
|
||||
- **A GitHub account**: You can create one on the [official website](https://github.com/).
|
||||
|
||||
### Setting up the project
|
||||
|
||||
1. Fork the repository by clicking on the "Fork" button on the top right corner of the repository page.
|
||||
|
||||

|
||||
|
||||
2. Clone the repository to your local machine with `git clone`. You can find the url to use by clicking on the "Code" button on the top right corner of your forks repository page.
|
||||
|
||||

|
||||
|
||||
3. Change directory to the project folder with `cd homarr`.
|
||||
|
||||
4. Install the dependencies with `pnpm install`.
|
||||
|
||||
5. Start redis by running `pnpm run docker:dev`. This will run a docker-compose file with a redis service.
|
||||
|
||||
6. Copy the `.env.example` file to `.env` and replace `DB_URL` with the full path you want to use for the sqlite database file. For example `DB_URL='C:\\Dev\\homarr\\packages\\db\\db.sqlite'`
|
||||
|
||||
7. Run the migrations to create the sqlite db file with `pnpm run db:migration:sqlite:run`.
|
||||
|
||||
8. Start the development server with `pnpm dev` and wait for a message that says `✓ Ready in 10.7s`
|
||||
|
||||
9. Open your browser and navigate to [http://localhost:3000](http://localhost:3000). (Loading the page might take up to 2 minutes the first time)
|
||||
|
||||
### Useful npm scripts
|
||||
|
||||
#### During development
|
||||
|
||||
- `pnpm dev`: Start the development server.
|
||||
- `pnpm cli`: Run cli commands.
|
||||
- `pnpm db:migration:sqlite:run`: Run the migrations to create or update the sqlite db file.
|
||||
- `pnpm db:migration:sqlite:generate`: Generate a new migration file for the sqlite db. Also works with `mysql`.
|
||||
- `pnpm db:studio`: Open a visual studio for the database.
|
||||
- `pnpm package:new`: Create a new package in the monorepo.
|
||||
|
||||
#### Checking code quality
|
||||
|
||||
- `pnpm lint`: Run the linter to check for code quality issues.
|
||||
- `pnpm format:fix`: Run the formatter to fix code style issues.
|
||||
- `pnpm test`: Run the tests. You can also use `pnpm test:ui` to get a UI for the tests.
|
||||
- `pnpm typecheck`: Run the typescript type checker.
|
||||
|
||||
#### Building the project
|
||||
- `pnpm build`: Build the project for production.
|
||||
- `docker build -t homarr .`: Build a docker image for the project.
|
||||
- `docker run -p 7575:7575 -e SECRET_ENCRYPTION_KEY='your_64_character_hex_string' homarr:latest`: Run the created docker image.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,135 @@
|
||||
---
|
||||
title: Kubernetes
|
||||
tags:
|
||||
- Developer
|
||||
- Technical documentation
|
||||
- Code
|
||||
- Programming
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
This guide provides step-by-step instructions for setting up a Kubernetes cluster using kind, configuring multiple nodes, and installing the Metrics Server.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Ensure you have the following installed:
|
||||
|
||||
- [Docker](https://docs.docker.com/get-started/get-docker/) (required for running `kind` clusters).
|
||||
- [Kind](https://kind.sigs.k8s.io/docs/user/quick-start/) (Kubernetes in Docker).
|
||||
- [Kubectl](https://kubernetes.io/docs/tasks/tools/) (Kubernetes command-line tool).
|
||||
|
||||
Additionally, ensure that Kubernetes tools are enabled in your environment by setting the following variable in your `.env` file:
|
||||
|
||||
```bash
|
||||
# Enable Kubernetes tool
|
||||
ENABLE_KUBERNETES=true
|
||||
```
|
||||
|
||||
### 1. Creating a Kubernetes Cluster with Multiple Nodes
|
||||
|
||||
We will create a Kubernetes cluster using `kind` with one control plane node and two worker nodes.
|
||||
|
||||
#### Define the Cluster Configuration
|
||||
|
||||
Create a configuration file named `kind-config.yaml` with the following content:
|
||||
|
||||
```bash
|
||||
cat > kind-config.yaml <<EOF
|
||||
# three node (two workers) cluster config
|
||||
kind: Cluster
|
||||
apiVersion: kind.x-k8s.io/v1alpha4
|
||||
nodes:
|
||||
- role: control-plane
|
||||
kubeadmConfigPatches:
|
||||
- |
|
||||
kind: KubeletConfiguration
|
||||
apiVersion: kubelet.config.k8s.io/v1beta1
|
||||
kubeReserved:
|
||||
cpu: "250m"
|
||||
memory: "256Mi"
|
||||
systemReserved:
|
||||
cpu: "500m"
|
||||
memory: "512Mi"
|
||||
evictionHard:
|
||||
memory.available: "200Mi"
|
||||
- role: worker
|
||||
- role: worker
|
||||
EOF
|
||||
```
|
||||
|
||||
#### Create the Cluster
|
||||
|
||||
Run the following command to create the Kubernetes cluster:
|
||||
|
||||
```bash
|
||||
kind create cluster --name k8s-playground --config kind-config.yaml
|
||||
```
|
||||
|
||||
This will provision a cluster named `k8s-playground` with the specified node configuration.
|
||||
|
||||
### 2. Installing the Metrics Server
|
||||
|
||||
The Metrics Server is required for gathering resource utilization metrics like CPU and memory usage. It is essential for features such as Horizontal Pod Autoscaling.
|
||||
|
||||
#### Deploy the Metrics Server
|
||||
|
||||
Run the following command to install the Metrics Server:
|
||||
|
||||
```bash
|
||||
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.7.2/components.yaml
|
||||
```
|
||||
|
||||
#### Disable TLS Verification (For Local Development)
|
||||
|
||||
In local environments, Kubernetes nodes might not have valid certificates. To disable TLS verification, patch the deployment:
|
||||
|
||||
```bash
|
||||
kubectl patch -n kube-system deployment metrics-server --type=json \
|
||||
-p '[{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--kubelet-insecure-tls"}]'
|
||||
```
|
||||
|
||||
This allows the Metrics Server to communicate with kubelets that use self-signed certificates.
|
||||
|
||||
### 3. Verifying the Setup
|
||||
|
||||
After completing the setup, verify that the cluster is running correctly:
|
||||
|
||||
#### Check the Cluster Nodes
|
||||
|
||||
```bash
|
||||
kubectl get nodes
|
||||
```
|
||||
|
||||
Expected output:
|
||||
|
||||
```bash
|
||||
NAME STATUS ROLES AGE VERSION
|
||||
k8s-playground-control-plane Ready control-plane Xs vX.Y.Z
|
||||
k8s-playground-worker Ready worker Xs vX.Y.Z
|
||||
k8s-playground-worker2 Ready worker Xs vX.Y.Z
|
||||
```
|
||||
|
||||
#### Check Metrics Server Status
|
||||
|
||||
```bash
|
||||
kubectl get deployment -n kube-system metrics-server
|
||||
```
|
||||
|
||||
Expected output:
|
||||
|
||||
```bash
|
||||
NAME READY UP-TO-DATE AVAILABLE AGE
|
||||
metrics-server 1/1 1 1 Xs
|
||||
```
|
||||
|
||||
#### Get Node Resource Metrics
|
||||
|
||||
```bash
|
||||
kubectl top nodes
|
||||
```
|
||||
|
||||
This command should return CPU and memory usage statistics for each node.
|
||||
|
||||
## Conclusion
|
||||
|
||||
You have successfully set up a multi-node Kubernetes cluster using kind and installed the Metrics Server for monitoring resource usage. This setup is useful for local development and testing Kubernetes workloads before deploying them to a production environment.
|
||||
Reference in new issue
Block a user