cookbook 'activelamp_symfony', '~> 0.0.1'
activelamp_symfony (1) Versions 0.0.1 Follow3
Cookbook for deploying Symfony2 projects.
cookbook 'activelamp_symfony', '~> 0.0.1', :supermarket
knife supermarket install activelamp_symfony
knife supermarket download activelamp_symfony
Description
This cookbook provides an easy way to deploy a Symfony2 application, as well as run console commands on it.
Requirements
-
activelamp_composercookbook
You might also need to install this on your node(s):
-
aclpackage to support the use ofChef::Provider::SymfonyPermission::Setfacl. You might have to use this if your nodes does not support thechmod +a ...command. You can install this using your platform's package manager (.i.e.,apt)
Installing PHP and other packages is outside the scope of this cookbook.
Platforms:
- Tested on Ubuntu/Debian only, but the deploy actions should work with any platform. However, there is no provider to handle
:set_permissionson Windows at the moment.
Attributes
NA
Resources / Providers
symfony_project
This resource simply extends the built-in deploy resource, but provides sensible defaults that are relevant to most Symfony projects. For example, a symlink is automatically created for app/logs into the shared folder so that they persist between deploys. web/uploads is also automatically symlinked. You can override these links by specifying the shared_dirs option in the resource.
Actions
- All actions supported by the
deployresource. -
:set_permissions- Sets the permissions ofapp/logs,app/cache,web/uploadsand any other directories you specified underworld_writable_dirs
Examples
#Deploy a Symfony project symfony_project "/path/to/project" do repo 'git@github.com:foo_organization/bar_application.git' revision 'v1.2' git_ssh_wrapper '/tmp/ssh-wrapper.sh' action [:deploy, :set_permissions] composer_options({ :dev => true, :quiet => false, :verbosity => 2 }) parameters({ :database_user => 'root', :database_password => node[:mysql][:server_root_password] }) end
Attributes
All options for the deploy resource is applicable here. However here are additional options that are symfony_project-specific:
| Name | Default | Description |
|---|---|---|
| shared_dirs | {'logs' => 'app/logs','cache' => 'app/cache','uploads' => 'web/media/uploads','vendor' => 'vendor'} |
The directories to create under the shared directory and symlinked into every deployment. |
| world_writable_dirs | ['app/logs', 'app/cache', 'web/uploads'] |
Directories that should be world writeable. |
| permission_provider | Chef::Provider::SymfonyPermission::Chmod |
The provider that handles the setting of the appropriate permissions on the directories listed under world_writable_dirs. Only relevant on :set_permissions. You can also substitute this for Chef::Provider::SymfonyPermission::Setfacl if your prefer to use setfacl to set the permissions. |
| web_user | "www-data" |
The user to whom permission will be granted/umasked. Only relevant on :set_permissions
|
| parameters | {} |
Parameters overrides. |
| parameters_file | app/config/parameters.yml |
Path to the parameters file |
| parameters_dist_file | app/config/parameters.yml.dist |
Path to the parameters file distributable. |
| parameters_file_template | parameters.yml.erb |
The ERB template for the parameters file. Parameter overriding is disabled if this is set to nil. |
| parameters_file_template_cookbook | nil |
The cookbook where the prefered template is located. This will default to the current cookbook. Specify :activelamp_symfony if you wish to use the built-in one. Use @parameters to access the container parameters which are merged from the contents of the distributable and the values in parameters. |
| composer_options | { :action => [:download_phar, :install], :lock_file_only => true, :dev => false, :prefer_dist => true, :prefer_source => false, :optimize_autoloader => true} |
The options used when the composer resource is called internally during migrate. Refer to the activelamp_composer cookbook for available options. |
app_console
You can use this resource to interact with your Symfony application via the Symfony Console.
Actions
-
:run(default) - Runs the command :nothing
Examples
#Run a Symfony Console command app_console "/path/to/project/current" do command 'assetic:dump --force' environment 'prod' quiet false verbosity 3 user node[:user] group node[:group] end
Attributes
| Attribute | Default | Description |
|---|---|---|
| app | The name attribute | The project root of the Symfony application. |
| command | nil |
The command to execute |
| environment | :prod |
The environment to run the command in. Used in the --env flag |
| quiet | true |
If true, adds the --quiet flag |
| verbosity | 1 |
Value for the --verbose flag. |
| user | nil | The user to execute the command as. |
| group | nil | The group to execute the command as. |
| console | php app/console |
The Symfony Console command to use. |
An example on using symfony_project and app_console together during deploys:
symfony_project "/path/to/project" do repo 'git@github.com:foo_organization/bar_application.git' revision 'v1.2' git_ssh_wrapper '/tmp/ssh-wrapper.sh' parameters({ :database_user => 'root', :database_password => node[:mysql][:server_root_password], :database_host => 'localhost' }) user node[:deploy_user] group node[:deploy_group] permission_provider Chef::Provider::SymfonyPermission::Setfacl world_writable_dirs.push('web/media/thumbnails') action [:deploy, :set_permissions] notifies :run, 'app_console[assetic-dump]' end app_console "assetic-dump" doo app '/path/to/project/current' command 'assetic:dump --force' console 'php bin/console' # If you are using Symfony 3.0 directory structure. user node[:deploy_user] group node[:deploy_group] action :nothing end
License and Authors
Author: Bez Hermoso bez@activelamp.com
Author: ActiveLAMP
Copyright: 2012-2014, ActiveLAMP
Dependent cookbooks
| activelamp_composer ~> 0.0.1 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Collaborator Number Metric
0.0.1 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
0.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.0.1 failed this metric
FC064: Ensure issues_url is set in metadata: activelamp_symfony/metadata.rb:1
FC065: Ensure source_url is set in metadata: activelamp_symfony/metadata.rb:1
FC066: Ensure chef_version is set in metadata: activelamp_symfony/metadata.rb:1
FC069: Ensure standardized license defined in metadata: activelamp_symfony/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.0.1 passed this metric
Testing File Metric
0.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.0.1 failed this metric
0.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.0.1 failed this metric
FC064: Ensure issues_url is set in metadata: activelamp_symfony/metadata.rb:1
FC065: Ensure source_url is set in metadata: activelamp_symfony/metadata.rb:1
FC066: Ensure chef_version is set in metadata: activelamp_symfony/metadata.rb:1
FC069: Ensure standardized license defined in metadata: activelamp_symfony/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.0.1 passed this metric
Testing File Metric
0.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.0.1 failed this metric
FC065: Ensure source_url is set in metadata: activelamp_symfony/metadata.rb:1
FC066: Ensure chef_version is set in metadata: activelamp_symfony/metadata.rb:1
FC069: Ensure standardized license defined in metadata: activelamp_symfony/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
0.0.1 passed this metric
Testing File Metric
0.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.0.1 failed this metric
0.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
