Merge lp:~ev/charms/precise/daisy-retracer/prodstack-prep into lp:~daisy-pluckers/charms/precise/daisy-retracer/trunk
- Precise Pangolin (12.04)
- prodstack-prep
- Merge into trunk
Proposed by
Evan
Status: | Merged |
---|---|
Merged at revision: | 20 |
Proposed branch: | lp:~ev/charms/precise/daisy-retracer/prodstack-prep |
Merge into: | lp:~daisy-pluckers/charms/precise/daisy-retracer/trunk |
Diff against target: |
518 lines (+292/-127) 8 files modified
config.yaml (+67/-4) hooks/amqp (+41/-0) hooks/cassandra (+50/-56) hooks/common (+53/-4) hooks/config-changed (+26/-18) hooks/install (+54/-35) hooks/retracer.conf (+0/-9) revision (+1/-1) |
To merge this branch: | bzr merge lp:~ev/charms/precise/daisy-retracer/prodstack-prep |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daisy Pluckers | Pending | ||
Review via email: mp+150109@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'config.yaml' | |||
2 | --- config.yaml 2012-12-12 15:11:24 +0000 | |||
3 | +++ config.yaml 2013-02-22 17:21:30 +0000 | |||
4 | @@ -1,4 +1,28 @@ | |||
5 | 1 | options: | 1 | options: |
6 | 2 | basedir: | ||
7 | 3 | default: "daisy.ubuntu.com" | ||
8 | 4 | type: string | ||
9 | 5 | description: Base directory for code | ||
10 | 6 | instance_type: | ||
11 | 7 | default: "production" | ||
12 | 8 | type: string | ||
13 | 9 | description: Instance type | ||
14 | 10 | user_code_runner: | ||
15 | 11 | default: "whoopsie" | ||
16 | 12 | type: string | ||
17 | 13 | description: The user that runs the code | ||
18 | 14 | group_code_runner: | ||
19 | 15 | default: "whoopsie" | ||
20 | 16 | type: string | ||
21 | 17 | description: The group that runs the code | ||
22 | 18 | user_code_owner: | ||
23 | 19 | default: "webops_deploy" | ||
24 | 20 | type: string | ||
25 | 21 | description: The user that owns the code | ||
26 | 22 | group_code_owner: | ||
27 | 23 | default: "webops_deploy" | ||
28 | 24 | type: string | ||
29 | 25 | description: The group that owns the code | ||
30 | 2 | amqp-user: | 26 | amqp-user: |
31 | 3 | type: string | 27 | type: string |
32 | 4 | default: 'daisy' | 28 | default: 'daisy' |
33 | @@ -15,15 +39,54 @@ | |||
34 | 15 | type: string | 39 | type: string |
35 | 16 | default: '' | 40 | default: '' |
36 | 17 | description: The AWS access key (EC2_ACCESS_KEY). | 41 | description: The AWS access key (EC2_ACCESS_KEY). |
38 | 18 | daisy-retracer-ec2-host: | 42 | daisy-retracer-s3-host: |
39 | 19 | type: string | 43 | type: string |
40 | 20 | default: '' | 44 | default: '' |
43 | 21 | description: The EC2 IP address. | 45 | description: The S3 IP address. |
44 | 22 | daisy-retracer-ec2-bucket: | 46 | daisy-retracer-s3-bucket: |
45 | 23 | type: string | 47 | type: string |
46 | 24 | default: 'daisy_core_files' | 48 | default: 'daisy_core_files' |
48 | 25 | description: The EC2 bucket. | 49 | description: The S3 bucket. |
49 | 50 | daisy-retracer-openstack-auth-url: | ||
50 | 51 | type: string | ||
51 | 52 | default: '' | ||
52 | 53 | description: | | ||
53 | 54 | The OpenStack authentication URL, e.g.: | ||
54 | 55 | https://keystone.yourdomain.com:443/v2.0/ | ||
55 | 56 | daisy-retracer-openstack-username: | ||
56 | 57 | type: string | ||
57 | 58 | default: '' | ||
58 | 59 | description: The OpenStack username to authenticate with. | ||
59 | 60 | daisy-retracer-openstack-password: | ||
60 | 61 | type: string | ||
61 | 62 | default: '' | ||
62 | 63 | description: The OpenStack password to authenticate with. | ||
63 | 64 | daisy-retracer-openstack-tenant: | ||
64 | 65 | type: string | ||
65 | 66 | default: '' | ||
66 | 67 | description: | | ||
67 | 68 | The OpenStack tenant to use, e.g.: yourname_project. | ||
68 | 69 | daisy-retracer-openstack-region: | ||
69 | 70 | type: string | ||
70 | 71 | default: '' | ||
71 | 72 | description: The OpenStack region to use. | ||
72 | 73 | daisy-retracer-swift-bucket: | ||
73 | 74 | type: string | ||
74 | 75 | default: '' | ||
75 | 76 | description: | | ||
76 | 77 | The OpenStack Swift bucket to use, e.g.: daisy_core_files. | ||
77 | 78 | Setting this will use Swift instead of S3 for storing core files. | ||
78 | 79 | daisy-retracer-cassandra-host: | ||
79 | 80 | type: string | ||
80 | 81 | default: '' | ||
81 | 82 | description: | | ||
82 | 83 | Override relations to Cassandra with a specific host address. This | ||
83 | 84 | is a temporary measure until cross-environment relations are ready. | ||
84 | 26 | daisy-retracer-architectures: | 85 | daisy-retracer-architectures: |
85 | 27 | type: string | 86 | type: string |
86 | 28 | default: 'i386 amd64 armhf' | 87 | default: 'i386 amd64 armhf' |
87 | 29 | description: Space separated list of architectures for which to process reports. | 88 | description: Space separated list of architectures for which to process reports. |
88 | 89 | repository: | ||
89 | 90 | type: string | ||
90 | 91 | default: 'ppa:daisy-pluckers/prodstack-prep' | ||
91 | 92 | description: The location for the daisy-dependencies package. | ||
92 | 30 | 93 | ||
93 | === added directory 'files' | |||
94 | === added file 'hooks/amqp' | |||
95 | --- hooks/amqp 1970-01-01 00:00:00 +0000 | |||
96 | +++ hooks/amqp 2013-02-22 17:21:30 +0000 | |||
97 | @@ -0,0 +1,41 @@ | |||
98 | 1 | #!/bin/sh -eux | ||
99 | 2 | |||
100 | 3 | . $(dirname $0)/common | ||
101 | 4 | |||
102 | 5 | get_rabbit_settings () { | ||
103 | 6 | local rabbit_user="$(config-get amqp-user)" | ||
104 | 7 | local rabbit_vhost="$(config-get amqp-vhost)" | ||
105 | 8 | relation-set username="$rabbit_user" | ||
106 | 9 | relation-set vhost="$rabbit_vhost" | ||
107 | 10 | } | ||
108 | 11 | |||
109 | 12 | save_rabbit_settings () { | ||
110 | 13 | local rabbit_user="$(config-get amqp-user)" | ||
111 | 14 | local rabbit_vhost="$(config-get amqp-vhost)" | ||
112 | 15 | local rabbit_host="$(relation-get private-address)" | ||
113 | 16 | local rabbit_password="$(relation-get password)" | ||
114 | 17 | if [ -z "$rabbit_host" ] || [ -z "$rabbit_password" ]; then | ||
115 | 18 | juju-log "Missing AMQP host or password." | ||
116 | 19 | exit 0 | ||
117 | 20 | fi | ||
118 | 21 | save_setting amqp_host "$rabbit_host" | ||
119 | 22 | save_setting amqp_username "$rabbit_user" | ||
120 | 23 | save_setting amqp_password "$rabbit_password" | ||
121 | 24 | save_setting amqp_vhost "$rabbit_vhost" | ||
122 | 25 | |||
123 | 26 | retracer_restart | ||
124 | 27 | } | ||
125 | 28 | |||
126 | 29 | COMMAND="$(basename $0)" | ||
127 | 30 | |||
128 | 31 | case "$COMMAND" in | ||
129 | 32 | amqp-relation-joined) | ||
130 | 33 | get_rabbit_settings | ||
131 | 34 | ;; | ||
132 | 35 | amqp-relation-changed) | ||
133 | 36 | save_rabbit_settings | ||
134 | 37 | ;; | ||
135 | 38 | *) | ||
136 | 39 | juju-log "Command not recognized" | ||
137 | 40 | ;; | ||
138 | 41 | esac | ||
139 | 0 | 42 | ||
140 | === modified symlink 'hooks/amqp-relation-changed' | |||
141 | === target changed u'relation-changed' => u'amqp' | |||
142 | === modified symlink 'hooks/amqp-relation-joined' | |||
143 | === target changed u'relation-changed' => u'amqp' | |||
144 | === renamed file 'hooks/relation-changed' => 'hooks/cassandra' | |||
145 | --- hooks/relation-changed 2012-12-13 10:14:41 +0000 | |||
146 | +++ hooks/cassandra 2013-02-22 17:21:30 +0000 | |||
147 | @@ -2,61 +2,55 @@ | |||
148 | 2 | 2 | ||
149 | 3 | . $(dirname $0)/common | 3 | . $(dirname $0)/common |
150 | 4 | 4 | ||
185 | 5 | cassandrahost="$(relation-get private-address)" | 5 | address="$(relation-get private-address)" |
152 | 6 | nfshost="$(relation-get private-address)" | ||
153 | 7 | rabbithost="$(relation-get private-address)" | ||
154 | 8 | |||
155 | 9 | get_rabbit_settings () { | ||
156 | 10 | local rabbit_user="$(config-get amqp-user)" | ||
157 | 11 | local rabbit_vhost="$(config-get amqp-vhost)" | ||
158 | 12 | relation-set username="$rabbit_user" | ||
159 | 13 | relation-set vhost="$rabbit_vhost" | ||
160 | 14 | } | ||
161 | 15 | |||
162 | 16 | save_rabbit_settings () { | ||
163 | 17 | local rabbit_user="$(config-get amqp-user)" | ||
164 | 18 | local rabbit_vhost="$(config-get amqp-vhost)" | ||
165 | 19 | local rabbit_host="$(relation-get private-address)" | ||
166 | 20 | local rabbit_password="$(relation-get password)" | ||
167 | 21 | if [ -z "$rabbit_host" ] || [ -z "$rabbit_password" ]; then | ||
168 | 22 | juju-log "Missing AMQP host or password." | ||
169 | 23 | exit 0 | ||
170 | 24 | fi | ||
171 | 25 | save_setting amqp_host "$rabbit_host" | ||
172 | 26 | save_setting amqp_username "$rabbit_user" | ||
173 | 27 | save_setting amqp_password "$rabbit_password" | ||
174 | 28 | save_setting amqp_vhost "$rabbit_vhost" | ||
175 | 29 | } | ||
176 | 30 | |||
177 | 31 | save_cassandra_settings () { | ||
178 | 32 | if ! grep -qs 'cassandra_hosts' $config; then | ||
179 | 33 | echo "cassandra_hosts = ['$cassandrahost']" >> $config | ||
180 | 34 | else | ||
181 | 35 | sed -i "s,cassandra_hosts = .*,cassandra_hosts = ['$cassandrahost']," $config | ||
182 | 36 | fi | ||
183 | 37 | } | ||
184 | 38 | |||
186 | 39 | COMMAND="$(basename $0)" | 6 | COMMAND="$(basename $0)" |
187 | 40 | 7 | ||
210 | 41 | case "$COMMAND" in | 8 | if [ -n "$(config-get daisy-cassandra-host)" ]; then |
211 | 42 | amqp-relation-joined) | 9 | juju-log "A Cassandra host has been manually set. Ignoring the relation." |
212 | 43 | get_rabbit_settings | 10 | exit 0 |
213 | 44 | ;; | 11 | fi |
214 | 45 | amqp-relation-changed) | 12 | |
215 | 46 | save_rabbit_settings | 13 | if [ -z "$address" ] && [ $COMMAND != "db-relation-broken" ]; then |
216 | 47 | ;; | 14 | juju-log "No address provided." |
217 | 48 | db-relation-changed) | 15 | exit 0 |
218 | 49 | save_cassandra_settings | 16 | fi |
219 | 50 | ;; | 17 | |
220 | 51 | *) | 18 | if [ "$COMMAND" = "db-relation-departed" ]; then |
221 | 52 | juju-log "Command not recognized" | 19 | # First remove the address that just departed the relation, then remove the |
222 | 53 | ;; | 20 | # trailing comma from the list, if one exists. |
223 | 54 | esac | 21 | sed -i -e "s|\(cassandra_hosts = .*\)'$address'[, ]*|\1|" \ |
224 | 55 | 22 | -e "s|, ]|]|" $LOCAL_CONFIG_PATH | |
225 | 56 | if [ -n "$cassandrahost" ] && [ -n "$rabbithost" ]; then | 23 | |
226 | 57 | juju-log "Restarting all retracers" | 24 | elif [ "$COMMAND" = "db-relation-joined" ]; then |
227 | 58 | for job in `(cd /etc/init; ls retracer*.conf)`; do | 25 | p="$LOCAL_CONFIG_PATH" |
228 | 59 | stop ${job%.conf} || true | 26 | |
229 | 60 | start ${job%.conf} | 27 | if ! grep -qs 'cassandra_hosts =' $p; then |
230 | 61 | done | 28 | # We do not have a cassandra_hosts variable. Set one with a new list. |
231 | 62 | fi | 29 | echo "cassandra_hosts = ['$address']" >> $p |
232 | 30 | |||
233 | 31 | elif grep -qs "cassandra_hosts =.*']" $p; then | ||
234 | 32 | # We already have at least one host. Put the new host on the end of the | ||
235 | 33 | # list. | ||
236 | 34 | sed -i "s|\(cassandra_hosts.*\)]|\1, '$address']|" $p | ||
237 | 35 | |||
238 | 36 | elif grep -qs "cassandra_hosts =.*\[[ *]*\]" $p; then | ||
239 | 37 | # We have no hosts. Replace the entire line with a new single-element | ||
240 | 38 | # list. | ||
241 | 39 | sed -i "s|cassandra_hosts =.*|cassandra_hosts = ['$address']|" $p | ||
242 | 40 | fi | ||
243 | 41 | |||
244 | 42 | if "$(dirname $0)/create-keyspace" "$address"; then | ||
245 | 43 | OOPS_KEYSPACE=crashdb OOPS_HOST="$address" python \ | ||
246 | 44 | /usr/share/pyshared/oopsrepository/schema.py | ||
247 | 45 | PYTHONPATH=$LOCAL_CONFIG_LOCATION:$CODE_LOCATION python \ | ||
248 | 46 | $CODE_LOCATION/daisy/schema.py | ||
249 | 47 | fi | ||
250 | 48 | |||
251 | 49 | elif [ "$COMMAND" = "db-relation-broken" ]; then | ||
252 | 50 | sed -i "s|cassandra_hosts =.*|cassandra_hosts = []|" $LOCAL_CONFIG_PATH | ||
253 | 51 | fi | ||
254 | 52 | |||
255 | 53 | # Restart the retracer, since we've changed its configuration. | ||
256 | 54 | retracer_restart | ||
257 | 55 | |||
258 | 56 | exit 0 | ||
259 | 63 | 57 | ||
260 | === modified file 'hooks/common' | |||
261 | --- hooks/common 2012-10-10 09:38:57 +0000 | |||
262 | +++ hooks/common 2013-02-22 17:21:30 +0000 | |||
263 | @@ -1,13 +1,62 @@ | |||
264 | 1 | #!/bin/sh | 1 | #!/bin/sh |
265 | 2 | 2 | ||
267 | 3 | config=/var/retracer/daisy/local_config.py | 3 | BASEDIR="$(config-get basedir)" |
268 | 4 | INSTANCE_TYPE="$(config-get instance_type)" | ||
269 | 5 | USER_CODE_OWNER=$(config-get user_code_owner) | ||
270 | 6 | GROUP_CODE_OWNER=$(config-get group_code_owner) | ||
271 | 7 | USER_CODE_RUNNER=$(config-get user_code_runner) | ||
272 | 8 | GROUP_CODE_RUNNER=$(config-get group_code_runner) | ||
273 | 9 | ARCHITECTURES="$(config-get daisy-retracer-architectures)" | ||
274 | 10 | DEPLOY_ROOT="/srv/$BASEDIR/$INSTANCE_TYPE" | ||
275 | 11 | CODE_LOCATION="$DEPLOY_ROOT/daisy" | ||
276 | 12 | LOCAL_CONFIG_LOCATION="$DEPLOY_ROOT/local_config" | ||
277 | 13 | LOCAL_CONFIG_PATH="$LOCAL_CONFIG_LOCATION/local_config.py" | ||
278 | 14 | LOG_DIR="/srv/$BASEDIR/$INSTANCE_TYPE-logs" | ||
279 | 15 | APPORT_LOCATION="$DEPLOY_ROOT/apport" | ||
280 | 16 | CACHE_DIR="$DEPLOY_ROOT/cache" | ||
281 | 4 | 17 | ||
282 | 5 | save_setting () { | 18 | save_setting () { |
283 | 6 | key="$1" | 19 | key="$1" |
284 | 7 | value="$2" | 20 | value="$2" |
287 | 8 | if ! grep -qs "$key" $config; then | 21 | if ! grep -qs "$key" $LOCAL_CONFIG_PATH; then |
288 | 9 | echo "$key = '$value'" >> $config | 22 | echo "$key = '$value'" >> $LOCAL_CONFIG_PATH |
289 | 10 | else | 23 | else |
291 | 11 | sed -i "s,$key = .*,$key = '$value'," $config | 24 | sed -i "s,$key = .*,$key = '$value'," $LOCAL_CONFIG_PATH |
292 | 12 | fi | 25 | fi |
293 | 13 | } | 26 | } |
294 | 27 | |||
295 | 28 | add_user () { | ||
296 | 29 | local user="$1" | ||
297 | 30 | local group="$2" | ||
298 | 31 | id $user 2>/dev/null || adduser --quiet --system --disabled-password --ingroup $group $user | ||
299 | 32 | } | ||
300 | 33 | |||
301 | 34 | add_group () { | ||
302 | 35 | local group="$1" | ||
303 | 36 | getent group | grep -qs "^$group:" || addgroup --quiet "$group" | ||
304 | 37 | } | ||
305 | 38 | |||
306 | 39 | retracer_restart () { | ||
307 | 40 | # stop all retracers | ||
308 | 41 | juju-log "Stopping all retracers" | ||
309 | 42 | for job in `(cd /etc/init; ls retracer*.conf)`; do | ||
310 | 43 | stop ${job%.conf} || true | ||
311 | 44 | rm /etc/init/$job | ||
312 | 45 | done | ||
313 | 46 | |||
314 | 47 | # create upstart jobs for configured architectures, and start them | ||
315 | 48 | for arch in $ARCHITECTURES; do | ||
316 | 49 | juju-log "Creating upstart job for $arch retracer" | ||
317 | 50 | cat > /etc/init/retracer-$arch.conf << EOF | ||
318 | 51 | description "error tracker retracer for $arch" | ||
319 | 52 | env PYTHONPATH=$LOCAL_CONFIG_LOCATION:$CODE_LOCATION:$APPORT_LOCATION:$DEPLOY_ROOT | ||
320 | 53 | export PYTHONPATH | ||
321 | 54 | env PATH=$APPORT_LOCATION/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||
322 | 55 | export PATH | ||
323 | 56 | exec $CODE_LOCATION/daisy/retracer.py --config-dir $CODE_LOCATION/retracer/config --sandbox-dir $CACHE_DIR --output $LOG_DIR/retracer-$arch.log --architecture $arch | ||
324 | 57 | EOF | ||
325 | 58 | juju-log "Starting $arch retracer" | ||
326 | 59 | start retracer-$arch | ||
327 | 60 | |||
328 | 61 | done | ||
329 | 62 | } | ||
330 | 14 | 63 | ||
331 | === modified file 'hooks/config-changed' | |||
332 | --- hooks/config-changed 2012-12-12 15:11:24 +0000 | |||
333 | +++ hooks/config-changed 2013-02-22 17:21:30 +0000 | |||
334 | @@ -1,20 +1,27 @@ | |||
337 | 1 | #!/bin/sh | 1 | #!/bin/sh -eux |
336 | 2 | set -eu | ||
338 | 3 | 2 | ||
339 | 4 | . $(dirname $0)/common | 3 | . $(dirname $0)/common |
340 | 5 | 4 | ||
341 | 6 | # stop all retracers | ||
342 | 7 | juju-log "Stopping all retracers" | ||
343 | 8 | for job in `(cd /etc/init; ls retracer*.conf)`; do | ||
344 | 9 | stop ${job%.conf} || true | ||
345 | 10 | rm /etc/init/$job | ||
346 | 11 | done | ||
347 | 12 | |||
348 | 13 | juju-log "Updating configuration settings" | 5 | juju-log "Updating configuration settings" |
349 | 6 | |||
350 | 7 | swift_bucket="$(config-get daisy-retracer-swift-bucket)" | ||
351 | 8 | os_auth_url="$(config-get daisy-retracer-openstack-auth-url)" | ||
352 | 9 | os_username="$(config-get daisy-retracer-openstack-username)" | ||
353 | 10 | os_password="$(config-get daisy-retracer-openstack-password)" | ||
354 | 11 | os_tenant="$(config-get daisy-retracer-openstack-tenant)" | ||
355 | 12 | os_region="$(config-get daisy-retracer-openstack-region)" | ||
356 | 13 | [ -n "$swift_bucket" ] && save_setting swift_bucket "$swift_bucket" | ||
357 | 14 | [ -n "$os_auth_url" ] && save_setting os_auth_url "$os_auth_url" | ||
358 | 15 | [ -n "$os_username" ] && save_setting os_username "$os_username" | ||
359 | 16 | [ -n "$os_password" ] && save_setting os_password "$os_password" | ||
360 | 17 | [ -n "$os_tenant" ] && save_setting os_tenant_name "$os_tenant" | ||
361 | 18 | [ -n "$os_region" ] && save_setting os_region_name "$os_region" | ||
362 | 19 | |||
363 | 14 | aws_secret_key="$(config-get daisy-retracer-aws-secret-key)" | 20 | aws_secret_key="$(config-get daisy-retracer-aws-secret-key)" |
364 | 15 | aws_access_key="$(config-get daisy-retracer-aws-access-key)" | 21 | aws_access_key="$(config-get daisy-retracer-aws-access-key)" |
367 | 16 | ec2_host="$(config-get daisy-retracer-ec2-host)" | 22 | ec2_host="$(config-get daisy-retracer-s3-host)" |
368 | 17 | ec2_bucket="$(config-get daisy-retracer-ec2-bucket)" | 23 | ec2_bucket="$(config-get daisy-retracer-s3-bucket)" |
369 | 24 | cassandra_host="$(config-get daisy-retracer-cassandra-host)" | ||
370 | 18 | architectures="$(config-get daisy-retracer-architectures)" | 25 | architectures="$(config-get daisy-retracer-architectures)" |
371 | 19 | 26 | ||
372 | 20 | [ -n "$aws_secret_key" ] && save_setting aws_secret_key "$aws_secret_key" | 27 | [ -n "$aws_secret_key" ] && save_setting aws_secret_key "$aws_secret_key" |
373 | @@ -22,10 +29,11 @@ | |||
374 | 22 | [ -n "$ec2_host" ] && save_setting ec2_host "$ec2_host" | 29 | [ -n "$ec2_host" ] && save_setting ec2_host "$ec2_host" |
375 | 23 | [ -n "$ec2_bucket" ] && save_setting ec2_bucket "$ec2_bucket" | 30 | [ -n "$ec2_bucket" ] && save_setting ec2_bucket "$ec2_bucket" |
376 | 24 | 31 | ||
384 | 25 | # create upstart jobs for configured architectures, and start them | 32 | # If the user has set daisy-cassandra-host to null, set cassandra_hosts back to |
385 | 26 | for arch in $architectures; do | 33 | # an empty list. |
386 | 27 | juju-log "Creating upstart job for $arch retracer" | 34 | [ -n "$cassandra_host" ] && save_cassandra "$cassandra_host" #|| \ |
387 | 28 | sed "s/@ARCH@/$arch/g" hooks/retracer.conf > /etc/init/retracer-$arch.conf | 35 | #sed -i "s|cassandra_hosts =.*|cassandra_hosts = []|" $LOCAL_CONFIG_PATH |
388 | 29 | juju-log "Starting $arch retracer" | 36 | |
389 | 30 | start retracer-$arch | 37 | retracer_restart |
390 | 31 | done | 38 | |
391 | 39 | exit 0 | ||
392 | 32 | 40 | ||
393 | === added symlink 'hooks/db-relation-broken' | |||
394 | === target is u'cassandra' | |||
395 | === removed symlink 'hooks/db-relation-changed' | |||
396 | === target was u'relation-changed' | |||
397 | === added symlink 'hooks/db-relation-departed' | |||
398 | === target is u'cassandra' | |||
399 | === added symlink 'hooks/db-relation-joined' | |||
400 | === target is u'cassandra' | |||
401 | === modified file 'hooks/install' | |||
402 | --- hooks/install 2012-12-12 15:11:24 +0000 | |||
403 | +++ hooks/install 2013-02-22 17:21:30 +0000 | |||
404 | @@ -1,37 +1,56 @@ | |||
405 | 1 | #!/bin/sh | 1 | #!/bin/sh |
413 | 2 | set -e | 2 | set -eux |
414 | 3 | 3 | ||
415 | 4 | mkdir -p /var/retracer/cache | 4 | . hooks/common |
416 | 5 | 5 | ||
417 | 6 | # TODO: move remaining packages over to daisy-seeds PPA | 6 | add-apt-repository "$(config-get repository)" |
411 | 7 | add-apt-repository ppa:ev/whoopsie-daisy | ||
412 | 8 | add-apt-repository ppa:daisy-pluckers/daisy-seeds | ||
418 | 9 | apt-get update | 7 | apt-get update |
447 | 10 | # debootstrap is for building the chroot | 8 | apt-get install -y retracer-dependencies |
448 | 11 | apt-get install -y retracer-dependencies debootstrap | 9 | |
449 | 12 | 10 | # Create groups | |
450 | 13 | # get latest release of Apport | 11 | add_group "$GROUP_CODE_OWNER" |
451 | 14 | if [ -d /var/retracer/apport ]; then | 12 | add_group "$GROUP_CODE_RUNNER" |
452 | 15 | cd /var/retracer/apport | 13 | |
453 | 16 | bzr pull | 14 | # Create users |
454 | 17 | else | 15 | add_user "$USER_CODE_OWNER" "$GROUP_CODE_OWNER" |
455 | 18 | bzr branch lp:apport /var/retracer/apport | 16 | add_user "$USER_CODE_RUNNER" "$GROUP_CODE_RUNNER" |
456 | 19 | cd /var/retracer/apport | 17 | |
457 | 20 | fi | 18 | # Create directories |
458 | 21 | LATEST_TAG=`bzr tags | sort -nrk 2 | head -n1 | awk '{print $1}'` | 19 | mkdir -p "$CODE_LOCATION" "$LOCAL_CONFIG_LOCATION" "$LOG_DIR" "$APPORT_LOCATION" "$CACHE_DIR" |
459 | 22 | bzr uncommit --force -r tag:$LATEST_TAG | 20 | |
460 | 23 | bzr revert --no-backup | 21 | # Unpack tarred Daisy code |
461 | 24 | bzr clean-tree --ignored --unknown --force | 22 | charm_dir="$(pwd)" |
462 | 25 | # set up the apt/dpkg Apport packaging backend; setup.py build would need more | 23 | tarball="$charm_dir/files/daisy.tgz" |
463 | 26 | # dependencies | 24 | |
464 | 27 | rm -f apport/packaging_impl.py | 25 | if [ -f "$tarball" ]; then |
465 | 28 | ln -s ../backends/packaging-apt-dpkg.py apport/packaging_impl.py | 26 | tar -C "$CODE_LOCATION" -xvf "$tarball" |
466 | 29 | cd - | 27 | fi |
467 | 30 | 28 | ||
468 | 31 | # Retracer config | 29 | if [ ! -e "$LOCAL_CONFIG_PATH" ]; then |
469 | 32 | if [ -d /var/retracer/daisy ]; then | 30 | cp "$CODE_LOCATION/daisy/configuration.py" "$LOCAL_CONFIG_PATH" |
470 | 33 | (cd /var/retracer/daisy; bzr pull) | 31 | fi |
471 | 34 | else | 32 | |
472 | 35 | bzr branch lp:~ev/daisy/s3 /var/retracer/daisy | 33 | # Unpack tarred Apport snapshot |
473 | 36 | cp /var/retracer/daisy/configuration.py /var/retracer/daisy/local_config.py | 34 | apport="$charm_dir/files/apport.tgz" |
474 | 37 | fi | 35 | |
475 | 36 | if [ -f "$apport" ]; then | ||
476 | 37 | tar -C "$APPORT_LOCATION" -xvf "$apport" | ||
477 | 38 | |||
478 | 39 | # set up the apt/dpkg Apport packaging backend; setup.py build would need more | ||
479 | 40 | # dependencies | ||
480 | 41 | cd "$APPORT_LOCATION" | ||
481 | 42 | rm -f apport/packaging_impl.py | ||
482 | 43 | ln -s ../backends/packaging-apt-dpkg.py apport/packaging_impl.py | ||
483 | 44 | cd - | ||
484 | 45 | fi | ||
485 | 46 | |||
486 | 47 | # Reset the Cassandra hosts setting. This may have been established by a | ||
487 | 48 | # previous charm, but its contents are now invalid until the config-changed or | ||
488 | 49 | # db-relation-* hooks fires. Its default value of 127.0.0.1 would persist | ||
489 | 50 | # across db-relation-joined and db-relation-departed calls if left set. | ||
490 | 51 | sed -i "s|cassandra_hosts =.*|cassandra_hosts = []|" "$LOCAL_CONFIG_PATH" | ||
491 | 52 | |||
492 | 53 | chown -R $USER_CODE_OWNER:$USER_CODE_RUNNER "/srv/$BASEDIR" | ||
493 | 54 | chown -R $USER_CODE_RUNNER:$GROUP_CODE_RUNNER "$CACHE_DIR" | ||
494 | 55 | |||
495 | 56 | exit 0 | ||
496 | 38 | 57 | ||
497 | === removed symlink 'hooks/nfs-relation-changed' | |||
498 | === target was u'relation-changed' | |||
499 | === removed file 'hooks/retracer.conf' | |||
500 | --- hooks/retracer.conf 2012-12-12 15:11:24 +0000 | |||
501 | +++ hooks/retracer.conf 1970-01-01 00:00:00 +0000 | |||
502 | @@ -1,9 +0,0 @@ | |||
503 | 1 | description "error tracker retracer for @ARCH@" | ||
504 | 2 | |||
505 | 3 | # Use upstart because James prefers it over supervisord. jjo had a reason for | ||
506 | 4 | # using supervisord - touch base. | ||
507 | 5 | env PYTHONPATH=/var/retracer/daisy:/var/retracer/apport:/var/retracer | ||
508 | 6 | export PYTHONPATH | ||
509 | 7 | env PATH=/var/retracer/apport/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||
510 | 8 | export PATH | ||
511 | 9 | exec /var/retracer/daisy/process_core.py --config-dir /var/retracer/daisy/retracer/config --sandbox-dir /var/retracer/cache --output /var/log/retracer-@ARCH@.log --architecture @ARCH@ | ||
512 | 10 | 0 | ||
513 | === modified file 'revision' | |||
514 | --- revision 2012-12-13 10:14:41 +0000 | |||
515 | +++ revision 2013-02-22 17:21:30 +0000 | |||
516 | @@ -1,1 +1,1 @@ | |||
518 | 1 | 54 | 1 | 59 |