-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.helpers.xml
207 lines (183 loc) · 7.54 KB
/
build.helpers.xml
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<?xml version="1.0" encoding="UTF-8"?>
<project name="helpers" default="help">
<!-- Required properties -->
<property name="symfony.env" value="prod" />
<!-- Targets that assign properties -->
<target name="symfony.stage.properties" >
<property name="symfony.env" value="stage" override="true" />
</target>
<!-- postcache -->
<target name="postcache"
depends="refresh_vendors_direct"
description="postcache deploy hook" />
<!-- postdeploy targets -->
<target name="post_deploy"
depends="migrate,
assetic_dump,
clear_cache"
description="Execute post deployment utilities on production" />
<target name="post_deploy.staging"
depends="staging.properties,
symfony.stage.properties,
post_deploy"
description="Execute post deployment utilities on staging" />
<!-- refresh vendors distributed -->
<target name="refresh_vendors_distributed"
description="Refreshes the vendors" >
<exec dir="${project.basedir}/${build.target}/cached-copy"
passthru="true"
command="bin/vendors install" />
</target>
<!-- refresh vendors direct -->
<target name="refresh_vendors_direct"
description="Refreshes the vendors" >
<property name="command"
value="(
cd ${deploy.path}/${build.target}/cached-copy &&
bin/vendors install
)"
override="true" />
<foreach list="${deploy.servers}"
param="deploy.server"
target="deploy.remotecmd" />
</target>
<!-- doctrine:migrations:migrate -->
<target name="migrate"
description="Run migrations on production servers" >
<property name="command"
value="(
cd ${deploy.path}/current/app &&
./console --no-ansi --no-interaction --env=${symfony.env} doctrine:migrations:migrate
)"
override="true" />
<foreach list="${deploy.servers}"
param="deploy.server"
target="deploy.remotecmd" />
</target>
<!-- assets:install -->
<!-- assetic:dump -->
<target name="assetic_dump"
description="Warm assets on production servers" >
<property name="command"
value="(
cd ${deploy.path}/current/app &&
./console --no-ansi --env=${symfony.env} --symlink assets:install ../web &&
./console --no-ansi --env=${symfony.env} assetic:dump
)"
override="true" />
<foreach list="${deploy.servers}"
param="deploy.server"
target="deploy.remotecmd" />
</target>
<!-- cache:clear -->
<!-- cache:warmup -->
<!-- fix cache permissions assumes that the webserver is in the same group as the owner -->
<target name="clear_cache"
description="dump and warm cache on production servers" >
<property name="command"
value="(
cd ${deploy.path}/current/app &&
./console cache:clear --no-warmup &&
./console cache:warmup --no-ansi &&
chmod -R 770 cache/ &&
chmod -R 770 logs/
)"
override="true" />
<foreach list="${deploy.servers}"
param="deploy.server"
target="deploy.remotecmd" />
</target>
<target name="stop_jobqueue"
description="Stops the jobqueue daemon in production" >
<property name="command"
value="(
cd ${deploy.path}/current/app &&
./console --no-ansi --env=${symfony.env} jobqueue:stop
)"
override="true" />
<foreach list="${deploy.servers}"
param="deploy.server"
target="deploy.remotecmd" />
</target>
<target name="stop_jobqueue.staging"
description="Syncs the database in staging"
depends="staging.properties,
symfony.stage.properties,
stop_jobqueue" />
<target name="start_jobqueue"
description="Syncs the database in production" >
<property name="command"
value="(
cd ${deploy.path}/current/app &&
./console --no-ansi --env=${symfony.env} jobqueue:start
)"
override="true" />
<foreach list="${deploy.servers}"
param="deploy.server"
target="deploy.remotecmd" />
</target>
<target name="start_jobqueue.staging"
description="Syncs the database in staging"
depends="staging.properties,
symfony.stage.properties,
start_jobqueue" />
<!-- rebuild database -->
<!-- delete the database, -->
<!-- load it with fixtures, -->
<!-- run migrations -->
<!-- and sync -->
<!-- sync -->
<target name="rebuild_database.production"
description="Reconstructs the production database" >
<property name="command"
value="(
cd ${deploy.path}/current/app &&
./console --no-ansi --force --env=${symfony.env} doctrine:database:drop &&
./console --no-ansi --env=${symfony.env} doctrine:database:create &&
./console --no-ansi --no-interaction --env=${symfony.env} doctrine:migrations:migrate
)"
override="true" />
<foreach list="${deploy.servers}"
param="deploy.server"
target="deploy.remotecmd" />
</target>
<target name="rebuild_database.staging"
description="Reconstructs the staging database"
depends="staging.properties,
symfony.stage.properties,
rebuild_database.production" />
<target name="rebuild_database"
description="runs reconstruct_database locally. Defaults to dev; set env with -Dmyenv=env " >
<if>
<not>
<isset property="env" />
</not>
<then>
<property name="env" value="dev" />
</then>
</if>
<exec command="(
./console --force --env=${env} doctrine:database:drop &&
./console --env=${env} doctrine:database:create &&
./console --env=${env} --no-interaction doctrine:migrations:migrate
)"
dir="${project.basedir}/app"
passthru="true" />
</target>
<!-- restart memcached -->
<target name="restart_memcached"
depends="deploy.memcachedump"
description="Restarts the memcached on production" />
<target name="restart_memcached.staging"
depends="staging.properties, deploy.memcachedump"
description="Restarts the memcached on staging" />
<!-- modification so test can be run -->
<target name="test"
description="Runs application unit tests">
<php expression="$_SERVER['KERNEL_DIR'] = '${project.basedir}/app'" />
<phingcall target="test.do" />
</target>
<!-- target shortcuts -->
<target name="staging" depends="deploy.staging" />
<target name="production" depends="deploy.production" />
</project>