diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index 4da3452..0000000 --- a/CHANGELOG +++ /dev/null @@ -1,4 +0,0 @@ -- 0.0.2 - * Add executable entry point in package install -- 0.0.1 - * Token creation setup for eth diff --git a/README.md b/README.md index de300c9..876a698 100644 --- a/README.md +++ b/README.md @@ -6,39 +6,8 @@ CIC-CLI provides tooling to generate and publish metadata in relation to token deployments. ```shell -pip install --extra-index-url https://pip.grassrootseconomics.net cic[eth] +pip install cic-cli[eth] ``` -## Setup -### Requirements - - Install [poetry](https://python-poetry.org/docs/#installation) -
-Install Kubectl - -```bash -sudo apt-get update -sudo apt-get install -y apt-transport-https ca-certificates curl -sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg -echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list -sudo apt-get update -sudo apt-get install -y kubectl -``` -
- -### Deploy to the testnet - -- Download testnet cluster config from https://cloud.digitalocean.com/kubernetes/clusters -- Move the config to `$HOME/.kube/` -- Run `kubectl -n grassroots --kubeconfig=$HOME/.kube/.yaml get pods` -- Copy the name of the meta pod (e.g `cic-meta-server-67dc7c6468-8rhdq`) -- Port foward the meta pod to the local machine using `kubectl port-forward pods/ 6700:8000 -n grassroots --kubeconfig=$HOME/.kube/.yaml` -- Clone this repository to your local machine -- Run `poetry install -E eth` in the repo root -- Open `./config/testnet/config.ini` and change - - [auth]keyfile_path - - [wallet]key_file -- Open a new terminal and run `poetry run cic wizard -c ./config/testnet ./somewhere` - - ## Usage ### Using the wizard ``` @@ -76,6 +45,8 @@ state of the package contains interface to EVM only. Thus, the examples below are limited to the context of the EVM. ## Development +### Requirements + - Install [poetry](https://python-poetry.org/docs/#installation) ### Setup @@ -97,6 +68,31 @@ below are limited to the context of the EVM. - Save the private key to a file - Run `eth-keyfile -k > ~/.config/cic/keystore/keyfile.json` +### Port Forwarding +
+Install Kubectl + +```bash +sudo apt-get update +sudo apt-get install -y apt-transport-https ca-certificates curl +sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg +echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list +sudo apt-get update +sudo apt-get install -y kubectl +``` +
+ +- Download testnet cluster config from https://cloud.digitalocean.com/kubernetes/clusters +- Move the config to `$HOME/.kube/` +- Run `kubectl -n grassroots --kubeconfig=$HOME/.kube/.yaml get pods` +- Copy the name of the meta pod (e.g `cic-meta-server-67dc7c6468-8rhdq`) +- Port foward the meta pod to the local machine using `kubectl port-forward pods/ 6700:8000 -n grassroots --kubeconfig=$HOME/.kube/.yaml` +- Clone this repository to your local machine +- Run `poetry install -E eth` in the repo root +- Open `./config/testnet/config.ini` and change + - [auth]keyfile_path + - [wallet]key_file +- Open a new terminal and run `poetry run cic wizard -c ./config/testnet ./somewhere` ### Tests ``` diff --git a/cic/config.py b/cic/config.py new file mode 100644 index 0000000..beffc70 --- /dev/null +++ b/cic/config.py @@ -0,0 +1,15 @@ +import os +import shutil + +default_module_configs = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'config') + +def ensure_base_configs(config_dir: str): + """ + Ensure that the base configs are present. + """ + if not os.path.exists(config_dir): + os.makedirs(config_dir) + for f in os.listdir(default_module_configs): + if not os.path.exists(os.path.join(config_dir, f)): + shutil.copytree(os.path.join(default_module_configs, f), os.path.join(config_dir, f)) + diff --git a/cic/runnable/cic_cmd.py b/cic/runnable/cic_cmd.py index 2ee4b10..ba87624 100644 --- a/cic/runnable/cic_cmd.py +++ b/cic/runnable/cic_cmd.py @@ -13,6 +13,7 @@ import cic.cmd.show as cmd_show import cic.cmd.ext as cmd_ext import cic.cmd.export as cmd_export import cic.cmd.wizard as cmd_wizard +from cic.config import ensure_base_configs logging.basicConfig(level=logging.WARNING) logg = logging.getLogger() @@ -21,6 +22,7 @@ script_dir = os.path.dirname(os.path.realpath(__file__)) data_dir = os.path.join(script_dir, '..', 'data') base_config_dir = os.path.join(data_dir, 'config') schema_dir = os.path.join(script_dir, '..', 'schema') +user_config_dir = os.path.join(os.path.expanduser("~"), ".config", "cic", "cli", "config") arg_flags = chainlib.cli.argflag_std_read | chainlib.cli.Flag.SEQ argparser = chainlib.cli.ArgumentParser( @@ -62,6 +64,7 @@ cmd_mod = importlib.import_module(modname) extra_args = { 'p': 'RPC_PROVIDER', } +ensure_base_configs(user_config_dir) config = chainlib.cli.Config.from_args(args, arg_flags=arg_flags, base_config_dir=base_config_dir, extra_args=extra_args)