{"_id":"573ed4bea233380e005db15a","__v":1,"category":{"_id":"573ed4bea233380e005db14e","__v":0,"version":"573ed4bea233380e005db14d","project":"56b86cc286d2b0190070bcda","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-02-08T10:24:03.768Z","from_sync":false,"order":0,"slug":"documentation","title":"Documentation"},"user":"56b86c990094520d006b3c33","githubsync":"","version":{"_id":"573ed4bea233380e005db14d","__v":2,"project":"56b86cc286d2b0190070bcda","createdAt":"2016-05-20T09:11:26.847Z","releaseDate":"2016-05-20T09:11:26.847Z","categories":["573ed4bea233380e005db14e","573ed4bea233380e005db14f","573ed4bea233380e005db150","578bcf36bb7d810e00e01c05"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"master","version_clean":"0.3.0-0.4","version":"0.3-0.4"},"parentDoc":null,"project":"56b86cc286d2b0190070bcda","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-02-08T11:16:49.715Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"This chapter will explain all the available sections of the accompli.json configuration. \n\n## Using a recipe\nA recipe is a set of pre-configured tasks defined in a separate accompli.json file.\n\nYou can include a recipe by referencing it in the '$extend' key:\n``` json\n{\n  \"$extend\": \"accompli://recipe/defaults.json\"\n}\n```\n\nThe path to the recipe can be relative to the location of the accompli.json in your project.\n\n## Configuring a host\n\nHosts are configured in an array within the 'hosts' key.\n\nA host object requires the following keys:\n* stage - The deployment stage a host is part of (test, acceptance, production).\n* connectionType - The identifier of a connection adapter to communicate with the host.\n* hostname - The IP address or DNS hostname of the host.\n* path - The absolute path to the workspace on the host.\n\n``` json\n{\n  \"hosts\": [\n    {\n      \"stage\": \"test\",\n      \"connectionType\": \"ssh\",\n      \"hostname\": \"example.com\",\n      \"path\": \"/var/www/example.com\"\n    }\n  ]\n}\n```\n\nOptionally, a 'connectionOptions' key can be configured within a host object with an array of connection adapter specific configuration parameters.\n\nFor more information on the specific connection options, please see the [Connection adapters](doc:connection-adapters) documentation.\n\n## Configuring a task\n\nTasks are mostly configured as an event subscriber, but can also be configured as event listener for a specific event.\n\nTo configure a task as an event subscriber add your class to the 'events.subscribers' keys:\n\n``` json\n{\n  \"events\": {\n    \"subscribers\": [\n      {\n        \"class\": \"My\\\\Namespaced\\\\Task\"\n      }\n    ]\n  }\n}\n```\n\nIf your task has constructor arguments to configure it's behavior, you'll be able to configure them next to the class name of the task:\n\n``` json\n{\n  \"events\": {\n    \"subscribers\": [\n      {\n        \"class\": \"My\\\\Namespaced\\\\Task\",\n        \"argument1\": \"value\",\n        \"argument2\": 2\n      }\n    ]\n  }\n}\n```\n\nFor more information about tasks and a list of available Accompli tasks, see the [Tasks](doc:tasks) documentation.\n\n## Configuring the deployment strategy\n\nA deployment strategy is configured in the 'deployment.strategy' keys by setting the class name:\n\n``` json\n{\n  \"deployment\": {\n    \"strategy\": \"Accompli\\\\Deployment\\\\Strategy\\\\RemoteInstallStrategy\"\n  }\n}\n```\n\n## Configuring connection adapters\n\nConnection adapters are configured in the 'deployment.connection' keys with an unique identifier and the class name of the connection adapter:\n\n``` json\n{\n  \"deployment\": {\n    \"connection\": {\n      \"uniqueIdentifier\": \"My\\\\Namespaced\\\\ConnectionAdapter\"\n    }\n  }\n}\n```\n\nThe identifier can then be used to configure the 'connectionType' key of a host.","excerpt":"","slug":"configuration","type":"basic","title":"Configuration"}
This chapter will explain all the available sections of the accompli.json configuration. ## Using a recipe A recipe is a set of pre-configured tasks defined in a separate accompli.json file. You can include a recipe by referencing it in the '$extend' key: ``` json { "$extend": "accompli://recipe/defaults.json" } ``` The path to the recipe can be relative to the location of the accompli.json in your project. ## Configuring a host Hosts are configured in an array within the 'hosts' key. A host object requires the following keys: * stage - The deployment stage a host is part of (test, acceptance, production). * connectionType - The identifier of a connection adapter to communicate with the host. * hostname - The IP address or DNS hostname of the host. * path - The absolute path to the workspace on the host. ``` json { "hosts": [ { "stage": "test", "connectionType": "ssh", "hostname": "example.com", "path": "/var/www/example.com" } ] } ``` Optionally, a 'connectionOptions' key can be configured within a host object with an array of connection adapter specific configuration parameters. For more information on the specific connection options, please see the [Connection adapters](doc:connection-adapters) documentation. ## Configuring a task Tasks are mostly configured as an event subscriber, but can also be configured as event listener for a specific event. To configure a task as an event subscriber add your class to the 'events.subscribers' keys: ``` json { "events": { "subscribers": [ { "class": "My\\Namespaced\\Task" } ] } } ``` If your task has constructor arguments to configure it's behavior, you'll be able to configure them next to the class name of the task: ``` json { "events": { "subscribers": [ { "class": "My\\Namespaced\\Task", "argument1": "value", "argument2": 2 } ] } } ``` For more information about tasks and a list of available Accompli tasks, see the [Tasks](doc:tasks) documentation. ## Configuring the deployment strategy A deployment strategy is configured in the 'deployment.strategy' keys by setting the class name: ``` json { "deployment": { "strategy": "Accompli\\Deployment\\Strategy\\RemoteInstallStrategy" } } ``` ## Configuring connection adapters Connection adapters are configured in the 'deployment.connection' keys with an unique identifier and the class name of the connection adapter: ``` json { "deployment": { "connection": { "uniqueIdentifier": "My\\Namespaced\\ConnectionAdapter" } } } ``` The identifier can then be used to configure the 'connectionType' key of a host.