# Configuration Template

This directory (`files/conf`) contains pigsty configuration templates, Which will be used during `configure` procedure.

Config templates are named as `pigsty-<mode>.yml`.  `<mode>` can be designated using `./configure -m <mode>`

There are several built-in config modes:

### **demo (default for demo)** 

[pigsty-demo.yml](pigsty-demo.yml) : 4-node sandbox demo configuration file

which have a one-node cluster `pg-meta` on `10.10.10.10`,
and a 3-node cluster `pg-test` on `10.10.10.11(node-1)` , `10.10.10.12(node-2)`, `10.10.10.13(node-3)`

If not configured, this is the default configuration file.
If `vagrant` is used as admin user, this configuration template will be used automatically



### **auto**

[pigsty-auto.yml](pigsty-auto.yml) : default config template for production

If mode is not specified, or `vagrant` is not the admin user name, this will be used as the default config templates

This is a modified version of `pigsty-demo.yml`, which is generated by [conf_gen.py](conf_gen.py)

* remove verbose comments on `all.childrens`
* remove unnecessary application : `isd`, `covid`
* disable jupyter & pgweb by default
* `dcs_exists_action` and `pg_exists_action` set to `abort` instead of `clean`
* * uplift pg_dummy_filesize from 64MiB to 1GiB
* do not overwrite node's timezone
* do not overwrite node's hostname with database instance name
* do not update node's dns resolv config
* do not update node's ntp config
* do not exchange dbsu's ssh key

if meta node 's cpu core > 8, `node_tune` and `pg_conf` will be set to `oltp` mode.



## Templating

There are some placeholder values in configuration: Such as meta node ip address. which is hard-coded as `10.10.10.10`.

It will be REPLACED to actual ip address during `configure` with `sed`.

you could just run `configure` and follow the interactive wizard, or render it with `sed` manully:

```bash
sed_cmd="s/10.10.10.10/${primary_ip}/g"
config_src=${pigsty_home}/files/conf/pigsty-${mode}.yml
config_dst=${pigsty_home}/pigsty.yml
sed -e ${sed_cmd} ${config_src} > ${config_dst}
```


## Cluster Config

[`cls/`](example/) contains some example of cluster definition.

It can also be loaded via `load_cls.py` when using cmdb dynamic inventory.