fix: curio: base config by default (#11676)

* base config by default

* remove global --layers flag
This commit is contained in:
LexLuthr 2024-03-06 13:41:37 +04:00 committed by GitHub
parent 00334b3b9d
commit 40f3071364
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 61 additions and 50 deletions

View File

@ -22,7 +22,7 @@ import (
var configCmd = &cli.Command{ var configCmd = &cli.Command{
Name: "config", Name: "config",
Usage: "Manage node config by layers. The layer 'base' will always be applied. ", Usage: "Manage node config by layers. The layer 'base' will always be applied at Curio start-up.",
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
configDefaultCmd, configDefaultCmd,
configSetCmd, configSetCmd,
@ -168,7 +168,7 @@ func getConfig(db *harmonydb.DB, layer string) (string, error) {
var configListCmd = &cli.Command{ var configListCmd = &cli.Command{
Name: "list", Name: "list",
Aliases: []string{"ls"}, Aliases: []string{"ls"},
Usage: "List config layers you can get.", Usage: "List config layers present in the DB.",
Flags: []cli.Flag{}, Flags: []cli.Flag{},
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
db, err := deps.MakeDB(cctx) db, err := deps.MakeDB(cctx)
@ -221,8 +221,7 @@ var configViewCmd = &cli.Command{
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "layers", Name: "layers",
Usage: "comma or space separated list of layers to be interpreted", Usage: "comma or space separated list of layers to be interpreted (base is always applied)",
Value: cli.NewStringSlice("base"),
Required: true, Required: true,
}, },
}, },
@ -261,7 +260,7 @@ var configEditCmd = &cli.Command{
DefaultText: "<edited layer>", DefaultText: "<edited layer>",
}, },
&cli.BoolFlag{ &cli.BoolFlag{
Name: "allow-owerwrite", Name: "allow-overwrite",
Usage: "allow overwrite of existing layer if source is a different layer", Usage: "allow overwrite of existing layer if source is a different layer",
}, },
&cli.BoolFlag{ &cli.BoolFlag{

View File

@ -25,7 +25,7 @@ import (
var configNewCmd = &cli.Command{ var configNewCmd = &cli.Command{
Name: "new-cluster", Name: "new-cluster",
Usage: "Create new coniguration for a new cluster", Usage: "Create new configuration for a new cluster",
ArgsUsage: "[SP actor address...]", ArgsUsage: "[SP actor address...]",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{

View File

@ -289,7 +289,7 @@ func LoadConfigWithUpgrades(text string, lp *config.LotusProviderConfig) (toml.M
func GetConfig(cctx *cli.Context, db *harmonydb.DB) (*config.LotusProviderConfig, error) { func GetConfig(cctx *cli.Context, db *harmonydb.DB) (*config.LotusProviderConfig, error) {
lp := config.DefaultLotusProvider() lp := config.DefaultLotusProvider()
have := []string{} have := []string{}
layers := cctx.StringSlice("layers") layers := append([]string{"base"}, cctx.StringSlice("layers")...) // Always stack on top of "base" layer
for _, layer := range layers { for _, layer := range layers {
text := "" text := ""
err := db.QueryRow(cctx.Context, `SELECT config FROM harmony_config WHERE title=$1`, layer).Scan(&text) err := db.QueryRow(cctx.Context, `SELECT config FROM harmony_config WHERE title=$1`, layer).Scan(&text)

View File

@ -124,12 +124,6 @@ func main() {
Hidden: true, Hidden: true,
Value: "5433", Value: "5433",
}, },
&cli.StringSliceFlag{
Name: "layers",
EnvVars: []string{"CURIO_LAYERS"},
Usage: "list of layers to be interpreted (atop defaults). Default: base",
Value: cli.NewStringSlice("base"),
},
&cli.StringFlag{ &cli.StringFlag{
Name: deps.FlagRepoPath, Name: deps.FlagRepoPath,
EnvVars: []string{"LOTUS_REPO_PATH"}, EnvVars: []string{"LOTUS_REPO_PATH"},

View File

@ -52,6 +52,10 @@ var sealStartCmd = &cli.Command{
Usage: "Use synthetic PoRep", Usage: "Use synthetic PoRep",
Value: false, // todo implement synthetic Value: false, // todo implement synthetic
}, },
&cli.StringSliceFlag{
Name: "layers",
Usage: "list of layers to be interpreted (atop defaults). Default: base",
},
}, },
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
if !cctx.Bool("now") { if !cctx.Bool("now") {

View File

@ -54,6 +54,10 @@ var wdPostTaskCmd = &cli.Command{
Usage: "deadline to compute WindowPoSt for ", Usage: "deadline to compute WindowPoSt for ",
Value: 0, Value: 0,
}, },
&cli.StringSliceFlag{
Name: "layers",
Usage: "list of layers to be interpreted (atop defaults). Default: base",
},
}, },
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
ctx := context.Background() ctx := context.Background()
@ -140,7 +144,6 @@ It will not send any messages to the chain. Since it can compute any deadline, o
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "layers", Name: "layers",
Usage: "list of layers to be interpreted (atop defaults). Default: base", Usage: "list of layers to be interpreted (atop defaults). Default: base",
Value: cli.NewStringSlice("base"),
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "storage-json", Name: "storage-json",

View File

@ -60,6 +60,10 @@ var runCmd = &cli.Command{
Usage: "path to journal files", Usage: "path to journal files",
Value: "~/.lotus-provider/", Value: "~/.lotus-provider/",
}, },
&cli.StringSliceFlag{
Name: "layers",
Usage: "list of layers to be interpreted (atop defaults). Default: base",
},
}, },
Action: func(cctx *cli.Context) (err error) { Action: func(cctx *cli.Context) (err error) {
defer func() { defer func() {
@ -153,6 +157,10 @@ var webCmd = &cli.Command{
Name: "nosync", Name: "nosync",
Usage: "don't check full-node sync status", Usage: "don't check full-node sync status",
}, },
&cli.StringSliceFlag{
Name: "layers",
Usage: "list of layers to be interpreted (atop defaults). Default: base",
},
}, },
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
db, err := deps.MakeDB(cctx) db, err := deps.MakeDB(cctx)

View File

@ -13,7 +13,7 @@ COMMANDS:
cli Execute cli commands cli Execute cli commands
run Start a lotus provider process run Start a lotus provider process
stop Stop a running lotus provider stop Stop a running lotus provider
config Manage node config by layers. The layer 'base' will always be applied. config Manage node config by layers. The layer 'base' will always be applied at Curio start-up.
test Utility functions for testing test Utility functions for testing
web Start lotus provider web interface web Start lotus provider web interface
seal Manage the sealing pipeline seal Manage the sealing pipeline
@ -26,16 +26,15 @@ COMMANDS:
fetch-params Fetch proving parameters fetch-params Fetch proving parameters
GLOBAL OPTIONS: GLOBAL OPTIONS:
--color use color in display output (default: depends on output being a TTY) --color use color in display output (default: depends on output being a TTY)
--db-host value Command separated list of hostnames for yugabyte cluster (default: "yugabyte") [$LOTUS_DB_HOST] --db-host value Command separated list of hostnames for yugabyte cluster (default: "yugabyte") [$LOTUS_DB_HOST]
--db-name value (default: "yugabyte") [$LOTUS_DB_NAME, $LOTUS_HARMONYDB_HOSTS] --db-name value (default: "yugabyte") [$LOTUS_DB_NAME, $LOTUS_HARMONYDB_HOSTS]
--db-user value (default: "yugabyte") [$LOTUS_DB_USER, $LOTUS_HARMONYDB_USERNAME] --db-user value (default: "yugabyte") [$LOTUS_DB_USER, $LOTUS_HARMONYDB_USERNAME]
--db-password value (default: "yugabyte") [$LOTUS_DB_PASSWORD, $LOTUS_HARMONYDB_PASSWORD] --db-password value (default: "yugabyte") [$LOTUS_DB_PASSWORD, $LOTUS_HARMONYDB_PASSWORD]
--layers value [ --layers value ] list of layers to be interpreted (atop defaults). Default: base (default: "base") [$CURIO_LAYERS] --repo-path value (default: "~/.lotusprovider") [$LOTUS_REPO_PATH]
--repo-path value (default: "~/.lotusprovider") [$LOTUS_REPO_PATH] --vv enables very verbose mode, useful for debugging the CLI (default: false)
--vv enables very verbose mode, useful for debugging the CLI (default: false) --help, -h show help
--help, -h show help --version, -v print the version
--version, -v print the version
``` ```
## lotus-provider cli ## lotus-provider cli
@ -68,12 +67,13 @@ USAGE:
lotus-provider run [command options] [arguments...] lotus-provider run [command options] [arguments...]
OPTIONS: OPTIONS:
--listen value host address and port the worker api will listen on (default: "0.0.0.0:12300") [$LOTUS_WORKER_LISTEN] --listen value host address and port the worker api will listen on (default: "0.0.0.0:12300") [$LOTUS_WORKER_LISTEN]
--nosync don't check full-node sync status (default: false) --nosync don't check full-node sync status (default: false)
--manage-fdlimit manage open file limit (default: true) --manage-fdlimit manage open file limit (default: true)
--storage-json value path to json file containing storage config (default: "~/.lotus-provider/storage.json") --storage-json value path to json file containing storage config (default: "~/.lotus-provider/storage.json")
--journal value path to journal files (default: "~/.lotus-provider/") --journal value path to journal files (default: "~/.lotus-provider/")
--help, -h show help --layers value [ --layers value ] list of layers to be interpreted (atop defaults). Default: base
--help, -h show help
``` ```
## lotus-provider stop ## lotus-provider stop
@ -91,7 +91,7 @@ OPTIONS:
## lotus-provider config ## lotus-provider config
``` ```
NAME: NAME:
lotus-provider config - Manage node config by layers. The layer 'base' will always be applied. lotus-provider config - Manage node config by layers. The layer 'base' will always be applied at Curio start-up.
USAGE: USAGE:
lotus-provider config command [command options] [arguments...] lotus-provider config command [command options] [arguments...]
@ -100,12 +100,12 @@ COMMANDS:
default, defaults Print default node config default, defaults Print default node config
set, add, update, create Set a config layer or the base by providing a filename or stdin. set, add, update, create Set a config layer or the base by providing a filename or stdin.
get, cat, show Get a config layer by name. You may want to pipe the output to a file, or use 'less' get, cat, show Get a config layer by name. You may want to pipe the output to a file, or use 'less'
list, ls List config layers you can get. list, ls List config layers present in the DB.
interpret, view, stacked, stack Interpret stacked config layers by this version of lotus-provider, with system-generated comments. interpret, view, stacked, stack Interpret stacked config layers by this version of lotus-provider, with system-generated comments.
remove, rm, del, delete Remove a named config layer. remove, rm, del, delete Remove a named config layer.
edit edit a config layer edit edit a config layer
from-miner Express a database config (for lotus-provider) from an existing miner. from-miner Express a database config (for lotus-provider) from an existing miner.
new-cluster Create new coniguration for a new cluster new-cluster Create new configuration for a new cluster
help, h Shows a list of commands or help for one command help, h Shows a list of commands or help for one command
OPTIONS: OPTIONS:
@ -153,7 +153,7 @@ OPTIONS:
### lotus-provider config list ### lotus-provider config list
``` ```
NAME: NAME:
lotus-provider config list - List config layers you can get. lotus-provider config list - List config layers present in the DB.
USAGE: USAGE:
lotus-provider config list [command options] [arguments...] lotus-provider config list [command options] [arguments...]
@ -171,7 +171,7 @@ USAGE:
lotus-provider config interpret [command options] a list of layers to be interpreted as the final config lotus-provider config interpret [command options] a list of layers to be interpreted as the final config
OPTIONS: OPTIONS:
--layers value [ --layers value ] comma or space separated list of layers to be interpreted (default: "base") --layers value [ --layers value ] comma or space separated list of layers to be interpreted (base is always applied)
--help, -h show help --help, -h show help
``` ```
@ -198,7 +198,7 @@ USAGE:
OPTIONS: OPTIONS:
--editor value editor to use (default: "vim") [$EDITOR] --editor value editor to use (default: "vim") [$EDITOR]
--source value source config layer (default: <edited layer>) --source value source config layer (default: <edited layer>)
--allow-owerwrite allow overwrite of existing layer if source is a different layer (default: false) --allow-overwrite allow overwrite of existing layer if source is a different layer (default: false)
--no-source-diff save the whole config into the layer, not just the diff (default: false) --no-source-diff save the whole config into the layer, not just the diff (default: false)
--no-interpret-source do not interpret source layer (default: true if --source is set) --no-interpret-source do not interpret source layer (default: true if --source is set)
--help, -h show help --help, -h show help
@ -225,7 +225,7 @@ OPTIONS:
### lotus-provider config new-cluster ### lotus-provider config new-cluster
``` ```
NAME: NAME:
lotus-provider config new-cluster - Create new coniguration for a new cluster lotus-provider config new-cluster - Create new configuration for a new cluster
USAGE: USAGE:
lotus-provider config new-cluster [command options] [SP actor address...] lotus-provider config new-cluster [command options] [SP actor address...]
@ -281,7 +281,7 @@ DESCRIPTION:
OPTIONS: OPTIONS:
--deadline value deadline to compute WindowPoSt for (default: 0) --deadline value deadline to compute WindowPoSt for (default: 0)
--layers value [ --layers value ] list of layers to be interpreted (atop defaults). Default: base (default: "base") --layers value [ --layers value ] list of layers to be interpreted (atop defaults). Default: base
--storage-json value path to json file containing storage config (default: "~/.lotus-provider/storage.json") --storage-json value path to json file containing storage config (default: "~/.lotus-provider/storage.json")
--partition value partition to compute WindowPoSt for (default: 0) --partition value partition to compute WindowPoSt for (default: 0)
--help, -h show help --help, -h show help
@ -296,8 +296,9 @@ USAGE:
lotus-provider test window-post task [command options] [arguments...] lotus-provider test window-post task [command options] [arguments...]
OPTIONS: OPTIONS:
--deadline value deadline to compute WindowPoSt for (default: 0) --deadline value deadline to compute WindowPoSt for (default: 0)
--help, -h show help --layers value [ --layers value ] list of layers to be interpreted (atop defaults). Default: base
--help, -h show help
``` ```
## lotus-provider web ## lotus-provider web
@ -313,9 +314,10 @@ DESCRIPTION:
This creates the 'web' layer if it does not exist, then calls run with that layer. This creates the 'web' layer if it does not exist, then calls run with that layer.
OPTIONS: OPTIONS:
--listen value Address to listen on (default: "127.0.0.1:4701") --listen value Address to listen on (default: "127.0.0.1:4701")
--nosync don't check full-node sync status (default: false) --nosync don't check full-node sync status (default: false)
--help, -h show help --layers value [ --layers value ] list of layers to be interpreted (atop defaults). Default: base
--help, -h show help
``` ```
## lotus-provider seal ## lotus-provider seal
@ -343,12 +345,13 @@ USAGE:
lotus-provider seal start [command options] [arguments...] lotus-provider seal start [command options] [arguments...]
OPTIONS: OPTIONS:
--actor value Specify actor address to start sealing sectors for --actor value Specify actor address to start sealing sectors for
--now Start sealing sectors for all actors now (not on schedule) (default: false) --now Start sealing sectors for all actors now (not on schedule) (default: false)
--cc Start sealing new CC sectors (default: false) --cc Start sealing new CC sectors (default: false)
--count value Number of sectors to start (default: 1) --count value Number of sectors to start (default: 1)
--synthetic Use synthetic PoRep (default: false) --synthetic Use synthetic PoRep (default: false)
--help, -h show help --layers value [ --layers value ] list of layers to be interpreted (atop defaults). Default: base
--help, -h show help
``` ```
## lotus-provider version ## lotus-provider version