-
Notifications
You must be signed in to change notification settings - Fork 19
Install guide #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
BrendanGalloway
wants to merge
5
commits into
main
Choose a base branch
from
install-guide
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+141
−45
Draft
Install guide #141
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5ce5a05
docs: move developer setup to contributing.md file
BrendanGalloway 6333fcf
docs: add install guide and align values file keys
BrendanGalloway 3356372
docs: fix review comments
BrendanGalloway 314061d
fix: postgres secret creation logic
BrendanGalloway f6cb32f
docs: fix typos and formatting
BrendanGalloway File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,59 +2,107 @@ | |||||
|
|
||||||
| **config-db** is developer first, JSON based configuration management database (CMDB). | ||||||
|
|
||||||
| ## Setup | ||||||
| ## Principles | ||||||
|
|
||||||
| ### Setup local db link as environment variable. | ||||||
| * **JSON Based** - Configuration is stored in JSON, with changes recorded as JSON patches that enables highly structured search. | ||||||
| * **SPAM Free** - Not all configuration data is useful, and overly verbose change histories are difficult to navigate. | ||||||
| * **GitOps Ready** - Configuration should be stored in Git, config-db enables the extraction of configuration out of Git repositories with branch/environment awareness. | ||||||
| * **Topology Aware** - Configuration can often have an inheritance or override hierarchy. | ||||||
|
|
||||||
| ```bash | ||||||
| export DB_URL=postgres://<username>@localhost:5432/config | ||||||
| ``` | ||||||
| ## Capabilities | ||||||
|
|
||||||
| ### Create `config` database. | ||||||
| * View and search change history in any dimension (node, zone, environment, application, technology) | ||||||
| * Compare and diff configuration across environments. | ||||||
|
|
||||||
| ```sql | ||||||
| create database config | ||||||
| ``` | ||||||
| ## Quick Start | ||||||
|
|
||||||
| ### Scape config and serve | ||||||
| Before installing the Canary Checker, please ensure you have the [prerequisites installed](docs/prereqs.md) on your Kubernetes cluster. | ||||||
|
|
||||||
| Starting the server will run the migrations and start scraping in background (The `default-schedule` configuration will run scraping every 60 minutes if configuration is not explicitly specified). | ||||||
| The recommded method for installing Canary Checker is using [helm](https://helm.sh/) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ```bash | ||||||
| make build | ||||||
| ### Install Helm | ||||||
|
|
||||||
| The following steps will install the latest version of helm | ||||||
|
|
||||||
| ./.bin/config-db serve | ||||||
| ```bash | ||||||
| curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | ||||||
| chmod 700 get_helm.sh | ||||||
| ./get_helm.sh | ||||||
| ``` | ||||||
|
|
||||||
| To explicitly run scraping with a particular configuration: | ||||||
| ### Add the Flanksource helm repository | ||||||
|
|
||||||
| ```bash | ||||||
| ./.bin/config-db run <scrapper-config.yaml> -vvv | ||||||
| config-db serve | ||||||
| helm repo add flanksource https://flanksource.github.io/charts | ||||||
| helm repo update | ||||||
| ``` | ||||||
|
|
||||||
| See `fixtures/` for example scraping configurations. | ||||||
| ### Configurable fields | ||||||
|
|
||||||
| See the [values file](chart/values.yaml) for the full list of configurable fields. Mandatory configuration values are for the configuration of the database, and it is recommended to also configure the UI ingress. | ||||||
|
|
||||||
| #### DB | ||||||
|
|
||||||
| ConfigDB requires a Postgres server to function. A basic postgres server can be installed by the helm chart. | ||||||
|
|
||||||
| #### Chart-managed Server | ||||||
|
|
||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check table formatting |
||||||
| | db.external.create | `true` | | ||||||
| | db.external.storageClass | Set to name of a storageclass available in the cluster | | ||||||
| | db.external.storage | Set to volume of storage to request | | ||||||
|
|
||||||
| ### Migrations | ||||||
| The helm chart will create a postgres server statefulset, with a random password and default port, along with a canarychecker database hosted on the server. | ||||||
|
|
||||||
| Commands `./bin/config-db serve` or `./bin/config-db run` would run the migrations. | ||||||
| To specify a username and password for the chart-managed Postgres server, create a secret in the namespace that the chart will install to, named `postgres-connection`, which contains `POSTGRES_USER` and `POSTGRES_PASSWORD` keys. If no pre-existing secret is created, a user call'ed 'postgres' will be given a random password. | ||||||
|
|
||||||
| Setup [goose](https://github.com/pressly/goose) for more options on migration. Goose commands need to be run from `db/migrations` directory. | ||||||
| #### Prexisting Server | ||||||
|
|
||||||
| In order to connect to an existing Postgres server, a database must be created on the server, along with a user that has admin permissions | ||||||
|
|
||||||
| | db.external.create | `false` | | ||||||
| | db.external.secretKeyRef.name | Set to name of name of secret that contains a key containging the postgres connection URI | | ||||||
| | db.external.secretKeyRef.key | Set to the name of the key in the secret that contains the postgres connection URI | | ||||||
|
|
||||||
| The connection URI must be specified in the format `postgresql://"$user":"$password"@"$host"/"$database"` | ||||||
|
|
||||||
| #### Ingress | ||||||
|
|
||||||
| In order to view the ConfigDB UI, it must be exposed using an ingress: | ||||||
|
|
||||||
| | | | | ||||||
| |---------------------|-------------------| | ||||||
| | ingress.host | URL at which the UI will be accessed | | ||||||
| | ingress.annotations | Map of annotations required by the ingress controller or certificate issuer | | ||||||
| | ingress.tls | Map of configuration options for TLS | | ||||||
|
|
||||||
| More details regarding ingress configuration can be found in the [kubernetes documentation](https://kubernetes.io/docs/concepts/services-networking/ingress/) | ||||||
|
|
||||||
| ### Deploy using Helm | ||||||
|
|
||||||
| To install into a new `config-db` namespace, run | ||||||
|
|
||||||
| ```bash | ||||||
| GOOSE_DRIVER=postgres GOOSE_DBSTRING="user=postgres dbname=config sslmode=disable" goose down | ||||||
| helm install config-db-demo --wait -n config-db --create-namespace flanksource/config-db -f values.yaml | ||||||
| ``` | ||||||
| ## Principles | ||||||
|
|
||||||
| * **JSON Based** - Configuration is stored in JSON, with changes recorded as JSON patches that enables highly structured search. | ||||||
| * **SPAM Free** - Not all configuration data is useful, and overly verbose change histories are difficult to navigate. | ||||||
| * **GitOps Ready** - Configuration should be stored in Git, config-db enables the extraction of configuration out of Git repositories with branch/environment awareness. | ||||||
| * **Topology Aware** - Configuration can often have an inheritance or override hierarchy. | ||||||
|
|
||||||
| ## Capabilities | ||||||
| where `values.yaml` contains the configuration options detailed above. eg | ||||||
|
|
||||||
| ```yaml | ||||||
| db: | ||||||
| create: true | ||||||
| storageClass: default | ||||||
| storage: 30Gi | ||||||
| ingress: | ||||||
| host: config-db.flanksource.com | ||||||
| annotations: | ||||||
| kubernetes.io/ingress.class: nginx | ||||||
| kubernetes.io/tls-acme: "true" | ||||||
| tls: | ||||||
| - secretName: config-db-tls | ||||||
| hosts: | ||||||
| - config-db.flanksource.com | ||||||
| ``` | ||||||
|
|
||||||
| * View and search change history in any dimension (node, zone, environment, application, technology) | ||||||
| * Compare and diff configuration across environments. | ||||||
|
|
||||||
| ## Configuration Sources | ||||||
|
|
||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.