capistrano-typo3 0.2.4 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,193 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ require 'yaml'
5
+
6
+ path = "#{File.dirname(__FILE__)}"
7
+
8
+ # Get machine configuration
9
+ configuration = {}
10
+ if File.exist?(path + '/config/vagrant.yml')
11
+ configuration = YAML::load(File.read(path + '/config/vagrant.yml')) || {}
12
+ end
13
+
14
+ # Setup defaults
15
+ sets = ['synced_folders']
16
+ sets.each do |element|
17
+ unless configuration.has_key?(element)
18
+ configuration[element] = {}
19
+ end
20
+ end
21
+ booleans = ['cores', 'debug', 'memory', 'forward_ports', 'private_interface']
22
+ booleans.each do |element|
23
+ unless configuration.has_key?(element)
24
+ configuration[element] = false
25
+ end
26
+ end
27
+
28
+ # Get host os type
29
+ host = RbConfig::CONFIG['host_os']
30
+
31
+ # Give VM 1/4 system memory & access to all cpu cores on the host
32
+ if host =~ /darwin/
33
+ cpus = `sysctl -n hw.physicalcpu`.to_i
34
+ # sysctl returns Bytes and we need to convert to MB
35
+ mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4
36
+ elsif host =~ /linux/
37
+ cpus = `nproc`.to_i
38
+ # meminfo shows KB and we need to convert to MB
39
+ mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 4
40
+ else # sorry Windows folks, I can't help you
41
+ cpus = 1
42
+ mem = 1024
43
+ end
44
+
45
+ # You can ask for more memory and cores when creating your Vagrant machine:
46
+ MEMORY = configuration['memory'] || mem
47
+ CORES = configuration['cores'] || cpus
48
+
49
+ # Enforce lower bound of memory to 1024 MB
50
+ if MEMORY.to_i < 1024
51
+ MEMORY = 1024
52
+ end
53
+
54
+ # Network
55
+ PRIVATE_NETWORK = configuration['private_interface'] || '192.168.144.120'
56
+
57
+ # Determine if we need to forward ports
58
+ FORWARD = configuration['forward_ports'] || 0
59
+
60
+ # Boot timeout
61
+ BOOT_TIMEOUT = configuration['boot_timeout'] || 600
62
+
63
+ # Boot the box with the gui enabled
64
+ DEBUG = !!configuration['debug'] || false
65
+
66
+ # Throw an error if required Vagrant plugins are not installed
67
+ # plugins = { 'vagrant-hostsupdater' => nil }
68
+ #
69
+ # plugins.each do |plugin, version|
70
+ # unless Vagrant.has_plugin? plugin
71
+ # error = "The '#{plugin}' plugin is not installed! Try running:\nvagrant plugin install #{plugin}"
72
+ # error += " --plugin-version #{version}" if version
73
+ # raise error
74
+ # end
75
+ # end
76
+
77
+ $script = <<SCRIPT
78
+ echo "============================================================="
79
+ echo "All done! You can now try any of these sites:"
80
+ echo " "
81
+ echo "TYPO3 (admin / supersecret)"
82
+ echo "http://6.2.local.typo3.org/typo3/"
83
+ echo "http://7.6.local.typo3.org/typo3/"
84
+ echo "http://8.0.local.typo3.org/typo3/"
85
+ echo "http://dev-master.local.typo3.org/typo3/"
86
+ echo "http://review.local.typo3.org/typo3/"
87
+ echo " "
88
+ echo "NEOS (admin / supersecret)"
89
+ echo "http://1.2.local.neos.io/neos/"
90
+ echo "http://2.0.local.neos.io/neos/"
91
+ echo "http://dev-master.local.neos.io/neos/"
92
+ echo " "
93
+ echo "MailHog"
94
+ echo "http://mail.local.typo3.org/"
95
+ echo " "
96
+ echo "ElasticSearch"
97
+ echo "http://elastic.local.typo3.org/"
98
+ echo " "
99
+ echo "XHProf GUI"
100
+ echo "http://xhprof.local.typo3.org/"
101
+ echo "============================================================="
102
+ SCRIPT
103
+
104
+ # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
105
+ VAGRANTFILE_API_VERSION = 2
106
+
107
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
108
+ config.vm.box = 'Michiel/Development'
109
+ config.vm.boot_timeout = BOOT_TIMEOUT
110
+ config.vm.box_version = '=0.2.70'
111
+ # If you have no Internet access (can not resolve *.local.typo3.org), you can use host aliases:
112
+ # config.hostsupdater.aliases = [
113
+ # '6.2.local.typo3.org',
114
+ # '7.6.local.typo3.org',
115
+ # '8.0.local.typo3.org'
116
+ # ]
117
+
118
+ # Network
119
+ config.vm.network :private_network, ip: PRIVATE_NETWORK
120
+ if FORWARD.to_i > 0
121
+ config.vm.network :forwarded_port, guest: 80, host: 8080
122
+ config.vm.network :forwarded_port, guest: 3306, host: 33060
123
+ config.vm.network :forwarded_port, guest: 35729, host: 35729
124
+ end
125
+
126
+ # SSH
127
+ config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" # avoids 'stdin: is not a tty' error.
128
+ config.ssh.forward_agent = true
129
+ # config.vm.provision "shell", inline: "echo -e '#{File.read("#{Dir.home}/.ssh/id_rsa")}' > '/home/vagrant/.ssh/id_rsa'"
130
+ # config.ssh.username = "root"
131
+ # config.ssh.private_key_path = "phusion.key"
132
+
133
+ # Do not auto-update the guest box additions
134
+ if Vagrant.has_plugin?("vagrant-vbguest")
135
+ config.vbguest.auto_update = false
136
+ end
137
+
138
+ # Virtualbox
139
+ config.vm.provider :virtualbox do |vb|
140
+ vb.gui = !!DEBUG
141
+ vb.memory = MEMORY.to_i
142
+ vb.customize ["modifyvm", :id, "--cpuexecutioncap", "90"]
143
+ vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
144
+ vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
145
+ vb.customize ["modifyvm", :id, "--pae", "on"]
146
+ vb.customize ["modifyvm", :id, "--cpus", CORES.to_i]
147
+ vb.customize ["modifyvm", :id, "--ostype", "Ubuntu_64"]
148
+
149
+ # If more cpu's are requested than are available; enable ioapic
150
+ if CORES.to_i > cpus
151
+ vb.customize ["modifyvm", :id, "--ioapic", "on"]
152
+ end
153
+ end
154
+
155
+ # Vmware Fusion
156
+ config.vm.provider :vmware_fusion do |v, override|
157
+ override.vm.box = "Michiel/Development"
158
+ v.vmx["memsize"] = MEMORY.to_i
159
+ v.vmx["numvcpus"] = CORES.to_i
160
+ end
161
+
162
+ # Parallels
163
+ config.vm.provider :parallels do |v, override|
164
+ v.customize ["set", :id, "--memsize", MEMORY, "--cpus", CORES]
165
+ end
166
+
167
+ # Show information what to do after the machine has booted
168
+ config.vm.provision "shell", inline: $script, run: "always"
169
+
170
+ # Setup synced folders
171
+ configuration['synced_folders'].each do |folder|
172
+ if host =~ /(darwin|linux)/
173
+ #config.vm.synced_folder folder['src'], folder['target'],
174
+ config.vm.synced_folder folder['src'], '/mnt',
175
+ id: folder['name'],
176
+ :nfs => true,
177
+ :mount_options => ['vers=3,udp,noacl,nocto,nosuid,nodev,nolock,noatime,nodiratime,rw'],
178
+ :linux__nfs_options => ['no_root_squash,rw,no_subtree_check']
179
+ config.bindfs.bind_folder "/mnt", folder["target"], o: 'nonempty'
180
+ else
181
+ config.vm.synced_folder folder['target'], folder['src']
182
+ end
183
+ end
184
+
185
+
186
+ # Disable default shared folder
187
+ config.vm.synced_folder ".", "/vagrant", disabled: true
188
+
189
+ # Ensure proper permissions for nfs mounts
190
+ config.nfs.map_uid = Process.uid
191
+ config.nfs.map_gid = Process.gid
192
+
193
+ end
@@ -0,0 +1,35 @@
1
+ server 'localhost', roles: %w{web allow_syncfiles allow_syncdatabase}, port: 2222
2
+ set :user, 'vagrant'
3
+ set :stage, :homestead
4
+ set :deploy_to, '/var'
5
+ set :ssh_options, { user: 'vagrant', port: 2222, keys: ['.vagrant/machines/default/virtualbox/private_key'] }
6
+ set :tmp_dir, "/tmp"
7
+ set :bundle_executable, "/usr/local/bin/bundle"
8
+ set :restart_webserver, "sudo service nginx restart"
9
+
10
+ set :branch, "developer"
11
+
12
+ set :git_no_cache, 1
13
+
14
+ set :t3_store_db_credentials_in_addionalconf, 1
15
+ set :t3_add_unsafe_trusted_host_pattern, 1
16
+ set :t3_dont_upgrade_source, 1
17
+
18
+ set :hs_default_upstream_php_engine, 'php56'
19
+
20
+ set :main_domain_name, 'local.typo3.org'
21
+ set :dbname, 'captypo3homestead'
22
+ set :dbuser, 'root'
23
+ set :dbpass, 'supersecret'
24
+ set :dbhost, 'localhost'
25
+
26
+ sync_ignore_items = [
27
+ # '*.pdf'
28
+ ]
29
+ sync_ignore = ''
30
+ sync_ignore_items.each do | ignore_item |
31
+ sync_ignore << "--exclude '#{ignore_item}' "
32
+ end
33
+
34
+ set :t3_rsync_ignore, sync_ignore
35
+ set :t3_protocol, "http"
@@ -0,0 +1,62 @@
1
+ ---
2
+ # Memory:
3
+ #
4
+ # By default 25% of host system memory will be allocated to the guest. But you
5
+ # may override that amount by setting a fixed value here. A lower limit of
6
+ # 1024 MB is always enforced.
7
+ # memory: 2048
8
+
9
+ # Cores:
10
+ #
11
+ # By default all cores available on the host system will be used. Please take
12
+ # care that specifying more cores than you have available in your host host
13
+ # system, may actually 'reduce' performance.
14
+ # cores: 2
15
+
16
+ ## Boot Timeout
17
+ #
18
+ # The time in seconds that Vagrant will wait for the machine to boot.
19
+ # boot_timeout: 600
20
+
21
+ # Debug:
22
+ #
23
+ # If debug is enabled, the virtualbox gui will be shown.
24
+ # debug: no
25
+
26
+ # Forward ports:
27
+ #
28
+ # Should any ports be forwarded to the host system? - generally not needed
29
+ # forward_ports: no
30
+
31
+ # Synced folders:
32
+ #
33
+ # Host system folders (src) that will be mounted on the guest system (target).
34
+ # Homestead installs all sites and sources in the /var/www/ folder. So for ease
35
+ # of use we recomend to mount a single host 'Development' folder on /var/www/.
36
+ # Linux and OSX users will get the benefit of an NFS mount, but Windows users
37
+ # will get the default Vagrant shared folder. SMB may also work fine in the
38
+ # future.
39
+ #
40
+ # But...
41
+ # If you want a SUPER fast vm, you can leave this set empty. No folders will be
42
+ # shared from host to guest. You will have to set up your ide to access the
43
+ # homestead box just as if it was a regular remote server. This will be fastest
44
+ # because file intensive actions like class inspections etc. will take place on
45
+ # the 'native' filesystem instead of over nfs or another 'mounted' filesystem.
46
+ #synced_folders:
47
+ # - name: Development
48
+ # src: ~/Projects/TYPO3/Development
49
+ # target: /var/www
50
+ synced_folders:
51
+ - name: Development
52
+ src: .
53
+ target: /var/www/local.typo3.org
54
+
55
+ # IP:
56
+ #
57
+ # The IP address of local network interface. This defaults to 192.168.144.120
58
+ # which happens to be the ip pointed to by *.local.typo3.org. You are advised
59
+ # to leave this untouched unless you actually have a network collision. In this
60
+ # case you will need to take care of mapping your own hostname aliasses in the
61
+ # Vagrantfile
62
+ # private_interface: "192.168.144.120"
@@ -51,5 +51,12 @@ namespace :git do
51
51
  end
52
52
  end
53
53
 
54
+ desc "remove remote git cache repository"
55
+ task :remove_git_cache_repo do
56
+ on roles(:all) do
57
+ execute "cd #{fetch(:deploy_to)} && rm -Rf repo"
58
+ end
59
+ end
60
+
54
61
 
55
62
  end