capistrano-typo3 0.4.10 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -8
- data/homestead_files/homestead.rb +0 -1
- data/lib/capistrano/tasks/deploy.cap +7 -1
- data/lib/capistrano/tasks/git.cap +0 -38
- data/lib/capistrano/tasks/typo3.cap +1 -517
- data/lib/capistrano/tasks/typo3content.cap +191 -0
- data/lib/capistrano/tasks/typo3helper.cap +139 -0
- data/lib/capistrano/tasks/typo3homestead.cap +49 -0
- data/lib/capistrano/tasks/typo3test.cap +22 -0
- data/lib/capistrano/tasks/typo3vagrant.cap +172 -0
- data/lib/capistrano/typo3.rb +5 -0
- data/lib/capistrano/typo3/version.rb +1 -1
- metadata +7 -4
- data/docs/homestead_nl.md +0 -164
- data/docs/install_from_scratch.md +0 -263
@@ -0,0 +1,191 @@
|
|
1
|
+
# vim: ft=ruby:sts=2:expandtab
|
2
|
+
|
3
|
+
namespace :typo3 do
|
4
|
+
|
5
|
+
namespace :content do
|
6
|
+
desc 'sync files from production'
|
7
|
+
task :sync_files_from_production do
|
8
|
+
on roles(:allow_syncfiles) do
|
9
|
+
if fetch(:t3_live_sync)['filesync']
|
10
|
+
fetch(:t3_live_sync)['filesync'].each do |key,command|
|
11
|
+
execute "cd #{fetch(:deploy_to)} && #{command}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'sync database from production to a local mysql'
|
18
|
+
task :sync_db_from_production_local_no_pass do
|
19
|
+
|
20
|
+
ignorestring = ""
|
21
|
+
|
22
|
+
if(:t3_db_sync_ignore_tables)
|
23
|
+
|
24
|
+
fetch(:t3_db_sync_ignore_tables).each do | ignore_tbl |
|
25
|
+
ignorestring = "#{ignorestring} --ignore-table=#{fetch(:t3_live_sync)['dbsync']['dbname']}.#{ignore_tbl}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# DUMP DATABASE TO IMAGE
|
30
|
+
system <<DBSYNC1
|
31
|
+
ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
|
32
|
+
'mysqldump -u#{fetch(:t3_live_sync)['dbsync']['dbuser']} \
|
33
|
+
-h#{fetch(:t3_live_sync)['dbsync']['dbhost']} \
|
34
|
+
-p#{fetch(:t3_live_sync)['dbsync']['dbpass']} \
|
35
|
+
#{ignorestring} \
|
36
|
+
#{fetch(:t3_live_sync)['dbsync']['dbname']} > /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}'
|
37
|
+
DBSYNC1
|
38
|
+
|
39
|
+
if(:t3_db_sync_ignore_tables)
|
40
|
+
fetch(:t3_db_sync_ignore_tables).each do | ignore_tbl |
|
41
|
+
|
42
|
+
system <<DBSYNC1
|
43
|
+
ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
|
44
|
+
'mysqldump -u#{fetch(:t3_live_sync)['dbsync']['dbuser']} \
|
45
|
+
-h#{fetch(:t3_live_sync)['dbsync']['dbhost']} \
|
46
|
+
-p#{fetch(:t3_live_sync)['dbsync']['dbpass']} \
|
47
|
+
--no-data \
|
48
|
+
#{fetch(:t3_live_sync)['dbsync']['dbname']} #{ignore_tbl} >> /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}'
|
49
|
+
DBSYNC1
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# COMPRESS IMAGE
|
54
|
+
system <<DBSYNC2
|
55
|
+
ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
|
56
|
+
'gzip -f /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}'
|
57
|
+
DBSYNC2
|
58
|
+
|
59
|
+
# TRANSFER IMAGE
|
60
|
+
system <<DBSYNC3
|
61
|
+
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 \
|
62
|
+
/tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz
|
63
|
+
DBSYNC3
|
64
|
+
|
65
|
+
# DECOMPRESS IMAGE
|
66
|
+
system <<DBSYNC4
|
67
|
+
gunzip -f /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz
|
68
|
+
DBSYNC4
|
69
|
+
|
70
|
+
# IMPORT AND REMOVE IMAGE
|
71
|
+
system <<DBSYNC5
|
72
|
+
mysql -u#{fetch(:dbuser)} -h#{fetch(:dbhost)} #{fetch(:dbname)} < /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']} && \
|
73
|
+
rm -f /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']}
|
74
|
+
DBSYNC5
|
75
|
+
|
76
|
+
# REMOVE IMAGE
|
77
|
+
system <<DBSYNC6
|
78
|
+
ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
|
79
|
+
'rm -f /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz'
|
80
|
+
DBSYNC6
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
desc 'sync database from production and run sql updates'
|
85
|
+
task :sync_db_from_production do
|
86
|
+
on roles(:allow_syncdatabase) do
|
87
|
+
|
88
|
+
ignorestring = ""
|
89
|
+
|
90
|
+
if(:t3_db_sync_ignore_tables)
|
91
|
+
|
92
|
+
fetch(:t3_db_sync_ignore_tables).each do | ignore_tbl |
|
93
|
+
ignorestring = "#{ignorestring} --ignore-table=#{fetch(:t3_live_sync)['dbsync']['dbname']}.#{ignore_tbl}"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# DUMP DATABASE TO IMAGE
|
98
|
+
execute <<DBSYNC1
|
99
|
+
ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
|
100
|
+
'mysqldump -u#{fetch(:t3_live_sync)['dbsync']['dbuser']} \
|
101
|
+
-h#{fetch(:t3_live_sync)['dbsync']['dbhost']} \
|
102
|
+
-p#{fetch(:t3_live_sync)['dbsync']['dbpass']} \
|
103
|
+
#{ignorestring} \
|
104
|
+
#{fetch(:t3_live_sync)['dbsync']['dbname']} > /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}'
|
105
|
+
DBSYNC1
|
106
|
+
|
107
|
+
if(:t3_db_sync_ignore_tables)
|
108
|
+
fetch(:t3_db_sync_ignore_tables).each do | ignore_tbl |
|
109
|
+
|
110
|
+
execute <<DBSYNC1
|
111
|
+
ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
|
112
|
+
'mysqldump -u#{fetch(:t3_live_sync)['dbsync']['dbuser']} \
|
113
|
+
-h#{fetch(:t3_live_sync)['dbsync']['dbhost']} \
|
114
|
+
-p#{fetch(:t3_live_sync)['dbsync']['dbpass']} \
|
115
|
+
--no-data \
|
116
|
+
#{fetch(:t3_live_sync)['dbsync']['dbname']} #{ignore_tbl} >> /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}'
|
117
|
+
DBSYNC1
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
# COMPRESS IMAGE
|
122
|
+
execute <<DBSYNC2
|
123
|
+
ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
|
124
|
+
'gzip -f /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}'
|
125
|
+
DBSYNC2
|
126
|
+
|
127
|
+
# TRANSFER IMAGE
|
128
|
+
execute <<DBSYNC3
|
129
|
+
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 \
|
130
|
+
/tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz
|
131
|
+
DBSYNC3
|
132
|
+
|
133
|
+
# DECOMPRESS IMAGE
|
134
|
+
execute <<DBSYNC4
|
135
|
+
gunzip -f /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz
|
136
|
+
DBSYNC4
|
137
|
+
|
138
|
+
# IMPORT AND REMOVE IMAGE
|
139
|
+
execute <<DBSYNC5
|
140
|
+
mysql -u#{fetch(:dbuser)} -h#{fetch(:dbhost)} -p#{fetch(:dbpass)} #{fetch(:dbname)} < /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']} && \
|
141
|
+
rm -f /tmp/.captypo3dump-dest-#{fetch(:t3_live_sync)['dbsync']['dbname']}
|
142
|
+
DBSYNC5
|
143
|
+
|
144
|
+
# REMOVE IMAGE
|
145
|
+
execute <<DBSYNC6
|
146
|
+
ssh #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} \
|
147
|
+
'rm -f /tmp/.captypo3dump-src-#{fetch(:t3_live_sync)['dbsync']['dbname']}.gz'
|
148
|
+
DBSYNC6
|
149
|
+
end
|
150
|
+
|
151
|
+
invoke 'typo3:content:sql_updates'
|
152
|
+
end
|
153
|
+
|
154
|
+
desc 'run necessary sql queries for environment'
|
155
|
+
task :sql_updates do
|
156
|
+
on roles(:allow_syncdatabase) do
|
157
|
+
if fetch(:t3_sql_updates)
|
158
|
+
fetch(:t3_sql_updates).each do |command|
|
159
|
+
execute DT3MySQL::mysql_execute(command)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
desc 'flush cache and session tables in database'
|
166
|
+
task :flush_cache_in_db do
|
167
|
+
on roles(:all) do
|
168
|
+
|
169
|
+
all_current_tables = capture(DT3MySQL::show_tables).split("\n")
|
170
|
+
|
171
|
+
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)
|
172
|
+
|
173
|
+
cache_tables.each do |table|
|
174
|
+
if all_current_tables.include?(table)
|
175
|
+
execute DT3MySQL::truncate_table(table)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
session_tables=%w(be_sessions fe_session_data fe_sessions)
|
180
|
+
session_tables.each do |table|
|
181
|
+
if all_current_tables.include?(table)
|
182
|
+
execute DT3MySQL::truncate_table(table)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
end
|
190
|
+
|
191
|
+
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# vim: ft=ruby:sts=2:expandtab
|
2
|
+
|
3
|
+
namespace :typo3 do
|
4
|
+
|
5
|
+
namespace :helper do
|
6
|
+
desc "execute_post_deployment_commands"
|
7
|
+
task :execute_post_deployment_commands do
|
8
|
+
on roles(:all) do
|
9
|
+
|
10
|
+
if fetch(:t3_post_deployment_commands)
|
11
|
+
fetch(:t3_post_deployment_commands).each do |command|
|
12
|
+
execute command
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end #ENDTASK
|
18
|
+
|
19
|
+
# remove deploy_to directory
|
20
|
+
task :rm_deploy_to do
|
21
|
+
on roles(:all) do
|
22
|
+
execute "rm -Rf #{fetch(:deploy_to)}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# create typo3 dirs in shared
|
27
|
+
task :setup_shared_typo3_dirs do
|
28
|
+
on roles(:all) do
|
29
|
+
execute "cd #{fetch(:deploy_to)} && mkdir -p shared/fileadmin shared/typo3temp shared/uploads"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
task :create_gitignore do
|
34
|
+
on roles(:all) do
|
35
|
+
|
36
|
+
ignorestring = "
|
37
|
+
.DS_Store
|
38
|
+
._.DS_Store
|
39
|
+
*~
|
40
|
+
*.swp
|
41
|
+
*.swo
|
42
|
+
ENABLE_INSTALL_TOOL
|
43
|
+
/VERSION
|
44
|
+
temp_CACHE*.php
|
45
|
+
deprecation_*.log
|
46
|
+
"
|
47
|
+
contents = StringIO.new(ignorestring)
|
48
|
+
upload! contents, "#{fetch(:deploy_to)}/current/.gitignore"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# when not in deploy latest ls releases/ -1 | sort -r | head -n 1
|
53
|
+
task :current_relative_symlink do
|
54
|
+
on roles(:all) do
|
55
|
+
execute "cd #{fetch(:deploy_to)} && rm -f current"
|
56
|
+
execute "cd #{fetch(:deploy_to)} && ln -s releases/`ls -1 releases/ | sort -r | head -n 1` current"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
desc "update LocalConf with correct db credentionals without SSH"
|
61
|
+
task :update_localconf_local do
|
62
|
+
|
63
|
+
system "echo '<?php' > dummy/typo3conf/AdditionalConfiguration.php"
|
64
|
+
|
65
|
+
if fetch(:t3_add_unsafe_trusted_host_pattern)
|
66
|
+
system "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"SYS\"][\"trustedHostsPattern\"] = \".*\";' >> dummy/typo3conf/AdditionalConfiguration.php"
|
67
|
+
end
|
68
|
+
|
69
|
+
if fetch(:t3_store_db_credentials_in_addionalconf)
|
70
|
+
system "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"database\"] = \"#{fetch(:dbname)}\";' >> dummy/typo3conf/AdditionalConfiguration.php"
|
71
|
+
system "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"host\"] = \"#{fetch(:dbhost)}\";' >> dummy/typo3conf/AdditionalConfiguration.php"
|
72
|
+
system "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"password\"] = \"#{fetch(:dbpass)}\";' >> dummy/typo3conf/AdditionalConfiguration.php"
|
73
|
+
system "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"username\"] = \"#{fetch(:dbuser)}\";' >> dummy/typo3conf/AdditionalConfiguration.php"
|
74
|
+
else
|
75
|
+
cmd1 =Typo3Helper::make_set_localconf_database_settings_command(fetch(:dbname),fetch(:dbuser),fetch(:dbpass),fetch(:dbhost))
|
76
|
+
system "cd #{fetch(:deploy_to)} && #{cmd1}"
|
77
|
+
|
78
|
+
cmd2 = "mv #{fetch(:typo3_v6_local_conf_path)}.tmp #{fetch(:typo3_v6_local_conf_path)}"
|
79
|
+
system "cd #{fetch(:deploy_to)} && #{cmd2}"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
desc "update LocalConf with correct db credentionals"
|
85
|
+
task :update_localconf do
|
86
|
+
|
87
|
+
on roles(:all) do
|
88
|
+
|
89
|
+
execute "echo '<?php' > #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
|
90
|
+
|
91
|
+
if fetch(:t3_add_unsafe_trusted_host_pattern)
|
92
|
+
execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"SYS\"][\"trustedHostsPattern\"] = \".*\";' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
|
93
|
+
end
|
94
|
+
|
95
|
+
if fetch(:t3_store_db_credentials_in_addionalconf)
|
96
|
+
execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"database\"] = \"#{fetch(:dbname)}\";' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
|
97
|
+
execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"host\"] = \"#{fetch(:dbhost)}\";' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
|
98
|
+
execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"password\"] = \"#{fetch(:dbpass)}\";' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
|
99
|
+
execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"username\"] = \"#{fetch(:dbuser)}\";' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
|
100
|
+
execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"driver\"] = \"mysqli\";' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
|
101
|
+
|
102
|
+
# extra stuff for typo3 8.7
|
103
|
+
execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"dbname\"] = $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"database\"];' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
|
104
|
+
execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"user\"] = $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"username\"];' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
|
105
|
+
execute "echo ' $_tmp = $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"];' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
|
106
|
+
execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"Connections\"] = [];' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
|
107
|
+
execute "echo ' $GLOBALS[\"TYPO3_CONF_VARS\"][\"DB\"][\"Connections\"][\"Default\"] = $_tmp;' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/AdditionalConfiguration.php"
|
108
|
+
|
109
|
+
else
|
110
|
+
cmd1 =Typo3Helper::make_set_localconf_database_settings_command(fetch(:dbname),fetch(:dbuser),fetch(:dbpass),fetch(:dbhost))
|
111
|
+
execute "cd #{fetch(:deploy_to)} && #{cmd1}"
|
112
|
+
|
113
|
+
cmd2 = "mv #{fetch(:typo3_v6_local_conf_path)}.tmp #{fetch(:typo3_v6_local_conf_path)}"
|
114
|
+
execute "cd #{fetch(:deploy_to)} && #{cmd2}"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
desc "write typo3conf/tsConstants.ts"
|
120
|
+
task :write_tsconstants do
|
121
|
+
on roles(:all) do
|
122
|
+
execute "rm -f #{fetch(:deploy_to)}/current/dummy/typo3conf/tsConstants/*.ts || true"
|
123
|
+
execute "mkdir -p #{fetch(:deploy_to)}/current/dummy/typo3conf/tsConstants"
|
124
|
+
constantFile = "tsConstants_#{SecureRandom.hex}.ts"
|
125
|
+
execute "echo '# Constants written by capistrano-typo3 at: #{Time.now.strftime("%d/%m/%Y %H:%M")}' > #{fetch(:deploy_to)}/current/dummy/typo3conf/tsConstants/#{constantFile}"
|
126
|
+
fetch(:t3_ts_constants).each do | ts_const |
|
127
|
+
execute "echo '#{ts_const}' >> #{fetch(:deploy_to)}/current/dummy/typo3conf/tsConstants/#{constantFile}"
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
task :restart_webserver do
|
133
|
+
on roles(:all) do
|
134
|
+
execute fetch(:restart_webserver)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# vim: ft=ruby:sts=2:expandtab
|
2
|
+
|
3
|
+
namespace :typo3 do
|
4
|
+
|
5
|
+
namespace :homestead do
|
6
|
+
|
7
|
+
desc "init site dirs from scratch (new installs)"
|
8
|
+
task "init_site_dirs" do
|
9
|
+
invoke 'typo3:vagrant:check_branch'
|
10
|
+
|
11
|
+
on roles(:all) do
|
12
|
+
## PURGE IF NEEDED
|
13
|
+
execute "sudo rm -Rf #{fetch(:deploy_to)}/shared/fileadmin #{fetch(:deploy_to)}/shared/typo3temp #{fetch(:deploy_to)}/shared/uploads"
|
14
|
+
execute "sudo mysql -e 'DROP DATABASE IF EXISTS #{fetch(:dbname)}'"
|
15
|
+
|
16
|
+
## CREATE
|
17
|
+
execute "sudo mkdir -p #{fetch(:deploy_to)}/shared/fileadmin #{fetch(:deploy_to)}/shared/typo3temp #{fetch(:deploy_to)}/shared/uploads"
|
18
|
+
execute "sudo chown -Rf vagrant.vagrant #{fetch(:deploy_to)}/shared/fileadmin #{fetch(:deploy_to)}/shared/typo3temp #{fetch(:deploy_to)}/shared/uploads"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
desc "init site database from scratch (new installs)"
|
24
|
+
task "init_site_database" do
|
25
|
+
invoke 'typo3:vagrant:check_branch'
|
26
|
+
|
27
|
+
on roles(:all) do
|
28
|
+
execute "sudo mysql -e 'CREATE DATABASE #{fetch(:dbname)} CHARACTER SET utf8 COLLATE utf8_general_ci;'"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "setup site (existing installs)"
|
33
|
+
task "setup_site" do
|
34
|
+
invoke 'typo3:homestead:init_site_dirs'
|
35
|
+
invoke 'typo3:homestead:init_site_database'
|
36
|
+
|
37
|
+
invoke 'deploy:fixknownhosts'
|
38
|
+
invoke 'typo3:content:sync_db_from_production'
|
39
|
+
invoke 'typo3:content:flush_cache_in_db'
|
40
|
+
invoke 'typo3:helper:update_localconf'
|
41
|
+
invoke 'typo3:helper:write_tsconstants'
|
42
|
+
invoke 'typo3:helper:restart_webserver'
|
43
|
+
invoke 'typo3:content:sync_files_from_production'
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# vim: ft=ruby:sts=2:expandtab
|
2
|
+
|
3
|
+
namespace :typo3 do
|
4
|
+
namespace :test do
|
5
|
+
|
6
|
+
desc "ssh_password_less_login_rsync"
|
7
|
+
task :ssh_password_less_login_rsync do
|
8
|
+
on roles(:all) do |server|
|
9
|
+
begin
|
10
|
+
capture("ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} uptime")
|
11
|
+
rescue
|
12
|
+
er = "password less login to #{fetch(:t3_live_sync)['dbsync']['ssh_user']}@#{fetch(:t3_live_sync)['dbsync']['ssh_server']} is not possible\n"
|
13
|
+
er += "You need to fix this first.\n"
|
14
|
+
er += "solution 1: ssh-add.\n"
|
15
|
+
er += "solution 2: install public key on the remote server.\n"
|
16
|
+
|
17
|
+
raise "#{er}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
# vim: ft=ruby:sts=2:expandtab
|
2
|
+
|
3
|
+
namespace :typo3 do
|
4
|
+
|
5
|
+
namespace :vagrant do
|
6
|
+
|
7
|
+
desc "add mailhog to AdditionalConfiguration.php"
|
8
|
+
task "init_additional_conf_add_mailhog" do
|
9
|
+
on roles(:all) do
|
10
|
+
# execute "cd #{fetch(:deploy_to)}/current/dummy && echo '$GLOBALS[\"TYPO3_CONF_VARS\"][\"MAIL\"][\"transport\"] = \"smtp\";' >> typo3conf/AdditionalConfiguration.php"
|
11
|
+
# execute "cd #{fetch(:deploy_to)}/current/dummy && echo '$GLOBALS[\"TYPO3_CONF_VARS\"][\"MAIL\"][\"transport_smtp_server\"] = \"localhost:1025\";' >> typo3conf/AdditionalConfiguration.php"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "when homestead is not yet configured"
|
16
|
+
task "init_homestead_conf" do
|
17
|
+
invoke 'typo3:vagrant:check_branch'
|
18
|
+
sh "mkdir -p config"
|
19
|
+
sh "cd config && curl -O https://raw.githubusercontent.com/t3labcom/capistrano-typo3/master/homestead_files/vagrant.yml"
|
20
|
+
sh "cd config/deploy && curl -O https://raw.githubusercontent.com/t3labcom/capistrano-typo3/master/homestead_files/homestead.rb"
|
21
|
+
sh "curl -O https://raw.githubusercontent.com/t3labcom/capistrano-typo3/master/homestead_files/Vagrantfile"
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "setup new homestead vagrant machine for TYPO3 development"
|
25
|
+
task "setup_machine" do
|
26
|
+
invoke 'typo3:vagrant:check_branch'
|
27
|
+
|
28
|
+
if `vagrant status | grep running`.strip != ""
|
29
|
+
sh "vagrant destroy"
|
30
|
+
end
|
31
|
+
|
32
|
+
sh "rm -f local.typo3.org"
|
33
|
+
sh "rm -Rf .vagrant"
|
34
|
+
|
35
|
+
if `vagrant plugin list | grep vagrant-bind`.include? 'vagrant-bindfs'
|
36
|
+
print "vagrant bindfs plugin is already installed\n"
|
37
|
+
else
|
38
|
+
sh "vagrant plugin install vagrant-bindfs"
|
39
|
+
end
|
40
|
+
|
41
|
+
sh "vagrant up"
|
42
|
+
|
43
|
+
on roles(:all) do
|
44
|
+
execute "sudo aptitude update"
|
45
|
+
execute "sudo aptitude install ruby-dev make -y"
|
46
|
+
execute "sudo gem install bundler"
|
47
|
+
end
|
48
|
+
|
49
|
+
invoke 'typo3:vagrant:set_no_site'
|
50
|
+
invoke 'typo3:helper:restart_webserver'
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
desc "init site from scratch (new installs)"
|
55
|
+
task "init_site" do
|
56
|
+
invoke 'typo3:vagrant:check_branch'
|
57
|
+
|
58
|
+
on roles(:all) do
|
59
|
+
## PURGE IF NEEDED
|
60
|
+
execute "sudo rm -Rf /var/shared/fileadmin /var/shared/typo3temp /var/shared/uploads"
|
61
|
+
execute "sudo rm -f /var/current"
|
62
|
+
execute "sudo mysql -e 'DROP DATABASE IF EXISTS #{fetch(:dbname)}'"
|
63
|
+
|
64
|
+
## CREATE
|
65
|
+
execute "sudo mkdir -p /var/shared/fileadmin /var/shared/typo3temp /var/shared/uploads"
|
66
|
+
execute "sudo chown -Rf vagrant.vagrant /var/shared/fileadmin /var/shared/typo3temp /var/shared/uploads"
|
67
|
+
execute "sudo ln -s /var/www/local.typo3.org /var/current"
|
68
|
+
end
|
69
|
+
|
70
|
+
on roles(:all) do
|
71
|
+
execute "sudo mysqladmin create #{fetch(:dbname)}"
|
72
|
+
end
|
73
|
+
|
74
|
+
on roles(:all) do
|
75
|
+
if fetch(:hs_default_upstream_php_engine)
|
76
|
+
execute "sudo sed -i 's/set $upstream .*/set $upstream #{fetch(:hs_default_upstream_php_engine)};/g' /etc/nginx/sites-available/local.typo3.org.conf"
|
77
|
+
end
|
78
|
+
execute "sudo sed -i 's/root .*/root \"\\/var\\/www\\/local\\.typo3\\.org\\/dummy\\/\";/g' /etc/nginx/sites-available/local.typo3.org.conf"
|
79
|
+
end
|
80
|
+
|
81
|
+
invoke 'typo3:helper:restart_webserver'
|
82
|
+
|
83
|
+
print <<MSG
|
84
|
+
|
85
|
+
----------------------------------------------------------------------
|
86
|
+
The website conf seems to be succesfully installed in the Homestead Vagrant
|
87
|
+
machine.
|
88
|
+
|
89
|
+
Open the site at http://local.typo3.org"
|
90
|
+
|
91
|
+
you can now install TYPO3
|
92
|
+
|
93
|
+
----------------------------------------------------------------------
|
94
|
+
MSG
|
95
|
+
end
|
96
|
+
|
97
|
+
desc "setup site (remote exists)"
|
98
|
+
task "setup_site" do
|
99
|
+
invoke 'typo3:vagrant:check_branch'
|
100
|
+
|
101
|
+
on roles(:all) do
|
102
|
+
## PURGE IF NEEDED
|
103
|
+
execute "sudo rm -Rf /var/shared/fileadmin /var/shared/typo3temp /var/shared/uploads"
|
104
|
+
execute "sudo rm -f /var/current"
|
105
|
+
execute "sudo mysql -e 'DROP DATABASE IF EXISTS #{fetch(:dbname)}'"
|
106
|
+
|
107
|
+
## CREATE
|
108
|
+
execute "sudo mkdir -p /var/shared/fileadmin /var/shared/typo3temp /var/shared/uploads"
|
109
|
+
execute "sudo chown -Rf vagrant.vagrant /var/shared/fileadmin /var/shared/typo3temp /var/shared/uploads"
|
110
|
+
execute "sudo ln -s /var/www/local.typo3.org /var/current"
|
111
|
+
end
|
112
|
+
|
113
|
+
on roles(:all) do
|
114
|
+
execute "sudo mysqladmin create #{fetch(:dbname)}"
|
115
|
+
end
|
116
|
+
|
117
|
+
invoke 'deploy:fixknownhosts'
|
118
|
+
invoke 'typo3:content:sync_db_from_production'
|
119
|
+
invoke 'typo3:content:flush_cache_in_db'
|
120
|
+
invoke 'typo3:helper:update_localconf'
|
121
|
+
invoke 'typo3:helper:write_tsconstants' #OKE
|
122
|
+
|
123
|
+
on roles(:all) do
|
124
|
+
if fetch(:hs_default_upstream_php_engine)
|
125
|
+
execute "sudo sed -i 's/set $upstream .*/set $upstream #{fetch(:hs_default_upstream_php_engine)};/g' /etc/nginx/sites-available/local.typo3.org.conf"
|
126
|
+
end
|
127
|
+
execute "sudo sed -i 's/root .*/root \"\\/var\\/www\\/local\\.typo3\\.org\\/dummy\\/\";/g' /etc/nginx/sites-available/local.typo3.org.conf"
|
128
|
+
end
|
129
|
+
|
130
|
+
invoke 'typo3:helper:restart_webserver'
|
131
|
+
invoke 'typo3:content:sync_files_from_production'
|
132
|
+
|
133
|
+
print <<MSG
|
134
|
+
|
135
|
+
----------------------------------------------------------------------
|
136
|
+
The website seems to be succesfully installed in the Homestead Vagrant
|
137
|
+
machine.
|
138
|
+
|
139
|
+
Open the site at http://local.typo3.org"
|
140
|
+
|
141
|
+
And live edit the website via the shortcut local.typo3.org in this
|
142
|
+
directory
|
143
|
+
----------------------------------------------------------------------
|
144
|
+
MSG
|
145
|
+
end
|
146
|
+
|
147
|
+
desc "purge .vagrant files"
|
148
|
+
task "purge_machine" do
|
149
|
+
print "OBSOLETE: you can run 'setup_machine' over and over again\n"
|
150
|
+
end
|
151
|
+
|
152
|
+
#desc "purge homestead site and database"
|
153
|
+
task "purge_site" do
|
154
|
+
print "OBSOLETE: you can run 'setup_site' over and over again\n"
|
155
|
+
end
|
156
|
+
|
157
|
+
task "check_branch" do
|
158
|
+
current_branch = `git branch | grep \\* | cut -d ' ' -f2`.strip
|
159
|
+
if current_branch != fetch(:branch)
|
160
|
+
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)} "
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
task "set_no_site" do
|
165
|
+
on roles(:all) do
|
166
|
+
execute "sudo sed -i 's/root .*/root \"\\/var\\/\";/g' /etc/nginx/sites-available/local.typo3.org.conf"
|
167
|
+
execute "sudo su -c 'echo \"THERE IS NO DIRECTORY local.typo3.org ... YOU MAY WANT TO RUN cap homstead:setup_site\" > /var/index.php'"
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|