-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
508 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title : "Oh, Krab!" | ||
description: "Krab is a PostgreSQL tool based on HCL syntax. Its aim is to provide fine control for your databases in every environment." | ||
lead: "Krab is a PostgreSQL tool based on HCL syntax. Its aim is to provide fine control for your databases in every environment." | ||
images: [] | ||
--- | ||
|
This file contains 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: "Blog" | ||
description: "The Doks Blog." | ||
date: 2020-10-06T08:49:55+00:00 | ||
lastmod: 2020-10-06T08:49:55+00:00 | ||
draft: false | ||
images: [] | ||
--- |
This file contains 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
title: "Say hello to Doks 👋" | ||
description: "Introducing Doks, a Hugo theme helping you build modern documentation websites that are secure, fast, and SEO-ready — by default." | ||
excerpt: "Introducing Doks, a Hugo theme helping you build modern documentation websites that are secure, fast, and SEO-ready — by default." | ||
date: 2020-11-04T09:19:42+01:00 | ||
lastmod: 2020-11-04T09:19:42+01:00 | ||
draft: false | ||
weight: 50 | ||
images: [] | ||
categories: ["News"] | ||
tags: ["security", "performance", "SEO"] | ||
contributors: ["Henk Verlinde"] | ||
pinned: false | ||
homepage: false | ||
--- | ||
|
||
Introducing Doks, a Hugo theme helping you build modern documentation websites that are secure, fast, and SEO-ready — by default. |
This file contains 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title : "Commands" | ||
description: "Commands" | ||
lead: "" | ||
images: [] | ||
weight: 400 | ||
--- |
This file contains 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
title: "Action" | ||
description: "Action" | ||
lead: "" | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "commands" | ||
identifier: "commands-action" | ||
toc: true | ||
--- | ||
|
||
Actions are genarated from configuration and grouped by namespace. | ||
|
||
## Usage | ||
|
||
```bash | ||
krab action namespace name [arguments] | ||
``` | ||
|
||
## Example | ||
|
||
For [view refresh action]({{< ref "docs/configuration/resources/action#example" >}}) you would use: | ||
|
||
```bash | ||
krab action view refresh -name my-view-name | ||
``` | ||
|
This file contains 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title : "Migrate" | ||
description: "Migrate" | ||
lead: "" | ||
images: [] | ||
weight: 10 | ||
--- |
This file contains 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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
title: "Migrate down" | ||
description: "Migrate down" | ||
lead: "" | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "migrate" | ||
toc: true | ||
--- | ||
|
||
The `migrate down` command rollbacks selected migration. | ||
|
||
After successful operation its `version` is removed from the migration table. | ||
At the beginning of an operation advisory lock is acquired to prevent other operations to run simultaneously. | ||
|
||
## Usage | ||
|
||
```bash | ||
krab migrate down [set] [version] | ||
``` | ||
|
||
### Options | ||
|
||
- `set` - name of the set to migrate. | ||
- `version` - migration version to rollback. | ||
|
||
## Example | ||
|
||
For `default` [migration set]({{< ref "docs/configuration/resources/migration-set" >}}) and [migration]({{< ref "docs/configuration/resources/migration" >}}) version `20060102150405` you would use: | ||
|
||
```bash | ||
krab migrate down default 20060102150405 | ||
``` | ||
|
This file contains 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
title: "Migrate status" | ||
description: "Migrate status" | ||
lead: "" | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "migrate" | ||
toc: true | ||
--- | ||
|
||
The `migrate status` command displays currently applied/pending migrations. | ||
|
||
## Usage | ||
|
||
```bash | ||
krab migrate status [set] | ||
``` | ||
|
||
### Options | ||
|
||
- `set` - name of the set to migrate. | ||
|
||
### Example output | ||
|
||
```bash | ||
krab migrate status animals | ||
|
||
✔ v1 create_animals | ||
✔ v2 create_animals_view | ||
- v3 seed_animals | ||
``` | ||
|
This file contains 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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
title: "Migrate up" | ||
description: "Migrate up" | ||
lead: "" | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "migrate" | ||
toc: true | ||
--- | ||
|
||
The `migrate up` command migrates all pending migration for a given migration set. | ||
|
||
After successful migration its `version` is put into database migration table (by default `schema_migrations`). | ||
At the beginning of an operation advisory lock is acquired to prevent other migrations to run simultaneously. | ||
|
||
{{<alert icon="💡">}} | ||
Migrations are executed in the order defined by migration set, NOT lexicographically. | ||
<br> | ||
When migration table does not exist, it will be created. | ||
{{</alert>}} | ||
|
||
|
||
## Usage | ||
|
||
```bash | ||
krab migrate up [set] | ||
``` | ||
|
||
### Options | ||
|
||
- `set` - name of the set to migrate. | ||
|
||
## Example | ||
|
||
For `default` [migration set]({{< ref "docs/configuration/resources/migration-set" >}}) you would use: | ||
|
||
```bash | ||
krab migrate up default | ||
``` | ||
|
This file contains 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
title: "Version" | ||
description: "Version" | ||
lead: "" | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "commands" | ||
toc: true | ||
--- | ||
|
||
The `version` command prints the version of Krab. | ||
|
||
## Usage | ||
|
||
```sh | ||
krab version | ||
``` | ||
|
||
## Example | ||
|
||
```sh | ||
$ krab version | ||
krab 0.5.0 | ||
Build a2aa572cd37e64c38f16925c1152a2bed1fc4c0a 2021-07-04 | ||
``` |
This file contains 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title : "Configuration" | ||
description: "Configuration" | ||
lead: "" | ||
images: [] | ||
weight: 200 | ||
--- |
This file contains 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: "Environment variables" | ||
description: "Environment variables" | ||
lead: "" | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "configuration" | ||
weight: 20 | ||
toc: true | ||
--- | ||
|
||
- `KRAB_DIR` - directory to load configuration from, if not defined, it defaults to the current working directory | ||
- `DATABASE_URL` - PostgreSQL connection string to use when executing actions |
This file contains 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
title: "Overview" | ||
description: "Overview" | ||
lead: "" | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "configuration" | ||
weight: 10 | ||
toc: true | ||
--- | ||
|
||
Krab by default will load and parse all the configuration files at `KRAB_DIR` path. | ||
File names should end with `.krab.hcl` extension, otherwise they won't be loaded. | ||
|
||
Every command that touches database is required to provide `DATABASE_URL` environment variable. |
This file contains 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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
title: "Resource arguments" | ||
description: "Resource arguments" | ||
lead: "" | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "configuration" | ||
weight: 30 | ||
toc: true | ||
--- | ||
|
||
Some resources accept arguments block that allows to parametrize command. | ||
|
||
Arguments blocks are optional and can expand configuration in a flexible ways. | ||
|
||
```hcl | ||
resource ["label" ["label"...]] { | ||
arguments { | ||
arg "one" { | ||
description = "Some argument description" | ||
} | ||
arg "two" { | ||
description = "Argument with specified type" | ||
type = "string" # default | ||
} | ||
} | ||
} | ||
``` | ||
|
||
- `arg "name"` - argument name | ||
- `description` - summary of an argument | ||
- `type` - currently can only be a `string` type | ||
- arguments are required to pass into command | ||
|
||
### Arguments usage | ||
|
||
Krab uses Go lang templates to replace values. For full documentation refer to [official documentation](https://pkg.go.dev/text/template). | ||
For arguments support refer to specific resource documentation. | ||
|
||
Arguments are not quoted by default unless stated otherwise ⚠️. | ||
|
||
Example: | ||
|
||
``` | ||
sql = "CREATE SCHEMA {{ quote_ident .Args.name }}" | ||
``` | ||
|
||
All arguments must be prefixed with `.Args`. | ||
|
||
|
||
### Built-in functions | ||
|
||
There are built-in functions that allow to operate on arguments before final template is rendered. | ||
|
||
- `quote_ident` - quotes identifiers in database, for example: table/column names | ||
- `quote` - quotes values in database | ||
|
This file contains 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title : "Functions" | ||
description: "Functions" | ||
lead: "" | ||
images: [] | ||
weight: 300 | ||
--- |
This file contains 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
title: "File system" | ||
description: "Functions releated to file system" | ||
lead: "Functions that can be used in krab configuration files." | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "functions" | ||
weight: 310 | ||
toc: true | ||
--- | ||
|
||
## file_read | ||
|
||
`file_read` reads a file at the given path and returns its content as a string. | ||
|
||
```hcl | ||
sql = file_read("path") | ||
``` | ||
|
This file contains 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title : "Get started" | ||
description: "Get started." | ||
lead: "" | ||
images: [] | ||
weight: 100 | ||
--- |
Oops, something went wrong.