stackabletech / stackablectl

Commandline tool to interact with a Stackable Data Platform
Other
8 stars 1 forks source link

Support for .env files (for local demo/stack/release files) #249

Closed Techassi closed 6 months ago

Techassi commented 1 year ago

Overview

It would be neat if the stackablectl tool would support reading .env files.

The initial use case which brought up the idea of .env files, was the ability to specify if the tool should use local demo files instead of the remote ones located on GitHub. The current workflow looks something like:

Initial changes would introduce a simpler workflow. Instead of using the hard coded remote URL to fetch the demos file (see here), the .env file would allow users / developers to explicitly use the local demos file. This would make newly added demos immediately available during development. The workflow would look like this then:

One benefit this approach offers, is that the .env file must only be created once inside the stackablectl repo. It is of course not checked into Git and each user / developer can choose to use this approach or not.

ENV Option

The ENV option should be prefixed by either STACKABLE or STACKABLECTL. This should be done for all future options (if any). This is done to avoid any conflicts with ENV options from other tools or applications. A few possibilities how this option can look come to mind:

Further discussion

This concept could be extended to also include the stacks and releases files. Using the last naming scheme from above would be the best fit in my opinion.

The proposal can also be extended further by adding the ability to use local paths for the specified remote manifest files. This process can be done explicitly (by providing distinct local and remote URLs / paths). This would introduce a breaking change.

manifests:
  - plainYaml:
      remote: https://raw.githubusercontent.com/stackabletech/stackablectl/main/demos/data-lakehouse-iceberg-trino-spark/serviceaccount.yaml
      local: ./demos/data-lakehouse-iceberg-trino-spark/serviceaccount.yaml
  - plainYaml:
      remote: https://raw.githubusercontent.com/stackabletech/stackablectl/main/demos/data-lakehouse-iceberg-trino-spark/load-test-data.yaml
      local: ./demos/data-lakehouse-iceberg-trino-spark/load-test-data.yaml

The other (implicit) option would be to automatically cut the https://raw.github... part of the URLs and use the remainder as the local path. This would introduce no breaking change.


The proposed features are mostly QoL ones. Introducing support for the .env file can be the basis for further options in the future. Let's hear some feedback from others. I would be open to implement this if approved.

Techassi commented 1 year ago

ENV file support is implemented in stackabletech/stackable. The ENV option is called STACKABLE_<TYPE>_FILES and works in conjunction with the CLI argument --<TYPE>-file. The .env file is loaded in the current working directory by dotenvy. The user can also provide the ENV variable via the terminal.

The localization of remote URLs is not (yet) implemented.