forked from ENCODE-DCC/encoded
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloud-config.yml
205 lines (192 loc) · 9.05 KB
/
cloud-config.yml
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
#cloud-config
#
# Use ubuntu/images/ebs/ubuntu-saucy-13.10-amd64-server-20131204 (ami-b698a9f3)
# Debug log
output: {all: '| tee -a /var/log/cloud-init-output.log'}
package_upgrade: true
packages:
- apache2-mpm-event
- build-essential
- daemontools
- elasticsearch
- git
- libapache2-mod-wsgi
- libevent-dev
- libfreetype6-dev
- libjpeg-dev
- libmagic-dev
- libmysqlclient-dev
- libpq-dev
- libssl-dev
- libxml2-dev
- libxslt1-dev
- lzop
- mysql-client
- nodejs
- openjdk-7-jre-headless
- postgresql-9.3
- pv
- python2.7-dev
- python-software-properties
- python-virtualenv
- ruby-dev
- zlib1g-dev
bootcmd:
- mkfs -t ext4 /dev/xvdf
- mkfs -t ext4 /dev/xvdg
- mkdir -p /var/lib/postgresql/9.3
- mkdir -p /var/lib/elasticsearch/elasticsearch
mounts:
- [ xvdf, /var/lib/postgresql/9.3, "auto", "defaults,nobootwait", "0", "2" ]
- [ xvdg, /var/lib/elasticsearch/elasticsearch, "auto", "defaults,nobootwait", "0", "2" ]
users:
- default
- name: encoded
gecos: ENCODE Metadata Database daemon user
inactive: true
system: true
# Specified homedir must exist
# https://github.com/rubygems/rubygems/issues/689
homedir: /srv/encoded
write_files:
- path: /etc/postgresql/9.3/main/recovery.conf
permissions: '0644'
content: restore_command = 'envdir /etc/wal-e.d/env /srv/encoded/bin/wal-e wal-fetch "%%f" "%%p"'
- path: /etc/wal-e.d/env/AWS_ACCESS_KEY_ID
permissions: '0755'
content: %(AWS_ID)s
- path: /etc/wal-e.d/env/AWS_SECRET_ACCESS_KEY
permissions: '0755'
content: %(AWS_KEY)s
- path: /etc/wal-e.d/env/WALE_S3_PREFIX
permissions: '0755'
content: %(AWS_SERVER)s
runcmd:
# Ideally this would build as a different user so encoded only has read
# permissions
- set -e
- chown postgres:postgres /etc/postgresql/9.3/main/recovery.conf
- chown -R root:postgres /etc/wal-e.d/env
- sudo -u postgres createuser encoded
- sudo -u postgres createdb --owner=encoded encoded
- mkdir /srv/encoded
- chown encoded:encoded /srv/encoded
- cd /srv/encoded
- sudo -u encoded git clone -b %(BRANCH)s https://github.com/ENCODE-DCC/encoded.git .
- sudo -u encoded python2.7 bootstrap.py
- sudo -u encoded bin/buildout
- sudo /etc/init.d/postgresql stop
- sudo -u postgres envdir /etc/wal-e.d/env /srv/encoded/bin/wal-e backup-fetch /var/lib/postgresql/9.3/main LATEST
- sudo -u postgres cp /var/lib/postgresql/9.3/main/postgresql.conf.orig /var/lib/postgresql/9.3/main/postgresql.conf
- sudo -u postgres cp /etc/postgresql/9.3/main/recovery.conf /var/lib/postgresql/9.3/main
- sudo /etc/init.d/postgresql start
- until sudo -u postgres psql postgres -c ""; do sleep 10; done
- sudo service elasticsearch start
- sudo -u encoded sh -c 'cat /dev/urandom | head -c 256 | base64 > session-secret.b64'
- sudo -u encoded bin/upgrade production.ini
- sudo -u encoded bin/create-mapping production.ini
- sudo -u encoded bin/es-index-data production.ini &
- sudo ln -s /srv/encoded/etc/encoded-apache.conf /etc/apache2/sites-available/encoded.conf
- sudo a2ensite encoded.conf
- sudo a2dissite 000-default
- sudo service apache2 reload
#- sleep 60
#- PATH="/usr/share/elasticsearch/bin:/usr/lib/postgresql/9.3/bin:$PATH" bin/test -m "not bdd"
## Import ssh keys from launchpad:
# ssh_import_id:
# - lrowe
## Or specify public keys:
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA4cGlJUDTeX7QHvJ6AHbRKqgXihkooOTtct/JGkNfOIf/0ATG4TlXhDALk7ixUuaQQHTeHFYPnAKCu04ngRRnWUPh1Rjhpgr/DDWoAOw8cQyHs8x4qXW0+RSsE9w+OGACj2JtqpZ/RBrj3ymOrHx6BEepz+6waKb3nEw3eeGSmBGOjq0/Z2iKVPS/vmB33UJLwQu+JoalRR/I1ocCsUTHS756o1tH5zsz8ZSpnAe978vctqGPoc1N8y+U/YHQHLJMtBQnstmVWfNYEen10UhVosUmSxLiPkSEc606HzO6eQN3qjPRFq6ICbifV3jRBBSkzW9uwsEqNc4A4YXQIV2Eew== [email protected]
apt_sources:
# This is not quite the latest version
# https://github.com/elasticsearch/elasticsearch/issues/3286
- source: "deb http://packages.elasticsearch.org/elasticsearch/0.90/debian stable main"
key: |
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.14 (GNU/Linux)
mQENBFI3HsoBCADXDtbNJnxbPqB1vDNtCsqhe49vFYsZN9IOZsZXgp7aHjh6CJBD
A+bGFOwyhbd7at35jQjWAw1O3cfYsKAmFy+Ar3LHCMkV3oZspJACTIgCrwnkic/9
CUliQe324qvObU2QRtP4Fl0zWcfb/S8UYzWXWIFuJqMvE9MaRY1bwUBvzoqavLGZ
j3SF1SPO+TB5QrHkrQHBsmX+Jda6d4Ylt8/t6CvMwgQNlrlzIO9WT+YN6zS+sqHd
1YK/aY5qhoLNhp9G/HxhcSVCkLq8SStj1ZZ1S9juBPoXV1ZWNbxFNGwOh/NYGldD
2kmBf3YgCqeLzHahsAEpvAm8TBa7Q9W21C8vAB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R/Y0j
6rm7IgrMWUDXDPvoPGjMl2q1iTeyHkMZEyUJ8SKsaHh4jV9wp9KmC8C+9CwMukL7
vM5w8cgvJoAwsp3Fn59AxWthN3XJYcnMfStkIuWgR7U2r+a210W6vnUxU4oN0PmM
cursYPyeV0NX/KQeUeNMwGTFB6QHS/anRaGQewijkrYYoTNtfllxIu9XYmiBERQ/
qPDlGRlOgVTd9xUfHFkzB52c70E=
=92oX
-----END PGP PUBLIC KEY BLOCK-----
- source: "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main"
key: |
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.12 (GNU/Linux)
mQINBE6XR8IBEACVdDKT2HEH1IyHzXkb4nIWAY7echjRxo7MTcj4vbXAyBKOfjja
UrBEJWHN6fjKJXOYWXHLIYg0hOGeW9qcSiaa1/rYIbOzjfGfhE4x0Y+NJHS1db0V
G6GUj3qXaeyqIJGS2z7m0Thy4Lgr/LpZlZ78Nf1fliSzBlMo1sV7PpP/7zUO+aA4
bKa8Rio3weMXQOZgclzgeSdqtwKnyKTQdXY5MkH1QXyFIk1nTfWwyqpJjHlgtwMi
c2cxjqG5nnV9rIYlTTjYG6RBglq0SmzF/raBnF4Lwjxq4qRqvRllBXdFu5+2pMfC
IZ10HPRdqDCTN60DUix+BTzBUT30NzaLhZbOMT5RvQtvTVgWpeIn20i2NrPWNCUh
hj490dKDLpK/v+A5/i8zPvN4c6MkDHi1FZfaoz3863dylUBR3Ip26oM0hHXf4/2U
A/oA4pCl2W0hc4aNtozjKHkVjRx5Q8/hVYu+39csFWxo6YSB/KgIEw+0W8DiTII3
RQj/OlD68ZDmGLyQPiJvaEtY9fDrcSpI0Esm0i4sjkNbuuh0Cvwwwqo5EF1zfkVj
Tqz2REYQGMJGc5LUbIpk5sMHo1HWV038TWxlDRwtOdzw08zQA6BeWe9FOokRPeR2
AqhyaJJwOZJodKZ76S+LDwFkTLzEKnYPCzkoRwLrEdNt1M7wQBThnC5z6w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Dp9TEMpCWzTEgtrBlKdVuTNTeRGILeIcvqoZX5w+u
i0eBvvbeRbHEyUsvOEnYjrqoAjqUJj5FUZtR1+V9fnZp8zDgpOSxx0LomnFdKnhj
uyXAQlRCA6/roVNR9ruRjxTR5ubteZ9ubTsVYr2/eMYOjQ46LhAgR+3Alblu/WHB
MR/9F9//RuOa43R5Sjx9TiFCYol+Ozk8XRt3QGweEH51YkSYY3oRbHBb2Fkql6N6
YFqlLBL7/aiWnNmRDEs/cdpo9HpFsbjOv4RlsSXQfvvfOayHpT5nO1UQFzoyMVpJ
615zwmQDJT5Qy7uvr2eQYRV9AXt8t/H+xjQsRZCc5YVmeAo91qIzI/tA2gtXik49
6yeziZbfUvcZzuzjjxFExss4DSAwMgorvBeIbiz2k2qXukbqcTjB2XqAlZasd6Ll
nLXpQdqDV3McYkP/MvttWh3w+J/woiBcA7yEI5e3YJk97uS6+ssbqLEd0CcdT+qz
+Waw0z/ZIU99Lfh2Qm77OT6vr//Zulw5ovjZVO2boRIcve7S97gQ4KC+G/+QaRS+
VPZ67j5UMxqtT/Y4+NHcQGgwF/1i
=Iugu
-----END PGP PUBLIC KEY BLOCK-----
- source: "deb http://ppa.launchpad.net/chris-lea/node.js/ubuntu saucy main"
key: |
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: SKS 1.1.4
Comment: Hostname: keyserver.ubuntu.com
mI0ES/EY5AEEAOZl+6Cv7b0fOnXLj8lt1cZiNQHIuOkGRJaMUdvXdrSbtQ4v9GiMWFoFj+9g
dFN9EjD9JKoXjJb/e/Q9P21uOi0/YmlOfkqWvqm1qsyBXTXTrGx1mghtALPSw0bvYoWZ3aZJ
3c9VPT5sCdv9IYw6X/+4Z0HoQGvxymbfvRKH3J/xABEBAAG0EkxhdW5jaHBhZCBjaHJpc2xl
YYi2BBMBAgAgBQJL8RjkAhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQuTFqe8eRexLB
rAQAk9ux3R+k38+dY0f8p3B+0UESy/jNFL/S+t6Fdpw/2qMV1EZohAgJXUw/axmTdr1gKUoy
GDtE13gebKGy+zqtzsIVo44V0ztC3Z7Kbd9bbiW+wMo7RT4yyi6kURMyE68RrqGbkenZveU6
o2Urq4LW6bfn5fDLVeYQ5GNsrNdSS1k=
=9f3N
-----END PGP PUBLIC KEY BLOCK-----