Skip to content

Commit

Permalink
updates for topaz 0.32 syntax and config (#116)
Browse files Browse the repository at this point in the history
* updates for topaz 0.32 syntax and config

* updates

* upd versioning

---------

Co-authored-by: Gert Drapers <[email protected]>
  • Loading branch information
ogazitt and gertd authored May 21, 2024
1 parent 33f4a03 commit ce80a06
Show file tree
Hide file tree
Showing 28 changed files with 510 additions and 214 deletions.
12 changes: 6 additions & 6 deletions docs/command-line-interface/topaz-cli/certs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Example:
```
topaz certs list
certs directory: /home/<user>/.config/topaz/certs
certs directory: /home/<user>/.local/share/topaz/certs
FILE NOT BEFORE NOT AFTER VALID CN DNS NAMES
gateway-ca.crt 2024-03-11T11:30:19Z 2025-03-11T11:30:19Z true topaz-gateway-ca
Expand All @@ -32,7 +32,7 @@ certs directory: /home/<user>/.config/topaz/certs
Allows adding/removing the generated development certs to the list of OS trusted certs.

```
Usage: topaz certs trust --certs-dir="/home/<user>/.config/topaz/certs"
Usage: topaz certs trust --certs-dir="/home/<user>/.local/share/topaz/certs"
trust/untrust dev certs
Expand All @@ -41,7 +41,7 @@ Flags:
-N, --no-check disable local container status check ($TOPAZ_NO_CHECK)
-L, --log=0 log level
--certs-dir="/home/<user>/.config/topaz/certs" path to dev certs folder
--certs-dir="/home/<user>/.local/share/topaz/certs" path to dev certs folder
--remove remove dev cert from trust store
```

Expand All @@ -67,7 +67,7 @@ Flags:
-N, --no-check disable local container status check ($TOPAZ_NO_CHECK)
-L, --log=0 log level
--certs-dir="/home/<user>/.config/topaz/certs" path to dev certs folder
--certs-dir="/home/<user>/.local/share/topaz/certs" path to dev certs folder
--force force generation of dev certs, overwriting existing cert files
--trust add generated certs to trust store
--dns-names=localhost,... list of DNS names used to generate dev certs
Expand All @@ -81,7 +81,7 @@ If you use the `--trust` flag it will execute the `certs trust` command after ge
Remove the development certs from the specified cert directory.

```
Usage: topaz certs remove --certs-dir="/home/<user>/.config/topaz/certs"
Usage: topaz certs remove --certs-dir="/home/<user>/.local/share/topaz/certs"
remove dev certs
Expand All @@ -90,5 +90,5 @@ Flags:
-N, --no-check disable local container status check ($TOPAZ_NO_CHECK)
-L, --log=0 log level
--certs-dir="/home/<user>/.config/topaz/certs" path to dev certs folder
--certs-dir="/home/<user>/.local/share/topaz/certs" path to dev certs folder
```
29 changes: 11 additions & 18 deletions docs/command-line-interface/topaz-cli/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -71,57 +71,50 @@ Topaz CLI allows the user to have multiple configuration files and easily switch

When using templates the generated configuration file uses the name of the template (ex. for `todo` template it will generate a `$XDG_CONFIG_HOME/topaz/cfg/todo.yaml`).

To see available configuration files you can use the `topaz list` command, this will also highlight the current active configuration file.
To see available configuration files you can use the `topaz config list` command, this will also highlight the current active configuration file.

If you want to start topaz with a different configuration file, you can just specify the name of the configuration you want to use in the `topaz start/run -n=<name_of_configuration>` command. This will automatically switch you active configuration file to the one you used.

Note: The default `config.yaml` file will keep the container name as `topaz`. Any named configurations (ex. any installed template) will use the `topaz-<config_name>` as the container name.

## Topaz CLI paths and environment variables

By default the Topaz CLI uses XDG_CONFIG_HOME and XDG_DATA_HOME to store the topaz configuration files, local directory files and cert files.
By default the Topaz CLI uses `XDG_CONFIG_HOME` and `XDG_DATA_HOME` to store the topaz configuration files, local directory files and cert files.
These values can be easily overwritten using the Topaz specific environment variables TOPAZ_CERTS_DIR and TOPAZ_DB_DIR (used in newly generated configuration files).

Depending on the OS if these are not set the default paths used are:

1. Linux
```
1. Linux and Darwin/MacOS
```sh
- $HOME/.local/share/topaz/db - directory files
- $HOME/.local/share/topaz/certs - cert files
- $HOME/.config/topaz/cfg - config files
```

2. Darwin
```
- $HOME/Library/Application Support/topaz/db - directory files
- $HOME/Library/Application Support/topaz/certs - cert files
- $HOME/Library/Application Support/topaz/cfg - config files
```

3. Windows
```
2. Windows
```sh
- $HOME\AppData\Local\topaz\certs - cert files
- $HOME\AppData\Local\topaz\db - directory files
- $HOME\AppData\Local\topaz\cfg - config files
- $HOME\.config\topaz\cfg - config files
```

If you used previous versions of topaz your configuration, database and cert files were stored in $HOME/.config/topaz
If you used previous versions of Topaz, your configuration, database and cert files were stored in $HOME/.config/topaz
If you want to keep using the same location to store your files with any newly generated configuration you can export
```
```sh
export TOPAZ_CERTS_DIR=$HOME/.config/topaz/certs
export TOPAZ_DB_DIR=$HOME/.config/topaz/db
```

The topaz CLI could display the following warnings if you had older configuration setup:
```
```sh
You still have old db files in /home/<user>/.config/topaz/db !
Please see documentation on how to update your configuration: https://www.topaz.sh/docs/command-line-interface/topaz-cli/configuration
```

In this scenario you still have database files in the location used by the previous versions of Topaz CLI.
To resolve this warning please move the files to the new location and update the matching configuration file or set the TOPAZ_DB_DIR environment variable as shown above.

```
```sh
This configuration file still uses TOPAZ_DIR environment variable. Please change to using the new TOPAZ_DB_DIR and TOPAZ_CERTS_DIR environment variables.
```
In this scenario you will need to update the configuration file to use the new TOPAZ_DB_DIR and TOPAZ_CERTS_DIR environment variables.
Expand Down
20 changes: 11 additions & 9 deletions docs/command-line-interface/topaz-cli/data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Topaz offers four commands to manage data (objects and relations):

## Importing objects and relations

`topaz import` imports objects and relations in JSON format into the Topaz directory. It takes a directory argument and attempts to import all JSON files in that directory.
`topaz directory import` imports objects and relations in JSON format into the Topaz directory. It takes a directory argument and attempts to import all JSON files in that directory.

Example:

```shell
topaz import -d .
>>> importing data from /Users/ogazitt/.config/topaz/data
topaz directory import -d .
>>> importing data from /Users/ogazitt/.local/share/topaz/todo/data
object types skipped
permissions skipped
relation types skipped
Expand All @@ -44,6 +44,7 @@ Each file is a JSON object with an `objects` key or a `relations` key, which in
},
...
]
}
```

Note that each object must have a `type` key, and the value must be defined as one of the `types` in the manifest. Each object also must have a unique `id` key (within the scope of that type). Finally, an object may have an optional `display_name` and an optional `properties` bag.
Expand All @@ -62,6 +63,7 @@ Note that each object must have a `type` key, and the value must be defined as o
},
...
]
}
```

Note that each relation has at least five fields:
Expand All @@ -74,12 +76,12 @@ Note that each relation has at least five fields:

## Exporting objects and relations

`topaz export` dumps the objects and relations into two files called `objects.json` and `relations.json`, in the directory specified with the `-d` option.
`topaz directory export` dumps the objects and relations into two files called `objects.json` and `relations.json`, in the directory specified with the `-d` option.

Example:

```shell
topaz export -d . -i
topaz directory export -d . -i
>>> exporting data to .
object types skipped
permissions skipped
Expand All @@ -90,12 +92,12 @@ topaz export -d . -i

## Backing up a directory

`topaz backup` creates a tarball with the objects.json and relations.json files. The file is named `backup.tar.gz` by default. To choose a different name, pass in the filename argument.
`topaz directory backup` creates a tarball with the objects.json and relations.json files. The file is named `backup.tar.gz` by default. To choose a different name, pass in the filename argument.

Example:

```shell
topaz backup -i b.tar.gz
topaz directory backup -i b.tar.gz
>>> backup to b.tar.gz
object types skipped
permissions skipped
Expand All @@ -106,12 +108,12 @@ topaz backup -i b.tar.gz

## Restoring a directory from a backup

`topaz restore` restores the directory data from a tarball named `backup.tar.gz` by default. To choose a different name, pass in the filename argument.
`topaz directory restore` restores the directory data from a tarball named `backup.tar.gz` by default. To choose a different name, pass in the filename argument.

Example:

```shell
topaz restore -i backup.tar.gz
topaz directory restore -i backup.tar.gz
>>> restore from /tmp/new/backup.tar.gz
object types skipped
permissions skipped
Expand Down
36 changes: 17 additions & 19 deletions docs/command-line-interface/topaz-cli/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,31 @@

## Usage
```shell
Usage: topaz <command>
Usage: topaz <command> [flags]

Topaz CLI

Commands:
start start topaz in daemon mode
stop stop topaz instance
status status of topaz daemon process
run run topaz in console mode
manifest manifest commands
test test assertions commands
templates template commands
console open console in the browser
import import directory objects
export export directory objects
backup backup directory data
restore restore directory data
install install topaz container
configure configure topaz service
certs cert commands
update update topaz container version
uninstall uninstall topaz container
version version information
start start topaz instance (daemon mode)
stop stop topaz instance
restart restart topaz instance
status status of topaz daemon process
config configure topaz instance
run start topaz instance (console mode)
templates template commands
console open topaz console in the browser
directory (ds) directory commands
authorizer (az) authorizer commands
certs certificate management
install install topaz container
uninstall uninstall topaz container
update update topaz container version
version version information

Flags:
-h, --help Show context-sensitive help.
-N, --no-check disable local container status check ($TOPAZ_NO_CHECK)
-L, --log log level

Run "topaz <command> --help" for more information on a command.
```
Expand Down
22 changes: 10 additions & 12 deletions docs/command-line-interface/topaz-cli/manifest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@

Topaz offers three commands to manage the manifest:

```shell
manifest get get manifest
manifest set set manifest
manifest delete delete manifest
```
* `topaz directory get manifest`
* `topaz directory set manifest`
* `topaz directory delete manifest`

## Getting the manifest

`topaz manifest get` retrieves the current manifest and prints it to stdout.
`topaz directory get manifest` retrieves the current manifest and prints it to stdout.

Example:

```shell
topaz manifest get -i
topaz directory get manifest -i
>>> get manifest to
# yaml-language-server: $schema=https://www.topaz.sh/schema/manifest.json
---
Expand Down Expand Up @@ -51,19 +49,19 @@ types:

## Setting a manifest

`topaz manifest set` set the manifest from stdin. You can also specify a filename as an argument.
`topaz directory set manifest` set the manifest from stdin. You can also specify a filename as an argument.

Example:

```shell
topaz manifest set -i ./manifest.yaml
>>> set manifest from /Users/ogazitt/.config/topaz/model/manifest.yaml
topaz directory set manifest -i ./manifest.yaml
>>> set manifest from /Users/ogazitt/.local/share/topaz/tmpl/todo/model/manifest.yaml
```

## Deleting the manifest

`topaz manifest delete` removes the manifest and **deletes all data**. After deleting a manifest, you must set a new manifest before you can use the Topaz directory.
`topaz directory delete manifest` removes the manifest and **deletes all data**. After deleting a manifest, you must set a new manifest before you can use the Topaz directory.

:::note
`topaz load` and `topaz save` have been deprecated in favor of `manifest set` and `manifest get`, respectively.
`topaz directory load` and `topaz directory save` have been deprecated in favor of `topaz directory set manifest` and `topaz directory get manifest`, respectively.
:::
6 changes: 3 additions & 3 deletions docs/command-line-interface/topaz-cli/start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ Topaz offers four commands to manage the running state of the Topaz daemon:

### Topazd container version

To specify the container name and version that `topaz start` runs, use the following command-line options:
To specify the container name and tag (version) that `topaz start` runs, use the following command-line options:

```shell
--container-name="topaz" container name
--container-version="latest" container version
--container-name="topaz" container image name ($CONTAINER_IMAGE)
--container-tag="0.32.5" container tag ($CONTAINER_TAG)
```

## Run
Expand Down
Loading

0 comments on commit ce80a06

Please sign in to comment.