capistrano-exts 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,10 +23,30 @@ set :branch, "master"
23
23
  set :use_sudo, false
24
24
 
25
25
  # Define deployments options
26
- set :deploy_to, "/home/vhosts/#{application}"
26
+ # NOTE: Do not use current_path here but use latest_release instead.
27
+ set :deploy_to, -> { "/home/vhosts/#{fetch :stage}/#{fetch :application}" }
28
+ set :logs_path, -> { "#{fetch :deploy_to}/logs" }
29
+ set :public_path, -> { "#{fetch :latest_release}/public" }
30
+
31
+ # How should we deploy?
32
+ # Valid options:
33
+ # => checkout: this deployment strategy does an SCM checkout on each target
34
+ # host. This is the default deployment strategy for Capistrano.
35
+ #
36
+ # => copy: this deployment strategy work by preparing the source code locally,
37
+ # compressing it, copying the file to each target host, and
38
+ # uncompressing it to the deployment directory.
39
+ # NOTE: This strategy has more options you can configure, please refer
40
+ # to capistrano/recipes/deploy/strategy/copy.rb (in capistrano)
41
+ # source or documentation for more information
42
+ #
43
+ # => export: this deployment strategy does an SCM export on each target host.
44
+ #
45
+ # => remote_cache: this deployment strategy keeps a cached checkout of the
46
+ # source code on each remote server. Each deploy simply updates
47
+ # the cached checkout, and then does a copy from the cached
48
+ # copy to the final deployment location.
27
49
  set :deploy_via, :remote_cache
28
- set :logs_path, "#{deploy_to}/logs"
29
- set :public_path, -> { "#{current_path}/public" }
30
50
 
31
51
  # Keep only the last 5 releases
32
52
  set :keep_releases, 5
@@ -149,5 +169,19 @@ set :php_fpm_port, '9000'
149
169
  # => What is the path to the socket file
150
170
  # set :reverse_proxy_socket, -> { "#{shared_path}/sockets/unicorn.sock"}
151
171
 
172
+ #
173
+ #
174
+ #############
175
+
176
+ #############
177
+ # Contao
178
+ #
179
+
180
+ # Where do you store contao contents ?
181
+ # The contents are stored in the shared path because they are uploaded from
182
+ # contao's admin section
183
+ set :contents_path, -> { "#{fetch :public_path}/tl_files/contents"}
184
+
185
+ #
152
186
  #
153
187
  #############
@@ -23,10 +23,30 @@ set :branch, "production"
23
23
  set :use_sudo, false
24
24
 
25
25
  # Define deployments options
26
- set :deploy_to, "/home/vhosts/#{application}"
26
+ # NOTE: Do not use current_path here but use latest_release instead.
27
+ set :deploy_to, -> { "/home/vhosts/#{fetch :stage}/#{fetch :application}" }
28
+ set :logs_path, -> { "#{fetch :deploy_to}/logs" }
29
+ set :public_path, -> { "#{fetch :latest_release}/public" }
30
+
31
+ # How should we deploy?
32
+ # Valid options:
33
+ # => checkout: this deployment strategy does an SCM checkout on each target
34
+ # host. This is the default deployment strategy for Capistrano.
35
+ #
36
+ # => copy: this deployment strategy work by preparing the source code locally,
37
+ # compressing it, copying the file to each target host, and
38
+ # uncompressing it to the deployment directory.
39
+ # NOTE: This strategy has more options you can configure, please refer
40
+ # to capistrano/recipes/deploy/strategy/copy.rb (in capistrano)
41
+ # source or documentation for more information
42
+ #
43
+ # => export: this deployment strategy does an SCM export on each target host.
44
+ #
45
+ # => remote_cache: this deployment strategy keeps a cached checkout of the
46
+ # source code on each remote server. Each deploy simply updates
47
+ # the cached checkout, and then does a copy from the cached
48
+ # copy to the final deployment location.
27
49
  set :deploy_via, :remote_cache
28
- set :logs_path, "#{deploy_to}/logs"
29
- set :public_path, -> { "#{current_path}/public" }
30
50
 
31
51
  # Keep only the last 5 releases
32
52
  set :keep_releases, 5
@@ -149,5 +169,19 @@ set :php_fpm_port, '9000'
149
169
  # => What is the path to the socket file
150
170
  # set :reverse_proxy_socket, -> { "#{shared_path}/sockets/unicorn.sock"}
151
171
 
172
+ #
173
+ #
174
+ #############
175
+
176
+ #############
177
+ # Contao
178
+ #
179
+
180
+ # Where do you store contao contents ?
181
+ # The contents are stored in the shared path because they are uploaded from
182
+ # contao's admin section
183
+ set :contents_path, -> { "#{fetch :public_path}/tl_files/contents"}
184
+
185
+ #
152
186
  #
153
187
  #############
@@ -23,10 +23,30 @@ set :branch, "staging"
23
23
  set :use_sudo, false
24
24
 
25
25
  # Define deployments options
26
- set :deploy_to, "/home/vhosts/#{application}"
26
+ # NOTE: Do not use current_path here but use latest_release instead.
27
+ set :deploy_to, -> { "/home/vhosts/#{fetch :stage}/#{fetch :application}" }
28
+ set :logs_path, -> { "#{fetch :deploy_to}/logs" }
29
+ set :public_path, -> { "#{fetch :latest_release}/public" }
30
+
31
+ # How should we deploy?
32
+ # Valid options:
33
+ # => checkout: this deployment strategy does an SCM checkout on each target
34
+ # host. This is the default deployment strategy for Capistrano.
35
+ #
36
+ # => copy: this deployment strategy work by preparing the source code locally,
37
+ # compressing it, copying the file to each target host, and
38
+ # uncompressing it to the deployment directory.
39
+ # NOTE: This strategy has more options you can configure, please refer
40
+ # to capistrano/recipes/deploy/strategy/copy.rb (in capistrano)
41
+ # source or documentation for more information
42
+ #
43
+ # => export: this deployment strategy does an SCM export on each target host.
44
+ #
45
+ # => remote_cache: this deployment strategy keeps a cached checkout of the
46
+ # source code on each remote server. Each deploy simply updates
47
+ # the cached checkout, and then does a copy from the cached
48
+ # copy to the final deployment location.
27
49
  set :deploy_via, :remote_cache
28
- set :logs_path, "#{deploy_to}/logs"
29
- set :public_path, -> { "#{current_path}/public" }
30
50
 
31
51
  # Keep only the last 5 releases
32
52
  set :keep_releases, 5
@@ -149,5 +169,19 @@ set :php_fpm_port, '9000'
149
169
  # => What is the path to the socket file
150
170
  # set :reverse_proxy_socket, -> { "#{shared_path}/sockets/unicorn.sock"}
151
171
 
172
+ #
173
+ #
174
+ #############
175
+
176
+ #############
177
+ # Contao
178
+ #
179
+
180
+ # Where do you store contao contents ?
181
+ # The contents are stored in the shared path because they are uploaded from
182
+ # contao's admin section
183
+ set :contents_path, -> { "#{fetch :public_path}/tl_files/contents"}
184
+
185
+ #
152
186
  #
153
187
  #############
@@ -23,10 +23,30 @@ set :branch, "master"
23
23
  set :use_sudo, false
24
24
 
25
25
  # Define deployments options
26
- set :deploy_to, "/home/vhosts/#{application}"
26
+ # NOTE: Do not use current_path here but use latest_release instead.
27
+ set :deploy_to, -> { "/home/vhosts/#{fetch :stage}/#{fetch :application}" }
28
+ set :logs_path, -> { "#{fetch :deploy_to}/logs" }
29
+ set :public_path, -> { "#{fetch :latest_release}/public" }
30
+
31
+ # How should we deploy?
32
+ # Valid options:
33
+ # => checkout: this deployment strategy does an SCM checkout on each target
34
+ # host. This is the default deployment strategy for Capistrano.
35
+ #
36
+ # => copy: this deployment strategy work by preparing the source code locally,
37
+ # compressing it, copying the file to each target host, and
38
+ # uncompressing it to the deployment directory.
39
+ # NOTE: This strategy has more options you can configure, please refer
40
+ # to capistrano/recipes/deploy/strategy/copy.rb (in capistrano)
41
+ # source or documentation for more information
42
+ #
43
+ # => export: this deployment strategy does an SCM export on each target host.
44
+ #
45
+ # => remote_cache: this deployment strategy keeps a cached checkout of the
46
+ # source code on each remote server. Each deploy simply updates
47
+ # the cached checkout, and then does a copy from the cached
48
+ # copy to the final deployment location.
27
49
  set :deploy_via, :remote_cache
28
- set :logs_path, "#{deploy_to}/logs"
29
- set :public_path, -> { "#{current_path}/public" }
30
50
 
31
51
  # Keep only the last 5 releases
32
52
  set :keep_releases, 5
@@ -149,5 +169,19 @@ set :web_server_mode, :passenger
149
169
  # => What is the path to the socket file
150
170
  # set :reverse_proxy_socket, -> { "#{shared_path}/sockets/unicorn.sock"}
151
171
 
172
+ #
173
+ #
174
+ #############
175
+
176
+ #############
177
+ # Contao
178
+ #
179
+
180
+ # Where do you store contao contents ?
181
+ # The contents are stored in the shared path because they are uploaded from
182
+ # contao's admin section
183
+ # set :contents_path, -> { "#{fetch :public_path}/tl_files/contents"}
184
+
185
+ #
152
186
  #
153
187
  #############
@@ -23,10 +23,30 @@ set :branch, "production"
23
23
  set :use_sudo, false
24
24
 
25
25
  # Define deployments options
26
- set :deploy_to, "/home/vhosts/#{application}"
26
+ # NOTE: Do not use current_path here but use latest_release instead.
27
+ set :deploy_to, -> { "/home/vhosts/#{fetch :stage}/#{fetch :application}" }
28
+ set :logs_path, -> { "#{fetch :deploy_to}/logs" }
29
+ set :public_path, -> { "#{fetch :latest_release}/public" }
30
+
31
+ # How should we deploy?
32
+ # Valid options:
33
+ # => checkout: this deployment strategy does an SCM checkout on each target
34
+ # host. This is the default deployment strategy for Capistrano.
35
+ #
36
+ # => copy: this deployment strategy work by preparing the source code locally,
37
+ # compressing it, copying the file to each target host, and
38
+ # uncompressing it to the deployment directory.
39
+ # NOTE: This strategy has more options you can configure, please refer
40
+ # to capistrano/recipes/deploy/strategy/copy.rb (in capistrano)
41
+ # source or documentation for more information
42
+ #
43
+ # => export: this deployment strategy does an SCM export on each target host.
44
+ #
45
+ # => remote_cache: this deployment strategy keeps a cached checkout of the
46
+ # source code on each remote server. Each deploy simply updates
47
+ # the cached checkout, and then does a copy from the cached
48
+ # copy to the final deployment location.
27
49
  set :deploy_via, :remote_cache
28
- set :logs_path, "#{deploy_to}/logs"
29
- set :public_path, -> { "#{current_path}/public" }
30
50
 
31
51
  # Keep only the last 5 releases
32
52
  set :keep_releases, 5
@@ -149,5 +169,19 @@ set :web_server_mode, :passenger
149
169
  # => What is the path to the socket file
150
170
  # set :reverse_proxy_socket, -> { "#{shared_path}/sockets/unicorn.sock"}
151
171
 
172
+ #
173
+ #
174
+ #############
175
+
176
+ #############
177
+ # Contao
178
+ #
179
+
180
+ # Where do you store contao contents ?
181
+ # The contents are stored in the shared path because they are uploaded from
182
+ # contao's admin section
183
+ # set :contents_path, -> { "#{fetch :public_path}/tl_files/contents"}
184
+
185
+ #
152
186
  #
153
187
  #############
@@ -23,10 +23,30 @@ set :branch, "staging"
23
23
  set :use_sudo, false
24
24
 
25
25
  # Define deployments options
26
- set :deploy_to, "/home/vhosts/#{application}"
26
+ # NOTE: Do not use current_path here but use latest_release instead.
27
+ set :deploy_to, -> { "/home/vhosts/#{fetch :stage}/#{fetch :application}" }
28
+ set :logs_path, -> { "#{fetch :deploy_to}/logs" }
29
+ set :public_path, -> { "#{fetch :latest_release}/public" }
30
+
31
+ # How should we deploy?
32
+ # Valid options:
33
+ # => checkout: this deployment strategy does an SCM checkout on each target
34
+ # host. This is the default deployment strategy for Capistrano.
35
+ #
36
+ # => copy: this deployment strategy work by preparing the source code locally,
37
+ # compressing it, copying the file to each target host, and
38
+ # uncompressing it to the deployment directory.
39
+ # NOTE: This strategy has more options you can configure, please refer
40
+ # to capistrano/recipes/deploy/strategy/copy.rb (in capistrano)
41
+ # source or documentation for more information
42
+ #
43
+ # => export: this deployment strategy does an SCM export on each target host.
44
+ #
45
+ # => remote_cache: this deployment strategy keeps a cached checkout of the
46
+ # source code on each remote server. Each deploy simply updates
47
+ # the cached checkout, and then does a copy from the cached
48
+ # copy to the final deployment location.
27
49
  set :deploy_via, :remote_cache
28
- set :logs_path, "#{deploy_to}/logs"
29
- set :public_path, -> { "#{current_path}/public" }
30
50
 
31
51
  # Keep only the last 5 releases
32
52
  set :keep_releases, 5
@@ -149,5 +169,19 @@ set :web_server_mode, :passenger
149
169
  # => What is the path to the socket file
150
170
  # set :reverse_proxy_socket, -> { "#{shared_path}/sockets/unicorn.sock"}
151
171
 
172
+ #
173
+ #
174
+ #############
175
+
176
+ #############
177
+ # Contao
178
+ #
179
+
180
+ # Where do you store contao contents ?
181
+ # The contents are stored in the shared path because they are uploaded from
182
+ # contao's admin section
183
+ # set :contents_path, -> { "#{fetch :public_path}/tl_files/contents"}
184
+
185
+ #
152
186
  #
153
187
  #############
@@ -23,10 +23,30 @@ set :branch, "master"
23
23
  set :use_sudo, false
24
24
 
25
25
  # Define deployments options
26
- set :deploy_to, "/home/vhosts/#{application}"
26
+ # NOTE: Do not use current_path here but use latest_release instead.
27
+ set :deploy_to, -> { "/home/vhosts/#{fetch :stage}/#{fetch :application}" }
28
+ set :logs_path, -> { "#{fetch :deploy_to}/logs" }
29
+ set :public_path, -> { "#{fetch :latest_release}/public" }
30
+
31
+ # How should we deploy?
32
+ # Valid options:
33
+ # => checkout: this deployment strategy does an SCM checkout on each target
34
+ # host. This is the default deployment strategy for Capistrano.
35
+ #
36
+ # => copy: this deployment strategy work by preparing the source code locally,
37
+ # compressing it, copying the file to each target host, and
38
+ # uncompressing it to the deployment directory.
39
+ # NOTE: This strategy has more options you can configure, please refer
40
+ # to capistrano/recipes/deploy/strategy/copy.rb (in capistrano)
41
+ # source or documentation for more information
42
+ #
43
+ # => export: this deployment strategy does an SCM export on each target host.
44
+ #
45
+ # => remote_cache: this deployment strategy keeps a cached checkout of the
46
+ # source code on each remote server. Each deploy simply updates
47
+ # the cached checkout, and then does a copy from the cached
48
+ # copy to the final deployment location.
27
49
  set :deploy_via, :remote_cache
28
- set :logs_path, "#{deploy_to}/logs"
29
- set :public_path, -> { "#{current_path}/public" }
30
50
 
31
51
  # Keep only the last 5 releases
32
52
  set :keep_releases, 5
@@ -149,5 +169,19 @@ set :web_server_mode, :reverse_proxy
149
169
  # => What is the path to the socket file
150
170
  set :reverse_proxy_socket, -> { "#{shared_path}/sockets/unicorn.sock"}
151
171
 
172
+ #
173
+ #
174
+ #############
175
+
176
+ #############
177
+ # Contao
178
+ #
179
+
180
+ # Where do you store contao contents ?
181
+ # The contents are stored in the shared path because they are uploaded from
182
+ # contao's admin section
183
+ # set :contents_path, -> { "#{fetch :public_path}/tl_files/contents"}
184
+
185
+ #
152
186
  #
153
187
  #############
@@ -23,10 +23,30 @@ set :branch, "production"
23
23
  set :use_sudo, false
24
24
 
25
25
  # Define deployments options
26
- set :deploy_to, "/home/vhosts/#{application}"
26
+ # NOTE: Do not use current_path here but use latest_release instead.
27
+ set :deploy_to, -> { "/home/vhosts/#{fetch :stage}/#{fetch :application}" }
28
+ set :logs_path, -> { "#{fetch :deploy_to}/logs" }
29
+ set :public_path, -> { "#{fetch :latest_release}/public" }
30
+
31
+ # How should we deploy?
32
+ # Valid options:
33
+ # => checkout: this deployment strategy does an SCM checkout on each target
34
+ # host. This is the default deployment strategy for Capistrano.
35
+ #
36
+ # => copy: this deployment strategy work by preparing the source code locally,
37
+ # compressing it, copying the file to each target host, and
38
+ # uncompressing it to the deployment directory.
39
+ # NOTE: This strategy has more options you can configure, please refer
40
+ # to capistrano/recipes/deploy/strategy/copy.rb (in capistrano)
41
+ # source or documentation for more information
42
+ #
43
+ # => export: this deployment strategy does an SCM export on each target host.
44
+ #
45
+ # => remote_cache: this deployment strategy keeps a cached checkout of the
46
+ # source code on each remote server. Each deploy simply updates
47
+ # the cached checkout, and then does a copy from the cached
48
+ # copy to the final deployment location.
27
49
  set :deploy_via, :remote_cache
28
- set :logs_path, "#{deploy_to}/logs"
29
- set :public_path, -> { "#{current_path}/public" }
30
50
 
31
51
  # Keep only the last 5 releases
32
52
  set :keep_releases, 5
@@ -149,5 +169,19 @@ set :web_server_mode, :reverse_proxy
149
169
  # => What is the path to the socket file
150
170
  set :reverse_proxy_socket, -> { "#{shared_path}/sockets/unicorn.sock"}
151
171
 
172
+ #
173
+ #
174
+ #############
175
+
176
+ #############
177
+ # Contao
178
+ #
179
+
180
+ # Where do you store contao contents ?
181
+ # The contents are stored in the shared path because they are uploaded from
182
+ # contao's admin section
183
+ # set :contents_path, -> { "#{fetch :public_path}/tl_files/contents"}
184
+
185
+ #
152
186
  #
153
187
  #############
@@ -23,10 +23,29 @@ set :branch, "staging"
23
23
  set :use_sudo, false
24
24
 
25
25
  # Define deployments options
26
- set :deploy_to, "/home/vhosts/#{application}"
26
+ # NOTE: Do not use current_path here but use latest_release instead.
27
+ set :deploy_to, -> { "/home/vhosts/#{fetch :stage}/#{fetch :application}" }
28
+ set :logs_path, -> { "#{fetch :deploy_to}/logs" }
29
+ set :public_path, -> { "#{fetch :latest_release}/public" }
30
+ # How should we deploy?
31
+ # Valid options:
32
+ # => checkout: this deployment strategy does an SCM checkout on each target
33
+ # host. This is the default deployment strategy for Capistrano.
34
+ #
35
+ # => copy: this deployment strategy work by preparing the source code locally,
36
+ # compressing it, copying the file to each target host, and
37
+ # uncompressing it to the deployment directory.
38
+ # NOTE: This strategy has more options you can configure, please refer
39
+ # to capistrano/recipes/deploy/strategy/copy.rb (in capistrano)
40
+ # source or documentation for more information
41
+ #
42
+ # => export: this deployment strategy does an SCM export on each target host.
43
+ #
44
+ # => remote_cache: this deployment strategy keeps a cached checkout of the
45
+ # source code on each remote server. Each deploy simply updates
46
+ # the cached checkout, and then does a copy from the cached
47
+ # copy to the final deployment location.
27
48
  set :deploy_via, :remote_cache
28
- set :logs_path, "#{deploy_to}/logs"
29
- set :public_path, -> { "#{current_path}/public" }
30
49
 
31
50
  # Keep only the last 5 releases
32
51
  set :keep_releases, 5
@@ -149,5 +168,19 @@ set :web_server_mode, :reverse_proxy
149
168
  # => What is the path to the socket file
150
169
  set :reverse_proxy_socket, -> { "#{shared_path}/sockets/unicorn.sock"}
151
170
 
171
+ #
172
+ #
173
+ #############
174
+
175
+ #############
176
+ # Contao
177
+ #
178
+
179
+ # Where do you store contao contents ?
180
+ # The contents are stored in the shared path because they are uploaded from
181
+ # contao's admin section
182
+ # set :contents_path, -> { "#{fetch :public_path}/tl_files/contents"}
183
+
184
+ #
152
185
  #
153
186
  #############
@@ -8,6 +8,9 @@ unless Capistrano::Configuration.respond_to?(:instance)
8
8
  end
9
9
 
10
10
  Capistrano::Configuration.instance(:must_exist).load do
11
+ # Prevent capistrano from creating log, system and pids folders.
12
+ set :shared_children, Array.new
13
+
11
14
  namespace :deploy do
12
15
  desc "Empty task, overriden by #{__FILE__}"
13
16
  task :finalize_update do
@@ -19,18 +22,19 @@ Capistrano::Configuration.instance(:must_exist).load do
19
22
  desc "[internal] Setup contao shared contents"
20
23
  task :setup, :roles => :app, :except => { :no_release => true } do
21
24
  run <<-CMD
22
- #{try_sudo} mkdir -p #{shared_path}/log &&
23
- #{try_sudo} mkdir -p #{shared_path}/contenu &&
24
- #{try_sudo} mkdir -p #{shared_path}/contenu/images &&
25
- #{try_sudo} mkdir -p #{shared_path}/contenu/videos &&
26
- #{try_sudo} mkdir -p #{shared_path}/contenu/son &&
27
- #{try_sudo} mkdir -p #{shared_path}/contenu/pdfs
25
+ #{try_sudo} mkdir -p #{shared_path}/logs &&
26
+ #{try_sudo} mkdir -p #{shared_path}/config &&
27
+ #{try_sudo} mkdir -p #{shared_path}/contents &&
28
+ #{try_sudo} mkdir -p #{shared_path}/contents/image &&
29
+ #{try_sudo} mkdir -p #{shared_path}/contents/video &&
30
+ #{try_sudo} mkdir -p #{shared_path}/contents/audio &&
31
+ #{try_sudo} mkdir -p #{shared_path}/contents/pdf
28
32
  CMD
29
33
  end
30
34
 
31
35
  desc "[internal] Setup contao's localconfig"
32
36
  task :setup_localconfig, :roles => :app, :except => { :no_release => true } do
33
- on_rollback { run "rm -f #{shared_path}/localconfig.php" }
37
+ on_rollback { run "rm -f #{shared_path}/config/localconfig.php" }
34
38
 
35
39
  localconfig = File.read("public/system/config/localconfig.php.sample")
36
40
  mysql_credentials = fetch :mysql_credentials
@@ -48,17 +52,46 @@ Capistrano::Configuration.instance(:must_exist).load do
48
52
  localconfig.gsub!(/#DB_NAME#/, mysql_db_name)
49
53
  end
50
54
 
51
- put localconfig, "#{shared_path}/localconfig.php"
55
+ put localconfig, "#{shared_path}/config/localconfig.php"
56
+ end
57
+
58
+ desc "[internal] Setup .htaccess"
59
+ task :setup_htaccess do
60
+ unless remote_file_exists?("#{fetch :shared_path}/config/htaccess.txt")
61
+ begin
62
+ run <<-CMD
63
+ #{try_sudo} cp #{fetch :latest_release}/public/.htaccess.default #{fetch :shared_path}/config/htaccess.txt
64
+ CMD
65
+ rescue
66
+ run <<-CMD
67
+ #{try_sudo} touch #{fetch :shared_path}/config/htaccess.txt
68
+ CMD
69
+ end
70
+ end
52
71
  end
53
72
 
73
+ desc "[internal] Fix contao's symlinks to the shared path"
54
74
  task :fix_links, :roles => :app, :except => { :no_release => true } do
75
+ contents_path = fetch :contents_path, "#{fetch :public_path}/tl_files/contents"
76
+
77
+ # Remove files
78
+ run <<-CMD
79
+ #{try_sudo} rm -f #{contents_path} &&
80
+ #{try_sudo} rm -rf #{fetch :latest_release}/public/system/logs &&
81
+ #{try_sudo} rm -f #{fetch :latest_release}/public/system/config/localconfig.php &&
82
+ #{try_sudo} rm -f #{fetch :latest_release}/public/.htaccess
83
+ CMD
84
+
85
+ run <<-CMD
86
+ mkdir -p #{File.dirname(contents_path)}
87
+ CMD
88
+
89
+ # Create symlinks
55
90
  run <<-CMD
56
- #{try_sudo} rm -rf #{fetch :latest_release}/public/tl_files/durable/contenu &&
57
- #{try_sudo} rm -rf #{fetch :latest_release}/log &&
58
- #{try_sudo} ln -nsf #{fetch :shared_path}/contenu #{fetch :latest_release}/public/tl_files/durable/contenu &&
59
- #{try_sudo} ln -nsf #{fetch :shared_path}/htaccess.txt #{fetch :latest_release}/public/.htaccess &&
60
- #{try_sudo} ln -nsf #{fetch :shared_path}/localconfig.php #{fetch :latest_release}/public/system/config/localconfig.php &&
61
- #{try_sudo} ln -nsf #{fetch :shared_path}/log #{fetch :latest_release}/log
91
+ #{try_sudo} ln -nsf #{fetch :shared_path}/contents #{contents_path} &&
92
+ #{try_sudo} ln -nsf #{fetch :shared_path}/config/htaccess.txt #{fetch :latest_release}/public/.htaccess &&
93
+ #{try_sudo} ln -nsf #{fetch :shared_path}/config/localconfig.php #{fetch :latest_release}/public/system/config/localconfig.php &&
94
+ #{try_sudo} ln -nsf #{fetch :shared_path}/logs #{fetch :latest_release}/public/system/logs
62
95
  CMD
63
96
  end
64
97
  end
@@ -67,6 +100,7 @@ Capistrano::Configuration.instance(:must_exist).load do
67
100
  after "deploy:setup", "contao:setup"
68
101
  after "contao:setup", "contao:setup_localconfig"
69
102
  after "deploy:finalize_update", "contao:fix_links"
103
+ before "contao:fix_links", "contao:setup_htaccess"
70
104
  after "contao:fix_links", "deploy:cleanup"
71
105
  after "deploy:restart", "deploy:fix_permissions"
72
106
 
@@ -20,10 +20,30 @@ set :branch, "master"
20
20
  set :use_sudo, false
21
21
 
22
22
  # Define deployments options
23
- set :deploy_to, "/home/vhosts/#{application}"
23
+ # NOTE: Do not use current_path here but use latest_release instead.
24
+ set :deploy_to, -> { "/home/vhosts/#{fetch :stage}/#{fetch :application}" }
25
+ set :logs_path, -> { "#{fetch :deploy_to}/logs" }
26
+ set :public_path, -> { "#{fetch :latest_release}/public" }
27
+
28
+ # How should we deploy?
29
+ # Valid options:
30
+ # => checkout: this deployment strategy does an SCM checkout on each target
31
+ # host. This is the default deployment strategy for Capistrano.
32
+ #
33
+ # => copy: this deployment strategy work by preparing the source code locally,
34
+ # compressing it, copying the file to each target host, and
35
+ # uncompressing it to the deployment directory.
36
+ # NOTE: This strategy has more options you can configure, please refer
37
+ # to capistrano/recipes/deploy/strategy/copy.rb (in capistrano)
38
+ # source or documentation for more information
39
+ #
40
+ # => export: this deployment strategy does an SCM export on each target host.
41
+ #
42
+ # => remote_cache: this deployment strategy keeps a cached checkout of the
43
+ # source code on each remote server. Each deploy simply updates
44
+ # the cached checkout, and then does a copy from the cached
45
+ # copy to the final deployment location.
24
46
  set :deploy_via, :remote_cache
25
- set :logs_path, "#{deploy_to}/logs"
26
- set :public_path, -> { "#{current_path}/public" }
27
47
 
28
48
  # Keep only the last 5 releases
29
49
  set :keep_releases, 5
@@ -90,7 +110,7 @@ set :web_server_app, :nginx
90
110
  # Absolute path to this application's web server configuration
91
111
  # This gem suppose that you are already including files from the folder you're placing
92
112
  # the config file in, if not the application won't be up after deployment
93
- set :web_conf_file, -> { "/etc/nginx/#{fetch(:stage).to_s}/#{fetch :application}.conf" }
113
+ set :web_conf_file, -> { "/etc/nginx/#{fetch :stage}/#{fetch :application}.conf" }
94
114
 
95
115
  # Which port does the server runs on ?
96
116
  set :web_server_listen_port, 80
@@ -109,7 +129,7 @@ set :web_server_indexes, %w(index.php index.html)
109
129
  # web_server_auth_credentials is an array of user/password hashes, you can use
110
130
  # gen_pass(length) in a Proc to generate a new password as shown below
111
131
  #
112
- # set :web_server_auth_file, -> { "/etc/nginx/htpasswds/#{fetch :application}.crypt" }
132
+ # set :web_server_auth_file, -> { "/etc/nginx/#{fetch :stage}/htpasswds/#{fetch :application}.crypt" }
113
133
  # set :web_server_auth_credentials, [
114
134
  # {user: 'user1', password: 'pass1'},
115
135
  # {user: 'user2', password: -> { gen_pass(8) } },
@@ -147,5 +167,20 @@ set :web_server_mode, :reverse_proxy
147
167
  # => What is the path to the socket file
148
168
  # set :reverse_proxy_socket, -> { "#{shared_path}/sockets/unicorn.sock"}
149
169
 
170
+ #
171
+ #
172
+ #############
173
+
174
+ #############
175
+ # Contao
176
+ #
177
+
178
+ # Where do you store contao contents ?
179
+ # The contents are stored in the shared path because they are uploaded from
180
+ # contao's admin section
181
+ # Uncomment if necessary (default to public_path/tl_files/contents)
182
+ # set :contents_path, -> { "#{fetch :public_path}/tl_files/contents"}
183
+
184
+ #
150
185
  #
151
186
  #############
@@ -3,7 +3,7 @@ module Capistrano
3
3
  module Version #:nodoc:
4
4
  MAJOR = 1
5
5
  MINOR = 1
6
- TINY = 2
6
+ TINY = 3
7
7
 
8
8
  ARRAY = [MAJOR, MINOR, TINY]
9
9
  STRING = ARRAY.join(".")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-exts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &2156449000 !ruby/object:Gem::Requirement
16
+ requirement: &2156618100 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.8.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2156449000
24
+ version_requirements: *2156618100
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: i18n
27
- requirement: &2157203840 !ruby/object:Gem::Requirement
27
+ requirement: &2152375480 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.6.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2157203840
35
+ version_requirements: *2152375480
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: activesupport
38
- requirement: &2157203380 !ruby/object:Gem::Requirement
38
+ requirement: &2152372740 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 3.1.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2157203380
46
+ version_requirements: *2152372740
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: guard
49
- requirement: &2157202920 !ruby/object:Gem::Requirement
49
+ requirement: &2152370700 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.6.2
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2157202920
57
+ version_requirements: *2152370700
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard-bundler
60
- requirement: &2157202460 !ruby/object:Gem::Requirement
60
+ requirement: &2156649860 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.1.3
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2157202460
68
+ version_requirements: *2156649860
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: guard-rspec
71
- requirement: &2157202000 !ruby/object:Gem::Requirement
71
+ requirement: &2156649400 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.4.3
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2157202000
79
+ version_requirements: *2156649400
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &2157201540 !ruby/object:Gem::Requirement
82
+ requirement: &2156648940 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 2.6.0
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2157201540
90
+ version_requirements: *2156648940
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: mocha
93
- requirement: &2157201080 !ruby/object:Gem::Requirement
93
+ requirement: &2156648480 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 0.2.12
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *2157201080
101
+ version_requirements: *2156648480
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: factory_girl
104
- requirement: &2157200620 !ruby/object:Gem::Requirement
104
+ requirement: &2156648020 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 2.0.5
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *2157200620
112
+ version_requirements: *2156648020
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: faker19
115
- requirement: &2157200160 !ruby/object:Gem::Requirement
115
+ requirement: &2156647560 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: 1.0.5
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *2157200160
123
+ version_requirements: *2156647560
124
124
  description: Handy extensions for Capistrano
125
125
  email:
126
126
  - wael.nasreddine@gmail.com