-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdeploy.rb
More file actions
63 lines (54 loc) · 1.87 KB
/
deploy.rb
File metadata and controls
63 lines (54 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
node[:deploy].each do |application, deploy|
if deploy[:application_type] != 'php'
Chef::Log.debug("Skipping deploy::symfony2 for application #{application} as it is not an PHP app")
next
end
if not File.exists?("#{deploy[:current_path]}/deps") && File.exists?("#{deploy[:current_path]}/deps.lock")
Chef::Log.debug("Skipping deploy::symfony2 for application #{application} as it is not a Symfony2 app")
next
end
execute "php bin/vendors update" do
user "deploy"
cwd deploy[:current_path]
command "php bin/vendors update"
action :run
end
execute "clearing the symfony app cache" do
user "deploy"
cwd deploy[:current_path]
command "php app/console cache:clear --env=scalarium"
action :run
end
execute "execute db migrations" do
user "deploy"
cwd deploy[:current_path]
command "php app/console doctrine:migrations:migrate --no-interaction --env=scalarium"
action :run
end
execute "installing assets" do
user "deploy"
cwd deploy[:current_path]
command "php app/console assets:install web --env=scalarium"
action :run
end
execute "chown app cache and log dirs to deploy:www-data" do
user "root"
cwd deploy[:current_path]
command "mkdir -p app/cache; chown -R deploy:www-data app/cache; chown -R deploy:www-data app/logs; find app/cache -type d | xargs -r chmod 0770; find app/cache -type f | xargs -r chmod 0660; find app/logs -type d | xargs -r chmod 0770; find app/logs -type f | xargs -r chmod 0660;"
action :run
end
template "#{node[:apache][:dir]}/sites-available/#{application}.conf" do
source "symfony2-vhost.conf.erb"
mode 0644
owner "root"
group "root"
variables(
:appname => application,
:appdir => deploy[:current_path]
)
end
apache_site "#{application}.conf"
apache_site "default" do
enable false
end
end