Skip to content

Commit

Permalink
feat: Relase 0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
qbart committed Nov 18, 2023
1 parent cc3a8a4 commit 29a7485
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 6 deletions.
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 21.2.0
61 changes: 61 additions & 0 deletions content/en/blog/2023/release-v0.9.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: "Release v0.9.0 notes"
description: "UI for managing actions with some database metadata."
summary: "UI for managing actions"
date: 2023-11-18T13:19:00+0100
draft: false
images: []
categories: ["News"]
tags: ["release", "krab", "actions", "ui", "auth"]
contributors: ["qbart"]
pinned: false
homepage: false
---

Newest release adds UI with simple authentication. UI allows to exececute actions and browse (in a very limited form for now) database metadata.

Consider following action:

```hcl
action "db" "create" {
description = "Create database"
arguments {
arg "name" {
description = "Database name"
}
arg "user" {
description = "Database user"
}
}
sql = "CREATE DATABASE {{ .Args.name }} OWNER {{ .Args.user }}"
}
```

Action description is a new attribute and is required.

Normally action would be run with:

```
krab action db create -name animals -user api
```

But now you can deploy `krab` as a service. It will expose UI on `http://localhost:8888` (you can use ready to use docker image).

In order to enable http basic authentication you need to set environment variables:
```
KRAB_AUTH=basic
KRAB_AUTH_BASIC_USERNAME=krab
KRAB_AUTH_BASIC_PASSWORD=secret
```

Action list:
![Actions - List](/images/2023/dbaction.png)

Execute action:
![Actions - Run](/images/2023/dbrun.png)

Database list:
![Database - List](/images/2023/dblist.png)
5 changes: 4 additions & 1 deletion content/en/docs/configuration/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ toc: true
weight: 2200
---

- `KRAB_DIR` - directory to load configuration from, if not defined, it defaults to the current working directory
- `KRAB_DIR` - directory to load configuration from, if not defined, it defaults to the current working directory (default to `/etc/krab` in docker container)
- `DATABASE_URL` - PostgreSQL connection string to use when executing actions
- `KRAB_AUTH` - authentication method, possible values: `none`, `basic` (default: `none`)
- `KRAB_AUTH_BASIC_USERNAME` - username for basic authentication
- `KRAB_AUTH_BASIC_PASSWORD` - password for basic authentication
8 changes: 8 additions & 0 deletions content/en/docs/get-started/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ weight: 1400
toc: true
---

## 0.9.0

Features:

- Execute actions via UI
- Browse database list via UI
- Basic auth

## 0.8.0

- allow to disable transaction mode for actions
Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/get-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ asdf plugin add krab
Install desired version:

```sh
asdf install krab 0.8.0
asdf install krab 0.9.0
```

Set it to your project:

```sh
asdf local krab 0.8.0
asdf local krab 0.9.0
```

## docker
Expand Down
6 changes: 6 additions & 0 deletions content/en/docs/resources/action.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Action resource is a custom SQL operation that will be executed.

```hcl {lineNos=true}
action "<namespace>" "<name>" {
description = "..."
arguments {
...
}
Expand All @@ -24,6 +26,7 @@ action "<namespace>" "<name>" {
- `<name>` - is a migration reference name to use when connecting to other resources
- `arguments` block (optional) - define arguments that can be used in `sql` as a variable, see [Resource arguments]({{< ref "docs/configuration/resource-arguments" >}}) for more details
- `sql` - code to be executed
- `description` - description of the action
- `transaction (optional)` - specifies whether to run action in a transaction (default: `true`)

## Arguments
Expand All @@ -37,6 +40,7 @@ These attributes can be used with arguments:

```hcl {lineNos=true}
action "view" "refresh" {
description = "Refresh materialized view"
arguments {
arg "name" {
description = "Materialized view to be refreshed"
Expand All @@ -54,6 +58,8 @@ You can generate fake data with `fake` function template.

```hcl {lineNos=true}
action "seed" "all" {
description = "Seed database with fake data"
sql = <<-SQL
INSERT INTO companies (name) VALUES ({{ fake "Company.Name" | quote }})
SQL
Expand Down
Binary file removed images/doks.png
Binary file not shown.
Binary file removed images/screenshot.png
Binary file not shown.
Binary file removed images/tn.png
Binary file not shown.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "krab",
"description": "Oh, Krab!",
"version": "0.8.0",
"version": "0.9.0",
"engines": {
"node": ">=16.16.0"
},
Expand Down
Binary file added static/images/2023/dbaction.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/2023/dblist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/2023/dbrun.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file removed static/images/vendor/.gitkeep
Empty file.

0 comments on commit 29a7485

Please sign in to comment.