capistrano-magento2 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c26fa9d5aee2efa6058343f4778e782cf3bd819
4
- data.tar.gz: 9b0df9b6a112a8d1426bb6d952d5e88bde7720b0
3
+ metadata.gz: 56be092a97722587efac46aebf7fe0c433f4681b
4
+ data.tar.gz: f486eee26dd968fe28b18ea5b64b9e064096f1c6
5
5
  SHA512:
6
- metadata.gz: 3fbce42ba76649f409114fabe570d5c5403feb556e031d08a7d002c76f2d21e1e47a2b74e4d00f51b7d479312e67ca5d9aeabde739d5a1b8c6c0bc43b40821c6
7
- data.tar.gz: ae50da8be58fc6e35c8b11a0b62615897c13bc2d6cd9af178da4ceffaaece366e076b06895f3d61f8dc38f9a93c65aa68a96be177c5262b88bb338cf82e82c3d
6
+ metadata.gz: a6b0af5bb4454fe107d68bbf910d5bce2ca8af0b346f00a273bd615a331cefdeccc34624da09c11f3f61c4bed958300b7d825de2291df944566ffba4c7741a7f
7
+ data.tar.gz: 4e14ee33a8b6f3569ba0eaa7bd24a3af5c6dcbe7d3818d7890c0ce9b7a80aadcaf0dd30763aa77425e9365fba6c6cdc0c1dd64f980bd483e61f8c0ac7df75f5b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Capistrano::Magento2 Change Log
2
2
 
3
+ ==========
4
+ 0.2.1
5
+
6
+ * Fixed issue with initial deploy failing before 'current' link has been created on target
7
+
3
8
  0.2.0
4
9
  ==========
5
10
 
data/README.md CHANGED
@@ -6,76 +6,158 @@ A Capistrano extension for Magento 2 deployments. Takes care of specific Magento
6
6
 
7
7
  ## Installation
8
8
 
9
- Add this line to your application's Gemfile:
9
+ ### Standalone Installation
10
10
 
11
- ```ruby
12
- gem 'capistrano-magento2'
13
- ```
11
+ $ gem install capistrano-magento2
14
12
 
15
- And then execute:
13
+ ### Using Bundler
16
14
 
17
- $ bundle
15
+ 1. Add the following to your project's `Gemfile`:
18
16
 
19
- Or install it yourself as:
17
+ ```ruby
18
+ source 'https://rubygems.org'
19
+ gem 'capistrano-magento2'
20
+ ```
20
21
 
21
- $ gem install capistrano-magento2
22
+ 2. Execute the following:
23
+
24
+ $ bundle install
22
25
 
23
26
  ## Usage
24
27
 
25
- Install Capistrano in your Magento project:
28
+ 1. Install Capistrano in your Magento project:
29
+
30
+ ```shell
31
+ $ cd <project_root>
32
+ $ mkdir -p tools/cap
33
+ $ cd ./tools/cap
34
+ $ cap install
35
+ ```
36
+ _Note: By default, Capistrano creates "staging" and "production" stages. If you want to define custom staging areas, you can do so using the "STAGES" option (e.g. `cap install STAGES=stage,prod`). Built-in notifications ([see below](#terminal-notifier-on-os-x)) confirm deploy action on both "production" and "prod" area names by default._
37
+
38
+ 2. Update your project's `Capfile` to look like the following:
39
+
40
+ ```ruby
41
+ # Load DSL and set up stages
42
+ require 'capistrano/setup'
43
+
44
+ # Load Magento deployment tasks
45
+ require 'capistrano/magento2/deploy'
46
+
47
+ # Load custom tasks from `lib/capistrano/tasks` if you have any defined
48
+ Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
49
+ ```
26
50
 
27
- ```shell
28
- $ cd <project_root>
29
- $ mkdir -p tools/cap
30
- $ cd ./tools/cap
31
- $ cap install
32
- ```
51
+ 3. Configure Capistrano, per the [Capistrano Configuration](#capistrano-configuration) section below.
33
52
 
34
- Update your project `Capfile` to look like the following:
53
+ 4. Configure your server(s), per the [Server Configuration](#server-configuration) section below.
35
54
 
36
- ```ruby
37
- # Load DSL and set up stages
38
- require 'capistrano/setup'
55
+ 5. Deploy Magento 2 to staging or production by running the following command in the `tools/cap` directory:
56
+
57
+ ```shell
58
+ $ cap staging deploy
59
+ ```
60
+ or
61
+ ```shell
62
+ $ cap production deploy
63
+ ```
64
+
65
+ ## Default Configuration
39
66
 
40
- # Load Magento deployment tasks
41
- require 'capistrano/magento2/deploy'
42
- ```
67
+ ### Capistrano Configuration
43
68
 
44
- ## Default Configuration
69
+ Before you can use Capistrano to deploy, you must configure the `config/deploy.rb` and `config/deploy/*.rb` files. This section will cover the basic details for configuring these files. Refer to the [Capistrano documentation](http://capistranorb.com/documentation/getting-started/preparing-your-application/#configure-your-server-addresses-in-the-generated-files) and [README](https://github.com/capistrano/capistrano/blob/master/README.md) for more details.
70
+
71
+ 1. Configuring `config/deploy.rb`
72
+
73
+ Update the `:application` and `:repo_url` values in `config/deploy.rb`:
74
+
75
+ ```ruby
76
+ # Something unique such as the website or company name
77
+ set :application, 'example'
78
+ # The repository that hosts the Magento 2 application (Magento should live in the root of the repo)
79
+ set :repo_url, 'git@github.com:acme/example-com.git'
80
+ ```
81
+
82
+ 2. Configuring `config/deploy/*.rb` files
83
+
84
+ Capistrano allows you to use server-based or role-based syntax. You can read through the comments in the file to learn more about each option. If you have a single application server then the server-based syntax is the simplest configuration option.
85
+
86
+ * Single application server
87
+
88
+ If your stage and production environments consist of a single application server, your configuration files should look something like this:
89
+
90
+ `config/deploy/production.rb`
91
+ ```ruby
92
+ server 'www.example.com', user: 'www-data', roles: %w{app db web}
93
+
94
+ set :deploy_to, '/var/www/html'
95
+ set :branch, proc { `git rev-parse --abbrev-ref master`.chomp }
96
+ ```
97
+
98
+ `config/deploy/staging.rb`
99
+ ```ruby
100
+ server 'stage.example.com', user: 'www-data', roles: %w{app db web}
101
+
102
+ set :deploy_to, '/var/www/html'
103
+ set :branch, proc { `git rev-parse --abbrev-ref develop`.chomp }
104
+ ```
105
+
106
+ * Multiple application servers
107
+
108
+ Refer to the "role-based syntax" comments in the `config/deploy/*.rb` files or to the [Capistrano documentation](http://capistranorb.com/documentation/getting-started/preparing-your-application/#configure-your-server-addresses-in-the-generated-files) for details on how to configure multiple application servers.
45
109
 
46
110
  ### Capistrano Built-Ins
47
111
 
48
112
  For the sake of simplicity in new project setups `:linked_dirs` and `:linked_files` are pre-configured per the following.
49
113
 
50
114
  ```ruby
51
- set :linked_files, [
52
- 'app/etc/env.php',
53
- 'var/.setup_cronjob_status',
54
- 'var/.update_cronjob_status',
55
- 'sitemap.xml'
56
- ]
57
-
58
- set :linked_dirs, [
59
- 'pub/media',
60
- 'var/backups',
61
- 'var/composer_home',
62
- 'var/importexport',
63
- 'var/import_history',
64
- 'var/log',
65
- 'var/session',
66
- 'var/tmp'
67
- ]
115
+ set :linked_files, [
116
+ 'app/etc/env.php',
117
+ 'var/.setup_cronjob_status',
118
+ 'var/.update_cronjob_status',
119
+ 'sitemap.xml'
120
+ ]
121
+
122
+ set :linked_dirs, [
123
+ 'pub/media',
124
+ 'var/backups',
125
+ 'var/composer_home',
126
+ 'var/importexport',
127
+ 'var/import_history',
128
+ 'var/log',
129
+ 'var/session',
130
+ 'var/tmp'
131
+ ]
68
132
  ```
69
133
 
134
+ If you would like to customize the linked files or directories for your project, you can copy either one or both of the above arrays into the `config/deploy.rb` or `config/deploy/*.rb` files and tweak them to fit your project's needs.
135
+
70
136
  ### Magento 2 Deploy Routine
71
137
 
72
- A pre-built deploy routine is available out-of-the-box. This can be overriden on a per-project basis by including only the Magento 2 specific tasks and defining your own `deploy.rake` file under `lib/capistrano/tasks` in your projects capistrano install location.
138
+ A pre-built deploy routine is available out-of-the-box. This can be overriden on a per-project basis by including only the Magento 2 specific tasks and defining your own `deploy.rake` file under `lib/capistrano/tasks` in your projects Capistrano install location.
73
139
 
74
140
  To see what process the built-in routine runs, take a look at the included rake file here: https://github.com/davidalger/capistrano-magento2/blob/master/lib/capistrano/tasks/deploy.rake
75
141
 
142
+ ## Server Configuration
143
+
144
+ ### Web Server Root Path
145
+
146
+ Before deploying with Capistrano, you must update each of your web servers to point to a `current` directory inside of the `:deploy_to` directory. For example: `/var/www/html/current` Refer to the [Capistrano Structure](http://capistranorb.com/documentation/getting-started/structure/) to learn more about Capistrano's folder structure.
147
+
148
+ ### Create Linked Files
149
+
150
+ Capistrano assumes that the `:linked_files` files will exist, so before you deploy for the first time, you need to create those files. On each of your web servers, create them using a command like this:
151
+
152
+ ```shell
153
+ $ cd /var/www/html
154
+ $ mkdir -p shared/var shared/app/etc
155
+ $ touch shared/app/etc/env.php shared/var/.setup_cronjob_status shared/var/.update_cronjob_status shared/sitemap.xml
156
+ ```
157
+
76
158
  ## Magento Specific Tasks
77
159
 
78
- All Magento 2 tasks used by the built-in `deploy.rake` file as well as some additional commands are implimented and exposed to the end-user for use directly via the cap tool. You can also see this list by running `cap -T` from your shell.
160
+ All Magento 2 tasks used by the built-in `deploy.rake` file as well as some additional commands are implemented and exposed to the end-user for use directly via the cap tool. You can also see this list by running `cap -T` from your shell.
79
161
 
80
162
  | cap command | what it does |
81
163
  | ------------------------------------- | -------------------------------------------------- |
@@ -100,10 +182,6 @@ All Magento 2 tasks used by the built-in `deploy.rake` file as well as some addi
100
182
  | magento:setup:static-content:deploy | Deploys static view files |
101
183
  | magento:setup:upgrade | Run the Magento upgrade process |
102
184
 
103
- ## Using Capistrano
104
-
105
- For inrformation on how to use Capistrano and setup deployment take a look at the [Capistrano documentation](http://capistranorb.com) and [README](https://github.com/capistrano/capistrano/blob/master/README.md) file.
106
-
107
185
  ## Terminal Notifier on OS X
108
186
  This gem specifies [terminal-notifier](https://rubygems.org/gems/terminal-notifier) as a dependency in order to support notifications on OS X via an optional include. To use the built-in notifications, add the following line to your `Capfile`:
109
187
 
@@ -113,7 +191,7 @@ require 'capistrano/magento2/notifier'
113
191
 
114
192
  ## Development
115
193
 
116
- After checking out the repo, run `bundle install` to install dependencies. Make the neccesary changes, then run `bundle exec rake install` to install a modified version of the gem on your local system.
194
+ After checking out the repo, run `bundle install` to install dependencies. Make the necessary changes, then run `bundle exec rake install` to install a modified version of the gem on your local system.
117
195
 
118
196
  To release a new version, update the version number in `capistrano/magento2/version.rb`, merge all changes to master, and then run `bundle exec rake release`. This will create a git tag for the version (the tag will apply to the current HEAD), push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
119
197
 
@@ -9,6 +9,6 @@
9
9
 
10
10
  module Capistrano
11
11
  module Magento2
12
- VERSION = '0.2.0'
12
+ VERSION = '0.2.1'
13
13
  end
14
14
  end
@@ -15,8 +15,10 @@ namespace :deploy do
15
15
  invoke 'magento:setup:static-content:deploy'
16
16
  invoke 'magento:setup:di:compile'
17
17
  invoke 'magento:setup:permissions'
18
- within current_path do
19
- execute :magento, 'maintenance:enable'
18
+ if test '-d #{current_path}'
19
+ within current_path do
20
+ execute :magento, 'maintenance:enable'
21
+ end
20
22
  end
21
23
  invoke 'magento:maintenance:enable'
22
24
  invoke 'magento:setup:upgrade'
@@ -26,7 +28,7 @@ namespace :deploy do
26
28
  task :published do
27
29
  on release_roles :all do
28
30
  invoke 'magento:cache:flush'
29
- invoke 'magento:cache:varnish:ban' # TODO: this should not be needed after magento/magento2#3339 is released
31
+ invoke 'magento:cache:varnish:ban' # TODO: This invocation should not be needed post magento/magento2#3339
30
32
  invoke 'magento:maintenance:disable'
31
33
  end
32
34
  end
@@ -35,7 +37,7 @@ namespace :deploy do
35
37
  on release_roles :all do
36
38
  invoke 'magento:maintenance:disable'
37
39
  invoke 'magento:cache:flush'
38
- invoke 'magento:cache:varnish:ban'
40
+ invoke 'magento:cache:varnish:ban' # TODO: This invocation should not be needed post magento/magento2#3339
39
41
  end
40
42
  end
41
43
  end
@@ -56,6 +56,7 @@ namespace :magento do
56
56
  end
57
57
 
58
58
  namespace :varnish do
59
+ # TODO: Document what the magento:cache:varnish:ban task is for and how to use it. See also magento/magento2#4106
59
60
  desc 'Add ban to Varnish for url(s)'
60
61
  task :ban do
61
62
  on release_roles :all do
@@ -42,6 +42,7 @@ end
42
42
 
43
43
  namespace :load do
44
44
  task :defaults do
45
+ # TODO: Document the :deploy_warn_stages option
45
46
  set :deploy_warn_stages, fetch(:deploy_warn_stages, []).push('prod', 'production')
46
47
  end
47
48
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-magento2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Alger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-27 00:00:00.000000000 Z
11
+ date: 2016-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano