You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -25,79 +24,74 @@ Require capistrano-symfony in your cap file
25
24
require 'capistrano/symfony'
26
25
```
27
26
27
+
28
28
### Settings
29
29
30
-
capistrano-symfony exposes the following settings (displayed with defaults):
30
+
If you are using an un-modified symfony-standard edition, version 3 then you do not need to change/add anything to your `deploy.rb` other than what is required from Capistrano.
31
+
32
+
We do however expose the following settings (shown with default evaluated values) that can be modified to suit your project. Please refer to `lib/capistrano/symfony/defaults.rb` to see exactly how the defaults are set up.
33
+
31
34
32
35
```ruby
33
-
# Symfony environment
36
+
# Symfony console commands will use this environment for execution
34
37
set :symfony_env, "prod"
35
38
36
-
# Symfony application path
37
-
set :app_path, "app"
38
-
39
-
# Symfony web path
40
-
set :web_path, "web"
39
+
# Set this to 2 for the old directory structure
40
+
set :symfony_directory_structure, 3
41
+
# Set this to 4 if using the older SensioDistributionBundle
42
+
set :sensio_distribution_version, 5
41
43
42
-
# Symfony log path
43
-
set :log_path, fetch(:app_path) +"/logs"
44
+
# symfony-standard edition directories
45
+
set :app_path, "app"
46
+
set :web_path, "web"
47
+
set :var_path, "var"
48
+
set :bin_path, "bin"
44
49
45
-
# Symfony cache path
46
-
set :cache_path, fetch(:app_path) +"/cache"
50
+
# The next 3 settings are lazily evaluated from the above values, so take care
51
+
# when modifying them
52
+
set :app_config_path, "app/config"
53
+
set :log_path, "var/logs"
54
+
set :cache_path, "var/cache"
47
55
48
-
# Symfony config file path
49
-
set :app_config_path, fetch(:app_path) +"/config"
56
+
set :symfony_console_path, "bin/console"
57
+
set :symfony_console_flags, "--no-debug"
50
58
51
-
#Controllers to clear
59
+
#Remove app_dev.php during deployment, other files in web/ can be specified here
52
60
set :controllers_to_clear, ["app_*.php"]
53
61
54
-
# Files that need to remain the same between deploys
55
-
set :linked_files, []
56
-
57
-
# Dirs that need to remain the same between deploys (shared dirs)
58
-
set :linked_dirs, [fetch(:log_path), fetch(:web_path) +"/uploads"]
59
-
60
-
# Dirs that need to be writable by the HTTP Server (i.e. cache, log dirs)
61
-
set :file_permissions_paths, [fetch(:log_path), fetch(:cache_path)]
62
-
63
-
# Name used by the Web Server (i.e. www-data for Apache)
64
-
set :file_permissions_users, ['www-data']
65
-
66
-
# Name used by the Web Server (i.e. www-data for Apache)
67
-
set :webserver_user, "www-data"
68
-
69
-
# Method used to set permissions (:chmod, :acl, or :chgrp)
70
-
set :permission_method, false
71
-
72
-
# Execute set permissions
73
-
set :use_set_permissions, false
74
-
75
-
# Symfony console path
76
-
set :symfony_console_path, fetch(:app_path) +"/console"
62
+
# asset management
63
+
set :assets_install_path, "web"
64
+
set :assets_install_flags, '--symlink'
77
65
78
-
# Symfony console flags
79
-
set :symfony_console_flags, "--no-debug"
66
+
# Share files/directories between releases
67
+
set :linked_files, []
68
+
set :linked_dirs, ["var/logs"]
80
69
81
-
# Assets install path
82
-
set :assets_install_path, fetch(:web_path)
70
+
# Set correct permissions between releases, this is turned off by default
71
+
set :file_permissions_paths, ["var"]
72
+
set :permission_method, false
73
+
```
83
74
84
-
# Assets install flags
85
-
set :assets_install_flags, '--symlink'
75
+
#### Using this plugin with the old Symfony 2 directory structure and SensioDistributionBundle <= 4
86
76
87
-
# Assetic dump flags
88
-
set :assetic_dump_flags, ''
77
+
Add the following to `deploy.rb` to use the old directory structure
If you are upgrading this gem and have modified `linked_dirs` or "advanced" variables such as `log_path` then you will need to update those accordingly
86
+
93
87
### Flow
94
88
95
89
capistrano-symfony hooks into the [flow][1] offered by capistrano. It adds to that flow like so
96
90
97
-
*```symfony:create_cache_dir```
98
-
*```symfony:set_permissions```
99
-
*```symfony:cache:warmup```
100
-
*```symfony:clear_controllers```
91
+
*`symfony:create_cache_dir`
92
+
*`symfony:set_permissions`
93
+
*`symfony:cache:warmup`
94
+
*`symfony:clear_controllers`
101
95
102
96
```
103
97
deploy
@@ -125,16 +119,38 @@ deploy
125
119
|__ deploy:log_revision
126
120
```
127
121
122
+
### File permissions
123
+
124
+
Set the `permission_method` variable to one of `:chmod`, `:acl`, or `:chgrp` in your `deploy.rb` to handle the common scenario of a web user and the deploy user being different.
125
+
126
+
Both will need access to the files/directories such as `var/cache` and `web/uploads` (if you handle uploads). Set `file_permissions_users` to your webserver user
127
+
128
+
Example:
129
+
130
+
```
131
+
# deploy.rb
132
+
133
+
set :permission_method, :acl
134
+
set :file_permissions_users, ["nginx"]
135
+
set :file_permissions_paths, ["var", "web/uploads"]
136
+
```
137
+
138
+
Please note that `:acl` requires that `setfacl` be available on your deployment target
139
+
140
+
See [the symfony documentation](http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup) and [the file permission capistrano plugin](https://github.com/capistrano/file-permissions) for reference
141
+
128
142
### Integrated common tasks
129
143
130
-
The folowing common tasks are already integrated:
131
-
*```symfony:assets:install```
132
-
*```symfony:assetic:dump```
144
+
The following common tasks are available:
145
+
146
+
*`symfony:assets:install`
147
+
*`symfony:build_bootstrap` - useful if you disable composer
148
+
149
+
So you can use them with hooks in your project's `deploy.rb` like this:
133
150
134
-
So you can use them with hooks like this:
135
151
```ruby
136
-
after 'deploy:updated','symfony:assets:install'
137
-
after 'deploy:updated', 'symfony:assetic:dump'
152
+
after 'deploy:updated', 'symfony:assets:install'
153
+
before 'deploy:updated', 'symfony:build_bootstrap'
138
154
```
139
155
140
156
### Using the Symfony console
@@ -148,17 +164,19 @@ project you may want to run migrations during a deploy.
You can also apply role filter on your commands by passing a fourth parameter.
172
+
If you want to execute a command on a host with a given role you can use the Capistrano `on` DSL, additionally using `within` from Capistrano will change the directory
0 commit comments