capistrano-symfony 1.0.0 → 2.0.0.pre.alfa1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +97 -43
- data/UPGRADING-1.0.md +9 -0
- data/capistrano-symfony.gemspec +2 -2
- data/docs/maintainers.md +17 -0
- data/lib/capistrano/dsl/symfony.rb +0 -10
- data/lib/capistrano/symfony/defaults.rb +9 -14
- data/lib/capistrano/tasks/deploy.rake +1 -0
- data/lib/capistrano/tasks/symfony.rake +4 -19
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5eb750c01cbf21ad2515224a33dc05218075fa5704baa5ba4812923c88664ff
|
4
|
+
data.tar.gz: b2f05e7f388fc7e7478587ecafe9b3b3338f787a755d2ac835f9667da5d5d55b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9f0f6edbfff97b405d1171cf1979c7dc37cb8ac782c492da9f46b09603e08f57e409c7cd1186da1fd2b29ea575ad3ae70b20c107fd3e3652830ed7227318933
|
7
|
+
data.tar.gz: bd4c74fd174d1491aeb73c64bff92d10c7e0e68f63af998a9979ae7c3efa7f25b0ecffc7f4f176db88e6a0fb3fccdb37d2aac9e5ad3f84f900dd4b5039c05e5c
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,71 +1,102 @@
|
|
1
1
|
# Capistrano::Symfony
|
2
2
|
|
3
|
-
Symfony
|
3
|
+
Symfony 4 specific tasks for Capistrano v3 (inspired by [capifony][2]).
|
4
4
|
|
5
5
|
It leverages the following capistrano tasks to deploy a Symfony app
|
6
6
|
|
7
7
|
* https://github.com/capistrano/composer
|
8
8
|
* https://github.com/capistrano/file-permissions
|
9
9
|
|
10
|
+
## Version information
|
11
|
+
|
12
|
+
#### Version 1.x
|
13
|
+
|
14
|
+
This version is built for **Symfony 2 and 3**.
|
15
|
+
|
16
|
+
Go to [Version 1 documentation](/../../tree/1.x).
|
17
|
+
|
18
|
+
#### Version 2.x
|
19
|
+
|
20
|
+
This version is built for **Symfony 4**.
|
21
|
+
|
22
|
+
You are currently on the Version 2 branch.
|
23
|
+
|
10
24
|
## Installation
|
11
25
|
|
26
|
+
Specify your dependencies:
|
12
27
|
```
|
13
28
|
# Gemfile
|
14
|
-
|
15
|
-
gem 'capistrano
|
29
|
+
source 'https://rubygems.org'
|
30
|
+
gem 'capistrano', '~> 3.11'
|
31
|
+
gem 'capistrano-symfony', '~> 2.0.0-alfa1'
|
16
32
|
```
|
17
33
|
|
18
|
-
|
34
|
+
Install your dependencies:
|
35
|
+
```
|
36
|
+
bundle install
|
37
|
+
```
|
38
|
+
|
39
|
+
When `capistrano` and `capistrano-symfony` is installed. Run the following command
|
40
|
+
to set up your local files:
|
19
41
|
|
20
|
-
|
42
|
+
```
|
43
|
+
cap install
|
44
|
+
```
|
45
|
+
|
46
|
+
Make Capistrano aware of `'capistrano/symfony' by require capistrano-symfony in your
|
47
|
+
new Capfile
|
21
48
|
|
22
49
|
```
|
23
50
|
# Capfile
|
24
51
|
require 'capistrano/symfony'
|
52
|
+
|
53
|
+
# If you use composer you might want this:
|
54
|
+
require 'capistrano/composer'
|
25
55
|
```
|
26
56
|
|
57
|
+
## Usage
|
58
|
+
|
59
|
+
```
|
60
|
+
cap staging deploy
|
61
|
+
cap production deploy
|
62
|
+
```
|
27
63
|
|
28
64
|
### Settings
|
29
65
|
|
30
|
-
If you are using
|
66
|
+
If you are using a standard Symfony Flex application that follows the best practises
|
67
|
+
then you do not need to change/add anything to your `deploy.rb` other than what is
|
68
|
+
required from Capistrano.
|
31
69
|
|
32
|
-
We do however expose the following settings (shown with default evaluated values)
|
70
|
+
We do however expose the following settings (shown with default evaluated values)
|
71
|
+
that can be modified to suit your project. Please refer to `lib/capistrano/symfony/defaults.rb`
|
72
|
+
to see exactly how the defaults are set up.
|
33
73
|
|
34
74
|
|
35
75
|
```ruby
|
36
|
-
# Symfony console commands will use this environment for execution
|
37
|
-
set :symfony_env, "prod"
|
38
|
-
|
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
|
43
76
|
|
44
77
|
# symfony-standard edition directories
|
45
|
-
set :app_path, "app"
|
46
|
-
set :web_path, "web"
|
47
|
-
set :var_path, "var"
|
48
78
|
set :bin_path, "bin"
|
79
|
+
set :config_path, "config"
|
80
|
+
set :var_path, "var"
|
81
|
+
set :web_path, "public"
|
49
82
|
|
50
|
-
# The next
|
83
|
+
# The next settings are lazily evaluated from the above values, so take care
|
51
84
|
# when modifying them
|
52
|
-
set :
|
53
|
-
set :log_path, "var/logs"
|
85
|
+
set :log_path, "var/log"
|
54
86
|
set :cache_path, "var/cache"
|
55
87
|
|
56
88
|
set :symfony_console_path, "bin/console"
|
57
89
|
set :symfony_console_flags, "--no-debug"
|
58
90
|
|
59
|
-
# Remove app_dev.php during deployment, other files in web/ can be specified here
|
60
|
-
set :controllers_to_clear, ["app_*.php", "config.php"]
|
61
|
-
|
62
91
|
# asset management
|
63
|
-
set :assets_install_path, "
|
92
|
+
set :assets_install_path, "public"
|
64
93
|
set :assets_install_flags, '--symlink'
|
65
94
|
|
66
95
|
# Share files/directories between releases
|
67
|
-
set :linked_files, []
|
68
96
|
set :linked_dirs, ["var/logs"]
|
97
|
+
set :linked_files, []
|
98
|
+
# To use a .env file:
|
99
|
+
#set :linked_files, [".env"]
|
69
100
|
|
70
101
|
# Set correct permissions between releases, this is turned off by default
|
71
102
|
set :file_permissions_paths, ["var"]
|
@@ -73,19 +104,14 @@ set :permission_method, false
|
|
73
104
|
|
74
105
|
# Role filtering
|
75
106
|
set :symfony_roles, :all
|
76
|
-
|
77
|
-
|
78
|
-
#### Using this plugin with the old Symfony 2 directory structure and SensioDistributionBundle <= 4
|
79
|
-
|
80
|
-
Add the following to `deploy.rb` to use the old directory structure
|
107
|
+
set :symfony_deploy_roles, :all
|
81
108
|
|
109
|
+
# Add extra environment variables:
|
110
|
+
set :default_env, {
|
111
|
+
'APP_ENV' => 'prod'
|
112
|
+
'SECRET' => 'foobar'
|
113
|
+
}
|
82
114
|
```
|
83
|
-
# deploy.rb
|
84
|
-
set :symfony_directory_structure, 2
|
85
|
-
set :sensio_distribution_version, 4
|
86
|
-
```
|
87
|
-
|
88
|
-
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
|
89
115
|
|
90
116
|
### Flow
|
91
117
|
|
@@ -109,6 +135,7 @@ deploy
|
|
109
135
|
| |__ deploy:symlink:shared
|
110
136
|
| |__ symfony:create_cache_dir
|
111
137
|
| |__ symfony:set_permissions
|
138
|
+
| |__ symfony:make_console_executable
|
112
139
|
|__ deploy:updated
|
113
140
|
| |__ symfony:cache:warmup
|
114
141
|
| |__ symfony:clear_controllers
|
@@ -124,9 +151,12 @@ deploy
|
|
124
151
|
|
125
152
|
### File permissions
|
126
153
|
|
127
|
-
Set the `permission_method` variable to one of `:chmod`, `:acl`, or `:chgrp` in
|
154
|
+
Set the `permission_method` variable to one of `:chmod`, `:acl`, or `:chgrp` in
|
155
|
+
your `deploy.rb` to handle the common scenario of a web user and the deploy user
|
156
|
+
being different.
|
128
157
|
|
129
|
-
Both will need access to the files/directories such as `var/cache` and `
|
158
|
+
Both will need access to the files/directories such as `var/cache` and `public/uploads`
|
159
|
+
(if you handle uploads). Set `file_permissions_users` to your webserver user
|
130
160
|
|
131
161
|
Example:
|
132
162
|
|
@@ -135,19 +165,24 @@ Example:
|
|
135
165
|
|
136
166
|
set :permission_method, :acl
|
137
167
|
set :file_permissions_users, ["nginx"]
|
138
|
-
set :file_permissions_paths, ["var", "
|
168
|
+
set :file_permissions_paths, ["var", "public/uploads"]
|
139
169
|
```
|
140
170
|
|
141
|
-
|
171
|
+
**Note:** Using `:acl` requires that `setfacl` be available on your deployment target.
|
172
|
+
**Note:** If you are getting an error like `setfacl: Option -m: Invalid argument near character 3`,
|
173
|
+
it means that the users in `file_permissions_users` do not exist on your deployment
|
174
|
+
target.
|
175
|
+
|
176
|
+
|
142
177
|
|
143
|
-
See [the symfony documentation](http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup)
|
178
|
+
See [the symfony documentation](http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup)
|
179
|
+
and [the file permission capistrano plugin](https://github.com/capistrano/file-permissions) for reference.
|
144
180
|
|
145
181
|
### Integrated common tasks
|
146
182
|
|
147
183
|
The following common tasks are available:
|
148
184
|
|
149
185
|
* `symfony:assets:install`
|
150
|
-
* `symfony:build_bootstrap` - useful if you disable composer
|
151
186
|
|
152
187
|
So you can use them with hooks in your project's `deploy.rb` like this:
|
153
188
|
|
@@ -172,7 +207,8 @@ namespace :deploy do
|
|
172
207
|
end
|
173
208
|
```
|
174
209
|
|
175
|
-
If you want to execute a command on a host with a given role you can use the Capistrano
|
210
|
+
If you want to execute a command on a host with a given role you can use the Capistrano
|
211
|
+
`on` DSL, additionally using `within` from Capistrano will change the directory
|
176
212
|
|
177
213
|
```ruby
|
178
214
|
namespace :deploy do
|
@@ -184,6 +220,24 @@ namespace :deploy do
|
|
184
220
|
end
|
185
221
|
```
|
186
222
|
|
223
|
+
### Using composer
|
224
|
+
|
225
|
+
If you use composer, make sure your Capfile includes:
|
226
|
+
|
227
|
+
```
|
228
|
+
require 'capistrano/composer'
|
229
|
+
```
|
230
|
+
|
231
|
+
To download the composer executable add the following to your `deploy.rb`:
|
232
|
+
|
233
|
+
```
|
234
|
+
# First define deploy target:
|
235
|
+
set :deploy_to, "/home/sites/com.example"
|
236
|
+
|
237
|
+
# Install composer if it does not exist
|
238
|
+
SSHKit.config.command_map[:composer] = "php #{shared_path.join("composer.phar")}"
|
239
|
+
```
|
240
|
+
|
187
241
|
[1]: http://capistranorb.com/documentation/getting-started/flow/
|
188
242
|
[2]: http://capifony.org/
|
189
243
|
[3]: http://symfony.com/doc/current/bundles/DoctrineMigrationsBundle/index.html
|
data/UPGRADING-1.0.md
ADDED
data/capistrano-symfony.gemspec
CHANGED
@@ -4,11 +4,11 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = "capistrano-symfony"
|
7
|
-
gem.version = '
|
7
|
+
gem.version = '2.0.0-alfa1'
|
8
8
|
gem.authors = ["Peter Mitchell"]
|
9
9
|
gem.email = ["pete@peterjmit.com"]
|
10
10
|
gem.description = %q{Symfony specific Capistrano tasks}
|
11
|
-
gem.summary = %q{Capistrano Symfony - Easy deployment of Symfony
|
11
|
+
gem.summary = %q{Capistrano Symfony - Easy deployment of Symfony 4 apps with Ruby over SSH}
|
12
12
|
gem.homepage = "http://github.com/capistrano/capistrano-symfony"
|
13
13
|
|
14
14
|
gem.files = `git ls-files`.split($/)
|
data/docs/maintainers.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Documentation for maintainers
|
2
|
+
|
3
|
+
Since this is a Ruby tool used by PHP programmers it might be a good idea to document
|
4
|
+
some things.
|
5
|
+
|
6
|
+
|
7
|
+
## Making a release
|
8
|
+
|
9
|
+
Checklist for making a release:
|
10
|
+
|
11
|
+
- Write changelog
|
12
|
+
- Update version number in `capistrano-symfony.gemspec`
|
13
|
+
- Make a new release with GitHub
|
14
|
+
- Build the gem with `gem build capistrano-symfony.gemspec`
|
15
|
+
- Push the gem to rubygems.org: `gem push capistrano-symfony-X.X.X.gem`
|
16
|
+
- Add the `capistrano-symfony-X.X.X.gem` to the GitHub release
|
17
|
+
|
@@ -38,16 +38,6 @@ module Capistrano
|
|
38
38
|
release_path.join('vendor')
|
39
39
|
end
|
40
40
|
|
41
|
-
def build_bootstrap_path
|
42
|
-
bootstrap_path = symfony_vendor_path.join("sensio/distribution-bundle")
|
43
|
-
|
44
|
-
if fetch(:sensio_distribution_version).to_i <= 4
|
45
|
-
bootstrap_path = bootstrap_path.join("Sensio/Bundle/DistributionBundle")
|
46
|
-
end
|
47
|
-
|
48
|
-
bootstrap_path.join("Resources/bin/build_bootstrap.php")
|
49
|
-
end
|
50
|
-
|
51
41
|
def symfony_console(command, params = '')
|
52
42
|
execute :php, symfony_console_path, command, params, fetch(:symfony_console_flags)
|
53
43
|
end
|
@@ -3,27 +3,21 @@
|
|
3
3
|
#
|
4
4
|
set :symfony_env, "prod"
|
5
5
|
|
6
|
-
set :symfony_directory_structure, 3
|
7
|
-
set :sensio_distribution_version, 5
|
8
|
-
|
9
6
|
# symfony-standard edition top-level directories
|
10
|
-
set :app_path, "app"
|
11
|
-
set :web_path, "web"
|
12
|
-
set :var_path, "var"
|
13
7
|
set :bin_path, "bin"
|
8
|
+
set :config_path, "config"
|
9
|
+
set :var_path, "var"
|
10
|
+
set :web_path, "public"
|
14
11
|
|
15
12
|
# Use closures for directories nested under the top level dirs, so that
|
16
13
|
# any changes to web/app etc do not require these to be changed also
|
17
|
-
set :
|
18
|
-
set :
|
19
|
-
set :cache_path, -> { fetch(:symfony_directory_structure) == 2 ? fetch(:app_path) + "/cache" : fetch(:var_path) + "/cache" }
|
14
|
+
set :log_path, -> { fetch(:var_path) + "/log" }
|
15
|
+
set :cache_path, -> { fetch(:var_path) + "/cache" }
|
20
16
|
|
21
17
|
# console
|
22
|
-
set :symfony_console_path, -> { fetch(:
|
18
|
+
set :symfony_console_path, -> { fetch(:bin_path) + "/console" }
|
23
19
|
set :symfony_console_flags, "--no-debug"
|
24
20
|
|
25
|
-
set :controllers_to_clear, ["app_*.php", "config.php"]
|
26
|
-
|
27
21
|
# assets
|
28
22
|
set :assets_install_path, fetch(:web_path)
|
29
23
|
set :assets_install_flags, '--symlink'
|
@@ -31,15 +25,16 @@ set :assets_install_flags, '--symlink'
|
|
31
25
|
#
|
32
26
|
# Capistrano defaults
|
33
27
|
#
|
34
|
-
set :linked_files, -> { [
|
28
|
+
set :linked_files, -> { [".env"] }
|
35
29
|
set :linked_dirs, -> { [fetch(:log_path)] }
|
36
30
|
|
37
31
|
#
|
38
32
|
# Configure capistrano/file-permissions defaults
|
39
33
|
#
|
40
|
-
set :file_permissions_paths, -> {
|
34
|
+
set :file_permissions_paths, -> { [fetch(:var_path)] }
|
41
35
|
# Method used to set permissions (:chmod, :acl, or :chown)
|
42
36
|
set :permission_method, false
|
43
37
|
|
44
38
|
# Role filtering
|
45
39
|
set :symfony_roles, :all
|
40
|
+
set :symfony_deploy_roles, :all
|
@@ -64,29 +64,14 @@ namespace :symfony do
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
desc "
|
68
|
-
task :
|
69
|
-
next unless any? :controllers_to_clear
|
67
|
+
desc "Make symfony_console_path executable"
|
68
|
+
task :make_console_executable do
|
70
69
|
on release_roles(fetch(:symfony_deploy_roles)) do
|
71
|
-
|
72
|
-
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
desc "Build the bootstrap file"
|
78
|
-
task :build_bootstrap do
|
79
|
-
on release_roles(fetch(:symfony_deploy_roles)) do
|
80
|
-
within release_path do
|
81
|
-
if fetch(:symfony_directory_structure) == 2
|
82
|
-
execute :php, build_bootstrap_path, fetch(:app_path)
|
83
|
-
else
|
84
|
-
execute :php, build_bootstrap_path, fetch(:var_path)
|
70
|
+
within release_path do
|
71
|
+
execute :chmod, "755", fetch(:symfony_console_path)
|
85
72
|
end
|
86
73
|
end
|
87
|
-
end
|
88
74
|
end
|
89
|
-
|
90
75
|
end
|
91
76
|
|
92
77
|
task :symfony => ["symfony:console"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-symfony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.pre.alfa1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Mitchell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -63,7 +63,9 @@ files:
|
|
63
63
|
- CHANGELOG.md
|
64
64
|
- LICENCE.txt
|
65
65
|
- README.md
|
66
|
+
- UPGRADING-1.0.md
|
66
67
|
- capistrano-symfony.gemspec
|
68
|
+
- docs/maintainers.md
|
67
69
|
- lib/capistrano-symfony.rb
|
68
70
|
- lib/capistrano/dsl/symfony.rb
|
69
71
|
- lib/capistrano/symfony.rb
|
@@ -96,14 +98,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
98
|
version: '0'
|
97
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
100
|
requirements:
|
99
|
-
- - "
|
101
|
+
- - ">"
|
100
102
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
103
|
+
version: 1.3.1
|
102
104
|
requirements: []
|
103
105
|
rubyforge_project:
|
104
106
|
rubygems_version: 2.7.6
|
105
107
|
signing_key:
|
106
108
|
specification_version: 4
|
107
|
-
summary: Capistrano Symfony - Easy deployment of Symfony
|
108
|
-
SSH
|
109
|
+
summary: Capistrano Symfony - Easy deployment of Symfony 4 apps with Ruby over SSH
|
109
110
|
test_files: []
|