Skip to content

Commit

Permalink
Updated kubernetes service definition, re-organize documentations (#116)
Browse files Browse the repository at this point in the history
Two different service has been created for Kubernetes. One is for api and another one is for prometheus metrics. Also now we can add annotations for k8s service definition.
Re-organize documentation
Added documentation for installation using helm-chart that fixes Add helm chart installation in Getting Started guide in website #115
  • Loading branch information
shahariaazam authored Jan 1, 2024
1 parent 5eaa6cf commit 58df0d6
Show file tree
Hide file tree
Showing 15 changed files with 182 additions and 77 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
<a href="https://sonarcloud.io/summary/new_code?id=shaharia-lab_terediX"><img src="https://sonarcloud.io/api/project_badges/measure?project=shaharia-lab_terediX&metric=duplicated_lines_density" height="20"/></a>
<a href="https://sonarcloud.io/summary/new_code?id=shaharia-lab_terediX"><img src="https://sonarcloud.io/api/project_badges/measure?project=shaharia-lab_terediX&metric=bugs" height="20"/></a>
<a href="https://sonarcloud.io/summary/new_code?id=shaharia-lab_terediX"><img src="https://sonarcloud.io/api/project_badges/measure?project=shaharia-lab_terediX&metric=sqale_index" height="20"/></a>
<a href="https://app.argos-ci.com/shahariaazam/terediX/reference"><img src="https://argos-ci.com/badge.svg" height="20"/></a>
</p><br/><br/>

<p align="center">
<a href="https://github.com/shaharia-lab/teredix"><img src="https://user-images.githubusercontent.com/1095008/229536376-51ddaa75-85ee-4e3e-95df-7cf6093392bf.png" width="100%"/></a>
</p><br/>

Welcome to the official repository of TerediX. TerediX is a tech resource graph discovery and exploration tool.
Welcome to the official repository of TerediX. TerediX is a tech resource graph discovery and exploration tool.
It helps you to discover your tech resources, monitor your resources in one place.

Documentations are available on [https://teredix.shaharia.com](https://teredix.shaharia.com).
Expand Down
3 changes: 1 addition & 2 deletions helm-chart/teredix/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ description: A Helm chart for Kubernetes to install terediX
maintainers:
- name: shaharia-lab
type: application
version: 0.0.1
appVersion: "1.0.0"
version: 0.0.2
2 changes: 1 addition & 1 deletion helm-chart/teredix/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
mountPath: /config
ports:
- name: http
containerPort: {{ .Values.service.port }}
containerPort: {{ .Values.apiService.port }}
protocol: TCP
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
Expand Down
4 changes: 2 additions & 2 deletions helm-chart/teredix/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "teredix.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- $svcPort := .Values.apiService.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
Expand Down Expand Up @@ -53,7 +53,7 @@ spec:
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
serviceName: {{ $fullName }}-api
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
Expand Down
15 changes: 0 additions & 15 deletions helm-chart/teredix/templates/service.yaml

This file was deleted.

45 changes: 45 additions & 0 deletions helm-chart/teredix/templates/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{- if .Values.apiService.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "teredix.fullname" . }}-api
{{- if .Values.apiService.annotations }}
annotations:
{{- toYaml .Values.apiService.annotations | nindent 4 }}
{{- end }}
labels:
{{- include "teredix.labels" . | nindent 4 }}
spec:
type: {{ .Values.apiService.type }}
ports:
- port: {{ .Values.apiService.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "teredix.selectorLabels" . | nindent 4 }}
---
{{- end }}

{{- if .Values.prometheusMetricsService.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "teredix.fullname" . }}-metrics
{{- if .Values.prometheusMetricsService.annotations }}
annotations:
{{- toYaml .Values.prometheusMetricsService.annotations | nindent 4 }}
{{- end }}
labels:
{{- include "teredix.labels" . | nindent 4 }}
spec:
type: {{ .Values.prometheusMetricsService.type }}
ports:
- port: {{ .Values.prometheusMetricsService.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "teredix.selectorLabels" . | nindent 4 }}
---
{{- end }}
15 changes: 14 additions & 1 deletion helm-chart/teredix/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,22 @@ securityContext: {}
# runAsNonRoot: true
# runAsUser: 1000

service:
apiService:
enabled: true
type: ClusterIP
port: 8080
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"

prometheusMetricsService:
enabled: true
type: ClusterIP
port: 2112
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "2112"
prometheus.io/path: "/metrics"

ingress:
enabled: true
Expand Down
2 changes: 1 addition & 1 deletion website/docs/contribution/_category_.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"label": "Contribution",
"position": 4,
"position": 5,
"link": {
"type": "generated-index"
}
Expand Down
65 changes: 12 additions & 53 deletions website/docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,23 @@ sidebar_position: 3
title: "Getting Started"
---

# Getting Started
## Getting Started

## Installation
### Installation

There are several ways to install **terediX**. You can install **terediX** with standalone binary, `go install` command or with Docker.
There are several ways to install **terediX**. You can install **terediX** with any of the following methods:

### Standalone Binary
- [Standalone Binary](/docs/installation/standalone_binary)
- [Using Go Install](/docs/installation/standalone_binary)
- [Docker](/docs/installation/docker)

If you want to install **terediX** with binary, then you can download the binary from [release page](https://github.
com/shaharia-lab/teredix/releases). May be you need to make the binary executable by running the following command:
Also, you can deploy `terediX` in Kubernetes using Helm Chart. Read more about [deploying teredix in Kubernetes](/docs/installation/kubernetes).

```bash
chmod +x terediX
```
### Create Configuration File

### Go Install
To run **terediX** you need to create a configuration file. Create a configuration file based on [the documentation](/docs/configuration/general).

If you want to install **terediX** with `go install` command, then you can run the following command:
### Run

```bash
go install github.com/shaharia-lab/teredix/cmd/terediX@latest
```

### Docker

If you want to install **terediX** with Docker, then you can run the following command to pull the docker image:

```bash
docker pull shaharialab/teredix:latest
```

Or, if you want to run the docker image, then you can run the following command:

```bash
docker run -it --rm shaharialab/teredix:latest --help
```

After installing the binary in your target machine, you can run the following command to see the help message:

```bash
teredix --help
```

## Create Configuration File

**terediX** uses a configuration file to run. You can create a configuration file with the following command:

```bash
teredix init
```

It will create a skeleton configuration file `config.yaml` in your current directory. You can edit the configuration
file as per your need.

## Start Resource Scanner

After creating the configuration file, you can run the following command to run **terediX**:

```bash
teredix discover --config config.yaml
```
After creating the configuration file, you can run the following command to start **terediX**.
To learn how to run, go to specific installation page from above.
7 changes: 7 additions & 0 deletions website/docs/installation/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"label": "Installation",
"position": 4,
"link": {
"type": "generated-index"
}
}
20 changes: 20 additions & 0 deletions website/docs/installation/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: "Run terediX using Docker"
sidebar_label: Docker
---

## Docker

If you want to install **terediX** with Docker, then you can run the following command to pull the docker image:

```bash
docker pull ghcr.io/shaharia-lab/teredix:0.0.2
```

Or, if you want to run the docker image, then you can run the following command:

```bash
docker run -it --rm ghcr.io/shaharia-lab/teredix:0.0.2 --help
```

You can find all the available docker images from [GitHub Container Registry](https://github.com/shaharia-lab/terediX/pkgs/container/teredix)
12 changes: 12 additions & 0 deletions website/docs/installation/go_install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: "Install terediX with Go Install"
sidebar_label: Go Install
---

## Go Install

If you want to install **terediX** with `go install` command, then you can run the following command:

```bash
go install github.com/shaharia-lab/teredix/cmd/terediX@latest
```
45 changes: 45 additions & 0 deletions website/docs/installation/kubernetes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: "Deploy terediX in Kubernetes"
sidebar_label: Kubernetes
---

## Deploy in Kubernetes using Helm Chart

It's very simple to install `terediX` in Kubernetes. You can install using Helm chart. Here are the simplest steps to follow.

### Add Helm Repository

```bash
helm repo add teredix https://teredix.shaharialab.com
helm repo update
```

### Add Configuration

Create a separate helm values file and override necessary configuration. Specially you need to provide the configuration for `terediX`.

Create a `values-prod.yaml` file and put the following content. You can override any configuration as you need. Read more about [terediX configuration](/docs/configuration/general).

```bash
appConfig:
# organization:
# name: Your Organization
# logo: https://your-org-url.com/logo.png
# discovery:
# name: Name of the discovery
# description: Some description about the discovery
# worker_pool_size: 1
# storage:
.........
```

### Install
After that, just install terediX using the following command.

```bash
helm install teredix teredix/teredix --namespace teredix -f values-prod.yaml
```

For more useful Helm commands, please follow the [official documentation of Helm](https://helm.sh/docs/helm/).

For details about `terediX` helm chart, go to [terediX Helm Chart in ArtifactHub](https://artifacthub.io/packages/helm/teredix/teredix)
19 changes: 19 additions & 0 deletions website/docs/installation/standalone_binary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Use terediX as standalone binary"
sidebar_label: Standalone Binary
---

## Standalone Binary

If you want to install **terediX** with binary, then you can download the binary from [release page](https://github.com/shaharia-lab/teredix/releases).
May be you need to make the binary executable by running the following command:

```bash
chmod +x terediX
```

Run the following command to start **terediX**:

```bash
teredix --help
```
2 changes: 1 addition & 1 deletion website/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function HomepageHeader() {
</Link> &nbsp; &nbsp;
<Link
className="button button--secondary button--lg"
to="/docs/intro">
to="/docs/getting_started">
Getting Started 🚀
</Link>
</div>
Expand Down

0 comments on commit 58df0d6

Please sign in to comment.