Config¶
This page contains some example configuration that will give you some more insight of the possible parameters.
In your config you can setup stuff like ssh credentials, symlinks, mysql backup and much more...
It’s important to understand how settings are loaded and which settings are possible. We’ve implemented a nice feature to inherit settings based on environments and projects.
We’ll start by explaining each config file by it’s location on the filesystem.
Root config¶
The main configuration file must be located in the root folder and named “config.json” This config file contains json structured params, like your master password.
Note
Don’t commit this file to your repo because the master password should be stored elsewhere.
/config.json
{
"master_password": "abc1234",
"env": {
"debug": "False",
"warning_only": "True",
"running": "False",
"stdout": "False"
}
}
Initial project config¶
This config file is located in the /config/<project> folder. Here you can define settings related to deploy commander.
This file is optional, and not required to be present. The application autodetects the presence of this file.
/<project>/config.json
{
"config_load_strategy": [
"config/default.json",
"config/%(environment)s.json",
"config/%(project)s/default.json",
"Your own config here"
]
}
Note
config_load_strategy is optional, leave it empty by default
Global project config¶
The basic foundation of this system are tasks and actions. You can initiate a task, and these have actions to execute.
The default config strategy (if not set in /<project>/config.json) will be:
- /config/default.json
This is the base config. Everything will be extended from this config.
- /config/%(environment)s.json
Main config for development environments. This will overwrite the ./config/default.json
- /config/%(project)s/default.json
Main Config for the development project. This will overwrite the ./config/default.json, and development.json
- /config/%(project)s/%(environment)s.json
Config for the development project. This will overwrite the ./config/default.json, default.json and development.json
To view the configuration from the command line you can run:
$ deploy-commander go show_config
When running a task it will load in sequence (if available) and combine the configuration of:
- Generic config (default.json)
- Generic environment config (<environment>.json)
- Project config (<project>/default.json)
- Project environment config (<project>/<environment>.json)
Note
If you want to load a different config strategy for your project, you can create a file ‘<project>/config.json’ (See Initial project config)
So in this case, the 2’nd config will append and overwrite the 1’st. The 3’rd the 2’nd etc..
This is an example structure of a project config:
- /config/default.json
{
"params": {
"some_param": "param/value"
},
"post_params": {
"dynamic_post_param": "/some/%(some_param)s/path"
},
"tasks": {
"deploy": {
"description": "Deploy project",
"actions": {
"your-own-description": {
"sequence": 1,
"execute": "command.action",
"params": {
"dynamic_param": "%(dynamic_param)s/repo",
"dynamic_post_param": "%(dynamic_post_param)s/source/%(tag)s"
}
}
}
}
}
}
- /config/testing.json
{
"params": {
"environment": "testing"
}
}
- /config/test/default.json
{
"params": {
"project_name": "test"
},
"post_params": {
"post_test": "%(project_name)s-%(environment)-%(password)s"
},
"tasks": {
"deploy": {
"description": "Lets change the title"
}
}
}
- /config/test/testing.json
{
"params": {
"password": "1234"
}
}
When executing : $ deploy-commander go:test,testing show_config it will output as:
{
"params": {
"some_param": "param/value",
"password": "1234",
"project_name": "test",
"environment": "testing"
},
"post_params": {
"dynamic_post_param": "/some/%(some_param)s/path",
"post_test": "%(project_name)s-%(environment)-%(password)s"
},
"tasks": {
"deploy": {
"description": "Lets change the title",
"actions": {
"your-own-description": {
"sequence": 1,
"execute": "command.action",
"params": {
"dynamic_param": "%(dynamic_param)s/repo",
"dynamic_post_param": "%(dynamic_post_param)s/source/%(tag)s"
}
}
}
}
}
}