capistrano-typo3 0.4.10 → 0.5.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: 87fa8d24ee0294958e082c3eeda79d18258fd0a8
4
- data.tar.gz: b934a7bf073a6281d8fb0920c38c52742720731b
3
+ metadata.gz: eb5cc54bbc6964dc71232417d6da19a4ec6fc865
4
+ data.tar.gz: e41a7c8db712812e8f15ddfd2d4c9f3371a77442
5
5
  SHA512:
6
- metadata.gz: a7cb46c32ca21162fdcddc87c2473f6c307208621ec9f09ee6f6709bc65f7fc1f79f22fa460830da7888f34032dc21fa59e9634c4f7a158f880b703d705a278e
7
- data.tar.gz: 2ec3c305ee77f3e20a9b4c3c132da34f165c1124aacc44c89a3f42b97e2f39d9a85594a95134edd2b8bd88bb58e8ced5400e5959d7842373596d8a7f06575f4c
6
+ metadata.gz: 2a3df5af753a0fe65fb20e137f5003d8d890621f19436aaa044ec417d8958d0cd17b4b6c8647369ca5f4b3aceda22f3ca93e2dc318eece4d12a30ab8e4067ac1
7
+ data.tar.gz: 336af96ecc43bb45bfefb26ea4948af3fd06448fdf2ba85c7b3151e126dff0304ba173bfb891d991e33c28b27fb54cd07f043af5228cd635492c71aa5bee52e4
data/README.md CHANGED
@@ -1,19 +1,23 @@
1
1
  # Capistrano::Typo3 [![Code Climate](https://codeclimate.com/github/t3labcom/capistrano-typo3/badges/gpa.svg)](https://codeclimate.com/github/t3labcom/capistrano-typo3) [![Issue Count](https://codeclimate.com/github/t3labcom/capistrano-typo3/badges/issue_count.svg)](https://codeclimate.com/github/t3labcom/capistrano-typo3)
2
2
 
3
- **Note: this plugin works only with Capistrano 3.** Please check the
4
- capistrano gem version you're using before installing this gem:
3
+ Capistrano Plugin for TYPO3 deployment and development.
5
4
 
6
- `$ bundle show | grep capistrano`
5
+ ## Features
7
6
 
8
- Capistrano deployment tasks for TYPO3 CMS
7
+ - ease setup of development environment
8
+ - deployment model
9
+ - lots of utility tasks optimized for typo3
10
+
11
+ https://rubygems.org/gems/capistrano-typo3
9
12
 
10
13
  ## Compatibility
11
14
 
12
15
  The versions below have been tested with capistrano-typo3
13
16
 
14
- * 6.2.x
15
- * 7.x
16
- * 8.x
17
+ - TYPO3 6.2.x
18
+ - TYPO3 7.x
19
+ - TYPO3 8.x
20
+ - TYPO3 9.x
17
21
 
18
22
  ## Configuration
19
23
 
@@ -58,4 +62,3 @@ about this integrations. English version will follow soon.
58
62
  3. Commit your changes (`git commit -am 'Add some feature'`)
59
63
  4. Push to the branch (`git push origin my-new-feature`)
60
64
  5. Create a new Pull Request
61
-
@@ -13,7 +13,6 @@ set :git_no_cache, 1
13
13
 
14
14
  set :t3_store_db_credentials_in_addionalconf, 1
15
15
  set :t3_add_unsafe_trusted_host_pattern, 1
16
- set :t3_dont_upgrade_source, 1
17
16
 
18
17
  set :hs_default_upstream_php_engine, 'php56'
19
18
 
@@ -8,5 +8,11 @@ namespace :deploy do
8
8
  end
9
9
  end
10
10
 
11
- after :finishing, 'typo3:hooks:after_deploy'
11
+
12
+ task "fixknownhosts" do
13
+ on roles(:all) do
14
+ execute "ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} uptime"
15
+ end
16
+ end
17
+
12
18
  end
@@ -14,43 +14,6 @@ namespace :git do
14
14
  end
15
15
  end
16
16
 
17
- desc "Show last git commit"
18
- task :last_commit do
19
- on roles(:all) do
20
- execute "cd #{fetch(:deploy_to)} && rake cap:git_last_commit"
21
- end
22
- end
23
-
24
- desc 'pending commits since last release'
25
- task :pending do
26
- revline=''
27
- on roles :all do
28
- revline = capture("tail -n1 #{fetch(:deploy_to)}/revisions.log")
29
- end
30
- githash =revline.split("(at")[1].split(")")[0]
31
-
32
- system("git clone -n #{repo_url} /tmp/cap_pending")
33
- print `cd /tmp/cap_pending && git log #{githash}..HEAD`
34
- system("rm -Rf /tmp/cap_pending")
35
- end
36
-
37
- desc 'pending commits since [commithash]'
38
- task :pending_since , :commithash do |t, args|
39
- githash = args[:commithash]
40
- on roles(:all) do
41
- execute "cd #{fetch(:deploy_to)}/current && git log #{githash}..HEAD"
42
- end
43
- end
44
-
45
- # restore remote git url for developent environments
46
- task :set_remote_url_no_cache do
47
- if(fetch(:git_no_cache)==1)
48
- on roles(:all) do
49
- execute "cd #{fetch(:deploy_to)}/current/ && git remote set-url origin #{fetch(:repo_url)}"
50
- end
51
- end
52
- end
53
-
54
17
  desc "remove remote git cache repository"
55
18
  task :remove_git_cache_repo do
56
19
  on roles(:all) do
@@ -58,5 +21,4 @@ namespace :git do
58
21
  end
59
22
  end
60
23
 
61
-
62
24
  end
@@ -4,15 +4,10 @@
4
4
 
5
5
  set :debug, 0
6
6
  set :git_no_cache, 0
7
+
7
8
  set :restart_webserver, "sudo /etc/init.d/apache2 restart"
8
- set :bundle_executable, "/usr/bin/bundle"
9
- set :rake_executable, "./bin/rake"
10
9
  set :rake_mysql_exec_dir, "/usr/bin"
11
- set :rake_php_executable, "/usr/bin/php"
12
10
 
13
- set :t3_dont_upgrade_source, 0
14
- set :t3_alternative_source_url, nil
15
- set :t3_main_version, '7'
16
11
  set :t3_post_deployment_commands, []
17
12
  set :t3_db_sync_ignore_tables, []
18
13
  set :t3_ts_constants, []
@@ -20,10 +15,6 @@ set :t3_ts_constants, []
20
15
  set :typo3_v6_local_conf_path, File.join('current','dummy','typo3conf','LocalConfiguration.php')
21
16
  set :http_protocol, 'http'
22
17
 
23
- #----- INTERNAL VARIABLES, DON'T CHANGE OR OVERRIDE THESE
24
- set :hooks_before_suite_run, 0
25
- set :install_or_update_rake_typo3_run, 0
26
-
27
18
  namespace :typo3 do
28
19
 
29
20
  desc "Setup a new production environment. Don't sync content from old production"
@@ -87,511 +78,4 @@ namespace :typo3 do
87
78
  invoke 'typo3:content:flush_cache_in_db'
88
79
  end
89
80
 
90
- namespace :hooks do
91
- task :after_deploy do
92
- invoke 'git:set_remote_url_no_cache'
93
- end
94
- end
95
-
96
- namespace :content do
97
- desc 'sync files from production'
98
- task :sync_files_from_production do
99
- on roles(:allow_syncfiles) do
100
- if fetch(:t3_live_sync)['filesync']
101
- fetch(:t3_live_sync)['filesync'].each do |key,command|
102
- execute "cd #{fetch(:deploy_to)} && #{command}"
103
- end
104
- end
105
- end
106
- end
107
-
108
- desc 'sync database from production to a local mysql'
109
- task :sync_db_from_production_local_no_pass do
110
-
111
- ignorestring = ""
112
-
113
- if(:t3_db_sync_ignore_tables)
114
-
115
- fetch(:t3_db_sync_ignore_tables).each do | ignore_tbl |
116
- ignorestring = "#{ignorestring} --ignore-table=#{fetch(:t3_live_sync)['dbsync']['dbname']}.#{ignore_tbl}"
117
- end
118
- end
119
-
120
- # DUMP DATABASE TO IMAGE
121
- system <<DBSYNC1
122
- ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
123
- 'mysqldump -u#{fetch(:t3_live_sync)['dbsync']['dbuser']} \
124
- -h#{fetch(:t3_live_sync)['dbsync']['dbhost']} \
125
- -p#{fetch(:t3_live_sync)['dbsync']['dbpass']} \
126
- #{ignorestring} \
127
- #{fetch(:t3_live_sync)['dbsync']['dbname']} > /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}'
128
- DBSYNC1
129
-
130
- if(:t3_db_sync_ignore_tables)
131
- fetch(:t3_db_sync_ignore_tables).each do | ignore_tbl |
132
-
133
- system <<DBSYNC1
134
- ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
135
- 'mysqldump -u#{fetch(:t3_live_sync)['dbsync']['dbuser']} \
136
- -h#{fetch(:t3_live_sync)['dbsync']['dbhost']} \
137
- -p#{fetch(:t3_live_sync)['dbsync']['dbpass']} \
138
- --no-data \
139
- #{fetch(:t3_live_sync)['dbsync']['dbname']} #{ignore_tbl} >> /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}'
140
- DBSYNC1
141
- end
142
- end
143
-
144
- # COMPRESS IMAGE
145
- system <<DBSYNC2
146
- ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
147
- 'gzip -f /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}'
148
- DBSYNC2
149
-
150
- # TRANSFER IMAGE
151
- system <<DBSYNC3
152
- scp #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']}:/tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz \
153
- /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz
154
- DBSYNC3
155
-
156
- # DECOMPRESS IMAGE
157
- system <<DBSYNC4
158
- gunzip -f /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz
159
- DBSYNC4
160
-
161
- # IMPORT AND REMOVE IMAGE
162
- system <<DBSYNC5
163
- mysql -u#{fetch(:dbuser)} -h#{fetch(:dbhost)} #{fetch(:dbname)} < /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']} && \
164
- rm -f /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']}
165
- DBSYNC5
166
-
167
- # REMOVE IMAGE
168
- system <<DBSYNC6
169
- ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
170
- 'rm -f /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz'
171
- DBSYNC6
172
-
173
- end
174
-
175
-
176
- desc 'sync database from production and run sql updates'
177
- task :sync_db_from_production do
178
- on roles(:allow_syncdatabase) do
179
-
180
- ignorestring = ""
181
-
182
- if(:t3_db_sync_ignore_tables)
183
-
184
- fetch(:t3_db_sync_ignore_tables).each do | ignore_tbl |
185
- ignorestring = "#{ignorestring} --ignore-table=#{fetch(:t3_live_sync)['dbsync']['dbname']}.#{ignore_tbl}"
186
- end
187
- end
188
-
189
- # DUMP DATABASE TO IMAGE
190
- execute <<DBSYNC1
191
- ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
192
- 'mysqldump -u#{fetch(:t3_live_sync)['dbsync']['dbuser']} \
193
- -h#{fetch(:t3_live_sync)['dbsync']['dbhost']} \
194
- -p#{fetch(:t3_live_sync)['dbsync']['dbpass']} \
195
- #{ignorestring} \
196
- #{fetch(:t3_live_sync)['dbsync']['dbname']} > /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}'
197
- DBSYNC1
198
-
199
- if(:t3_db_sync_ignore_tables)
200
- fetch(:t3_db_sync_ignore_tables).each do | ignore_tbl |
201
-
202
- execute <<DBSYNC1
203
- ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
204
- 'mysqldump -u#{fetch(:t3_live_sync)['dbsync']['dbuser']} \
205
- -h#{fetch(:t3_live_sync)['dbsync']['dbhost']} \
206
- -p#{fetch(:t3_live_sync)['dbsync']['dbpass']} \
207
- --no-data \
208
- #{fetch(:t3_live_sync)['dbsync']['dbname']} #{ignore_tbl} >> /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}'
209
- DBSYNC1
210
- end
211
- end
212
-
213
- # COMPRESS IMAGE
214
- execute <<DBSYNC2
215
- ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
216
- 'gzip -f /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}'
217
- DBSYNC2
218
-
219
- # TRANSFER IMAGE
220
- execute <<DBSYNC3
221
- scp #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']}:/tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz \
222
- /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz
223
- DBSYNC3
224
-
225
- # DECOMPRESS IMAGE
226
- execute <<DBSYNC4
227
- gunzip -f /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz
228
- DBSYNC4
229
-
230
- # IMPORT AND REMOVE IMAGE
231
- execute <<DBSYNC5
232
- mysql -u#{fetch(:dbuser)} -h#{fetch(:dbhost)} -p#{fetch(:dbpass)} #{fetch(:dbname)} < /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']} && \
233
- rm -f /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']}
234
- DBSYNC5
235
-
236
- # REMOVE IMAGE
237
- execute <<DBSYNC6
238
- ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
239
- 'rm -f /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz'
240
- DBSYNC6
241
- end
242
-
243
- invoke 'typo3:content:sql_updates'
244
- end
245
-
246
- desc 'run necessary sql queries for environment'
247
- task :sql_updates do
248
- on roles(:allow_syncdatabase) do
249
- if fetch(:t3_sql_updates)
250
- fetch(:t3_sql_updates).each do |command|
251
- execute DT3MySQL::mysql_execute(command)
252
- end
253
- end
254
- end
255
- end
256
-
257
- desc 'flush cache and session tables in database'
258
- task :flush_cache_in_db do
259
- on roles(:all) do
260
-
261
- all_current_tables = capture(DT3MySQL::show_tables).split("\n")
262
-
263
- cache_tables= %w(cache_extensions cache_hash cache_imagesizes cache_md5params cache_pages cache_pagesection cache_sys_dmail_stat cache_treelist cache_typo3temp_log cachingframework_cache_hash cachingframework_cache_hash_tags cachingframework_cache_pages cachingframework_cache_pages_tags cachingframework_cache_pagesection cachingframework_cache_pagesection_tags cf_cache_hash cf_cache_hash_tags cf_cache_pages cf_cache_pages_tags cf_cache_pagesection cf_cache_pagesection_tags cf_extbase_object cf_extbase_object_tags cf_extbase_reflection cf_extbase_reflection_tags cf_tt_news_cache cf_tt_news_cache_tags cf_tx_solr cf_tx_solr_tags tt_news_cache tt_news_cache_tags tx_realurl_chashcache tx_realurl_errorlog tx_realurl_pathcache tx_realurl_uniqalias tx_realurl_urldecodecache tx_realurl_urlencodecache tx_solr_cache tx_solr_cache_tags)
264
-
265
- cache_tables.each do |table|
266
- if all_current_tables.include?(table)
267
- execute DT3MySQL::truncate_table(table)
268
- end
269
- end
270
-
271
- session_tables=%w(be_sessions fe_session_data fe_sessions)
272
- session_tables.each do |table|
273
- if all_current_tables.include?(table)
274
- execute DT3MySQL::truncate_table(table)
275
- end
276
- end
277
- end
278
- end
279
- end
280
-
281
- namespace :vagrant do
282
- desc "when homestead is not yet configured"
283
- task "init_homestead_conf" do
284
- invoke 'typo3:vagrant:check_branch'
285
- sh "mkdir -p config"
286
- sh "cd config && curl -O https://raw.githubusercontent.com/t3labcom/capistrano-typo3/master/homestead_files/vagrant.yml"
287
- sh "cd config/deploy && curl -O https://raw.githubusercontent.com/t3labcom/capistrano-typo3/master/homestead_files/homestead.rb"
288
- sh "curl -O https://raw.githubusercontent.com/t3labcom/capistrano-typo3/master/homestead_files/Vagrantfile"
289
- end
290
-
291
- desc "setup new homestead vagrant machine for TYPO3 development"
292
- task "setup_machine" do
293
- invoke 'typo3:vagrant:check_branch'
294
-
295
- if `vagrant status | grep running`.strip != ""
296
- sh "vagrant destroy"
297
- end
298
-
299
- sh "rm -f local.typo3.org"
300
- sh "rm -Rf .vagrant"
301
-
302
- if `vagrant plugin list | grep vagrant-bind`.include? 'vagrant-bindfs'
303
- print "vagrant bindfs plugin is already installed\n"
304
- else
305
- sh "vagrant plugin install vagrant-bindfs"
306
- end
307
-
308
- sh "vagrant up"
309
-
310
- on roles(:all) do
311
- execute "sudo aptitude update"
312
- execute "sudo aptitude install ruby-dev make -y"
313
- execute "sudo gem install bundler"
314
- end
315
-
316
- invoke 'typo3:vagrant:set_no_site'
317
- invoke 'typo3:helper:restart_webserver'
318
- end
319
-
320
-
321
- desc "init site from scratch (new installs)"
322
- task "init_site" do
323
- invoke 'typo3:vagrant:check_branch'
324
-
325
- on roles(:all) do
326
- ## PURGE IF NEEDED
327
- execute "sudo rm -Rf /var/shared/fileadmin /var/shared/typo3temp /var/shared/uploads"
328
- execute "sudo rm -f /var/current"
329
- execute "sudo mysql -e 'DROP DATABASE IF EXISTS #{fetch(:dbname)}'"
330
-
331
- ## CREATE
332
- execute "sudo mkdir -p /var/shared/fileadmin /var/shared/typo3temp /var/shared/uploads"
333
- execute "sudo chown -Rf vagrant.vagrant /var/shared/fileadmin /var/shared/typo3temp /var/shared/uploads"
334
- execute "sudo ln -s /var/www/local.typo3.org /var/current"
335
- end
336
-
337
- on roles(:all) do
338
- execute "sudo mysqladmin create #{fetch(:dbname)}"
339
- end
340
-
341
- on roles(:all) do
342
- if fetch(:hs_default_upstream_php_engine)
343
- execute "sudo sed -i 's/set $upstream .*/set $upstream #{fetch(:hs_default_upstream_php_engine)};/g' /etc/nginx/sites-available/local.typo3.org.conf"
344
- end
345
- execute "sudo sed -i 's/root .*/root \"\\/var\\/www\\/local\\.typo3\\.org\\/dummy\\/\";/g' /etc/nginx/sites-available/local.typo3.org.conf"
346
- end
347
-
348
- invoke 'typo3:helper:restart_webserver'
349
-
350
- print <<MSG
351
-
352
- ----------------------------------------------------------------------
353
- The website conf seems to be succesfully installed in the Homestead Vagrant
354
- machine.
355
-
356
- Open the site at http://local.typo3.org"
357
-
358
- you can now install TYPO3
359
-
360
- ----------------------------------------------------------------------
361
- MSG
362
- end
363
- desc "setup site (remote exists)"
364
- task "setup_site" do
365
- invoke 'typo3:vagrant:check_branch'
366
-
367
- on roles(:all) do
368
- ## PURGE IF NEEDED
369
- execute "sudo rm -Rf /var/shared/fileadmin /var/shared/typo3temp /var/shared/uploads"
370
- execute "sudo rm -f /var/current"
371
- execute "sudo mysql -e 'DROP DATABASE IF EXISTS #{fetch(:dbname)}'"
372
-
373
- ## CREATE
374
- execute "sudo mkdir -p /var/shared/fileadmin /var/shared/typo3temp /var/shared/uploads"
375
- execute "sudo chown -Rf vagrant.vagrant /var/shared/fileadmin /var/shared/typo3temp /var/shared/uploads"
376
- execute "sudo ln -s /var/www/local.typo3.org /var/current"
377
- end
378
-
379
- on roles(:all) do
380
- execute "sudo mysqladmin create #{fetch(:dbname)}"
381
- end
382
-
383
- invoke 'typo3:vagrant:fixknownhosts'
384
- invoke 'typo3:content:sync_db_from_production'
385
- invoke 'typo3:content:flush_cache_in_db'
386
- invoke 'typo3:helper:update_localconf'
387
- invoke 'typo3:helper:write_tsconstants' #OKE
388
-
389
- on roles(:all) do
390
- if fetch(:hs_default_upstream_php_engine)
391
- execute "sudo sed -i 's/set $upstream .*/set $upstream #{fetch(:hs_default_upstream_php_engine)};/g' /etc/nginx/sites-available/local.typo3.org.conf"
392
- end
393
- execute "sudo sed -i 's/root .*/root \"\\/var\\/www\\/local\\.typo3\\.org\\/dummy\\/\";/g' /etc/nginx/sites-available/local.typo3.org.conf"
394
- end
395
-
396
- invoke 'typo3:helper:restart_webserver'
397
- invoke 'typo3:content:sync_files_from_production'
398
-
399
- print <<MSG
400
-
401
- ----------------------------------------------------------------------
402
- The website seems to be succesfully installed in the Homestead Vagrant
403
- machine.
404
-
405
- Open the site at http://local.typo3.org"
406
-
407
- And live edit the website via the shortcut local.typo3.org in this
408
- directory
409
- ----------------------------------------------------------------------
410
- MSG
411
- end
412
-
413
- desc "purge .vagrant files"
414
- task "purge_machine" do
415
- print "OBSOLETE: you can run 'setup_machine' over and over again\n"
416
- end
417
-
418
- #desc "purge homestead site and database"
419
- task "purge_site" do
420
- print "OBSOLETE: you can run 'setup_site' over and over again\n"
421
- end
422
-
423
- task "check_branch" do
424
- current_branch = `git branch | grep \\* | cut -d ' ' -f2`.strip
425
- if current_branch != fetch(:branch)
426
- raise "current branch differs from homestead.rb configuration.\n see config/deploy/homestead.rb\n\n Current branch: #{current_branch}\n Homestead branch: #{fetch(:branch)} "
427
- end
428
- end
429
-
430
- task "fixknownhosts" do
431
- on roles(:all) do
432
- execute "ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} uptime"
433
- end
434
- end
435
-
436
- task "set_no_site" do
437
- on roles(:all) do
438
- execute "sudo sed -i 's/root .*/root \"\\/var\\/\";/g' /etc/nginx/sites-available/local.typo3.org.conf"
439
- execute "sudo su -c 'echo \"THERE IS NO DIRECTORY local.typo3.org ... YOU MAY WANT TO RUN cap homstead:setup_site\" > /var/index.php'"
440
- end
441
- end
442
- end
443
-
444
- namespace :test do
445
-
446
- desc "ssh_password_less_login_rsync"
447
- task :ssh_password_less_login_rsync do
448
- on roles(:all) do |server|
449
- begin
450
- capture("ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} uptime")
451
- rescue
452
- er = "password less login to #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} is not possible\n"
453
- er += "You need to fix this first.\n"
454
- er += "solution 1: ssh-add.\n"
455
- er += "solution 2: install public key on the remote server.\n"
456
-
457
- raise "#{er}"
458
- end
459
- end
460
- end
461
- end
462
-
463
- namespace :helper do
464
- desc "execute_post_deployment_commands"
465
- task :execute_post_deployment_commands do
466
- on roles(:all) do
467
-
468
- if fetch(:t3_post_deployment_commands)
469
- fetch(:t3_post_deployment_commands).each do |command|
470
- execute command
471
- end
472
- end
473
- end
474
-
475
- end #ENDTASK
476
-
477
- # remove deploy_to directory
478
- task :rm_deploy_to do
479
- on roles(:all) do
480
- execute "rm -Rf #{fetch(:deploy_to)}"
481
- end
482
- end
483
-
484
- # create typo3 dirs in shared
485
- task :setup_shared_typo3_dirs do
486
- on roles(:all) do
487
- execute "cd #{fetch(:deploy_to)} && mkdir -p shared/fileadmin shared/typo3temp shared/uploads"
488
- end
489
- end
490
-
491
- task :create_gitignore do
492
- on roles(:all) do
493
-
494
- ignorestring = "
495
- .DS_Store
496
- ._.DS_Store
497
- *~
498
- *.swp
499
- *.swo
500
- ENABLE_INSTALL_TOOL
501
- /VERSION
502
- temp_CACHE*.php
503
- deprecation_*.log
504
- "
505
- contents = StringIO.new(ignorestring)
506
- upload! contents, "#{fetch(:deploy_to)}/current/.gitignore"
507
- end
508
- end
509
-
510
- # when not in deploy latest ls releases/ -1 | sort -r | head -n 1
511
- task :current_relative_symlink do
512
- on roles(:all) do
513
- execute "cd #{fetch(:deploy_to)} && rm -f current"
514
- execute "cd #{fetch(:deploy_to)} && ln -s releases/`ls -1 releases/ | sort -r | head -n 1` current"
515
- end
516
- end
517
-
518
- desc "update LocalConf with correct db credentionals without SSH"
519
- task :update_localconf_local do
520
-
521
- system "echo '<?php' > dummy/typo3conf/AdditionalConfiguration.php"
522
-
523
- if fetch(:t3_add_unsafe_trusted_host_pattern)
524
- system "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"SYS\"][\"trustedHostsPattern\"] = \".*\";' >> dummy/typo3conf/AdditionalConfiguration.php"
525
- end
526
-
527
- if fetch(:t3_store_db_credentials_in_addionalconf)
528
- system "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"database\"] = \"#{fetch(:dbname)}\";' >> dummy/typo3conf/AdditionalConfiguration.php"
529
- system "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"host\"] = \"#{fetch(:dbhost)}\";' >> dummy/typo3conf/AdditionalConfiguration.php"
530
- system "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"password\"] = \"#{fetch(:dbpass)}\";' >> dummy/typo3conf/AdditionalConfiguration.php"
531
- system "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"username\"] = \"#{fetch(:dbuser)}\";' >> dummy/typo3conf/AdditionalConfiguration.php"
532
- else
533
- cmd1 =Typo3Helper::make_set_localconf_database_settings_command(fetch(:dbname),fetch(:dbuser),fetch(:dbpass),fetch(:dbhost))
534
- system "cd #{fetch(:deploy_to)} && #{cmd1}"
535
-
536
- cmd2 = "mv #{fetch(:typo3_v6_local_conf_path)}.tmp #{fetch(:typo3_v6_local_conf_path)}"
537
- system "cd #{fetch(:deploy_to)} && #{cmd2}"
538
- end
539
- end
540
-
541
-
542
- desc "update LocalConf with correct db credentionals"
543
- task :update_localconf do
544
-
545
- on roles(:all) do
546
-
547
- execute "echo '<?php' > #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
548
-
549
- if fetch(:t3_add_unsafe_trusted_host_pattern)
550
- execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"SYS\"][\"trustedHostsPattern\"] = \".*\";' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
551
- end
552
-
553
- if fetch(:t3_store_db_credentials_in_addionalconf)
554
- execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"database\"] = \"#{fetch(:dbname)}\";' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
555
- execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"host\"] = \"#{fetch(:dbhost)}\";' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
556
- execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"password\"] = \"#{fetch(:dbpass)}\";' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
557
- execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"username\"] = \"#{fetch(:dbuser)}\";' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
558
- execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"driver\"] = \"mysqli\";' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
559
-
560
- # extra stuff for typo3 8.7
561
- execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"dbname\"] = $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"database\"];' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
562
- execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"user\"] = $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"username\"];' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
563
- execute "echo ' $_tmp = $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"];' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
564
- execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"Connections\"] = [];' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
565
- execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"Connections\"][\"Default\"] = $_tmp;' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
566
-
567
- else
568
- cmd1 =Typo3Helper::make_set_localconf_database_settings_command(fetch(:dbname),fetch(:dbuser),fetch(:dbpass),fetch(:dbhost))
569
- execute "cd #{fetch(:deploy_to)} && #{cmd1}"
570
-
571
- cmd2 = "mv #{fetch(:typo3_v6_local_conf_path)}.tmp #{fetch(:typo3_v6_local_conf_path)}"
572
- execute "cd #{fetch(:deploy_to)} && #{cmd2}"
573
- end
574
- end
575
- end
576
-
577
- desc "write typo3conf/tsConstants.ts"
578
- task :write_tsconstants do
579
- on roles(:all) do
580
- execute "rm -f #{fetch(:deploy_to)}/current/dummy/typo3conf/tsConstants/*.ts || true"
581
- execute "mkdir -p #{fetch(:deploy_to)}/current/dummy/typo3conf/tsConstants"
582
- constantFile = "tsConstants_#{SecureRandom.hex}.ts"
583
- execute "echo '# Constants written by capistrano-typo3 at: #{Time.now.strftime("%d/%m/%Y %H:%M")}' > #{fetch(:deploy_to)}/current/dummy/typo3conf/tsConstants/#{constantFile}"
584
- fetch(:t3_ts_constants).each do | ts_const |
585
- execute "echo '#{ts_const}' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/tsConstants/#{constantFile}"
586
- end
587
- end
588
- end
589
-
590
- task :restart_webserver do
591
- on roles(:all) do
592
- execute fetch(:restart_webserver)
593
- end
594
- end
595
-
596
- end
597
81
  end