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"
  }
}

Mail config

When using automated deployments and executing tasks it can send out notifications and other mails to keep you and your team up to date.

Note

If you’ll leave the mail configuration empty it won’t send out any mails.

Don’t have a smtp server? Try the free mandrillapp

/config.json

{
  "mail":{
    "host":"smtp.host.com",
    "port":"587",
    "from":"your@email.com",
    "user":"smtpuser",
    "password":"smtppassword",
    "to":["devops@yourdomain.com"]
  }
}

Webserver config

The webserver runs by default on port 8086, and ip 0.0.0.0.

This config will overwrite the default config.

dc_application_path : the deploy commander path. dc_virtualenv_path : path to virtualenv dc_home_path : path to configuration

/config.json

{
  "webserver":{
        "ip":"0.0.0.0",
"port":"8086",
"dc_application_path":"/deploy-commander/code/path",
"dc_virtualenv_path":"/default/home/path/environment",
"dc_home_path":"/default/home/path",
"workers":1
  }
}

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:

  1. /config/default.json

This is the base config. Everything will be extended from this config.

  1. /config/%(environment)s.json

Main config for development environments. This will overwrite the ./config/default.json

  1. /config/%(project)s/default.json

Main Config for the development project. This will overwrite the ./config/default.json, and development.json

  1. /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:

  1. Generic config (default.json)
  2. Generic environment config (<environment>.json)
  3. Project config (<project>/default.json)
  4. 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:

  1. /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"
          }
        }
      }
    }
  }
}
  1. /config/testing.json
{
  "params": {
    "environment": "testing"
  }
}
  1. /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"
    }
  }
}
  1. /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"
          }
        }
      }
    }
  }
}