dagu icon indicating copy to clipboard operation
dagu copied to clipboard

Add an optional parameter `--config` for all sub commands

Open yohamta0 opened this issue 4 years ago • 9 comments

Why: this makes it easier to run multiple Dagu servers on a single instance.

yohamta0 avatar Jul 29 '22 07:07 yohamta0

Should merge admin-configuration, env、admin config、global config into one config file, and the config file can specify by --config?

I think this way is clearer to config server or scheduler and easy to organize multiple instances's data.

Arvintian avatar Aug 01 '22 03:08 Arvintian

By the way, we can remove the rely of the $HOME path. Dagu's work dir can specify in the config file.

Arvintian avatar Aug 01 '22 03:08 Arvintian

Make dagu's execution environment don't rely on some sys environment. It is useful to run dagu on cloud or container platform. User can run dagu multi-instance or multi-tenancy.

https://github.com/yohamta/dagu/discussions/200

Arvintian avatar Aug 01 '22 03:08 Arvintian

Thanks for the great suggestions!

Should merge admin-configuration, env、admin config、global config into one config file, and the config file can specify by --config?

I think this way is clearer to config server or scheduler and easy to organize multiple instances's data.

I agree 100%. Good idea.

By the way, we can remove the rely of the $HOME path. Dagu's work dir can specify in the config file.

Yes, I was thinking of adding a config option home and DAGU__ADMIN_HOME env like $AIRFLOW_HOME in Airflow's config. What do you think?

yohamta0 avatar Aug 01 '22 08:08 yohamta0

I think config have a single entry is important. Currently admin's config some in admin.yaml, some in env. I am confused about it. After review code, i found three type config.

  • For admin(server&scheduler) config.
  • For operator(start/stop...) and dag config.
  • For both admin and operator.

It's a little messy now :) and some code is coupling.

My idea:

  • env config is base, like $AIRFLOW_HOME, just about home、database basic config, for admin and operator but no business configuration.
  • admin config and global config should merge.
  • about dag config, it can understand not is config, it is dag object spec, should it is independent.

refer to kubernetes:

kubectl --kubeconfig ~/.kube/my-kube-config apply deployment-spec.yaml

dagu can as:

dagu --config my-dagu-config [start/stop/server] [dag-spec.yaml]

Arvintian avatar Aug 01 '22 10:08 Arvintian

Thanks for sharing the great idea!

I think config have a single entry is important. Currently admin's config some in admin.yaml, some in env. I am confused about it.

Yeah, let's make it to a single entry for config. I think it's best to have only env for basic config. Only home env is necessary for operator(start/stop/...) commands to find the admin config, for now, I think.

admin config and global config should merge.

How about having a new admin field baseConfig as below and eliminating the concept of global config? The baseConfig is for common settings shared among all DAGs such as env or mailOn etc.

baseConfig: <path/to/global-config-yaml>

For the other idea, I agree 100% :)

yohamta0 avatar Aug 01 '22 13:08 yohamta0

Follow this pattern:

dagu --config my-dagu-config [start/stop/server] [dag-spec.yaml]

I think env is for dagu's basic work, link save database、logs、suspend eg. Some default configs value can use default env value to set default value, link data path eg. But it is not use to find config, it is use to dagu self work, like save state、cache eg.

Only home env is necessary for operator(start/stop/...) commands to find the admin config, for now, I think.

--config can tell all components where to find config file. For now default value, can point to default value ($home[~/.dagu]/admin.yaml), this behavior is compatible fallback.

baseConfig is a good idea for common settings among all DAGs, it's default value can be ($home[~/.dagu]/config.yaml) for compatible fallback, i agree about it 👍 .

Arvintian avatar Aug 02 '22 00:08 Arvintian

Fantastic! I agree completely 👍 .

yohamta0 avatar Aug 02 '22 01:08 yohamta0

done!

yohamta0 avatar Aug 12 '22 11:08 yohamta0