-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudinit.cfg
136 lines (126 loc) · 5.82 KB
/
cloudinit.cfg
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
#cloud-config
apt_update: true
packages:
#Condor
- libssl0.9.8
- libvirt0
- libdate-manip-perl
# LVM
- lvm2
#NFS
- autofs
#Galaxy
- gnuplot
- liblist-moreutils-perl
- libemail-valid-perl
- libwww-mechanize-perl
- libtie-ixhash-perl
- libdbi-perl
- libdbd-sqlite3-perl
- openjdk-6-jre
- python-markupsafe
- python-numpy
- python-psycopg2
- r-base
- ruby1.9.1
- samtools
- unzip
- zip
#Useful tools
- mc
runcmd:
# add SSH key for galaxy user as the first step, in order to faciliate
# debugging
- echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDiHTR3gi1ckIzMOeZ4Rq9ymg+XdXZHoCHVVJPDUIMoMGW86Ag6q9M8GdqTLAiMQHqIc6uGt5FXpt4ov7yGgJ19poXNrGYfCbA1FH+5XHZbE6vQX9BHVEvsGf9GJPLbHRiknRUBS2nZ66dfIambY4DgWuhwPCRrM3zYjn7EqKiC2ifleIbJ3hobXxGPLk+BiQdb74zCaSIJmThTicZP1hicC1mpFx3A7w+o2gjpOUOcU1yqCQVu0YuZS25xvU9mR5Jkwx3EOc07gfI0VTBixOM5R4nHFImojUr714jZXrVONeQGYIHWJr9vO3d51uzrXFA5W3WvmR73I9cpS6nI6RP9 [email protected]' >> /home/ubuntu/.ssh/authorized_keys
# setup hostname info
- echo '$ip_addr $domain headnode' >> /etc/hosts
- echo "$$(ec2metadata --local-ip) $$(ec2metadata --local-hostname)" >> /etc/hosts
- echo "$$(ec2metadata --local-hostname)" > /etc/hostname
- [ hostname, -F, /etc/hostname ]
# setup ephemeral filesystem...
# ...using merged ephemeral volumes
- [ mkdir, -p, /ephemeral/0 ]
- [ umount, /mnt ]
- [ pvcreate, /dev/xvdb ]
- [ pvcreate, /dev/xvdc ]
- [ pvcreate, /dev/xvdd ]
- [ pvcreate, /dev/xvde ]
- [ vgcreate, ephemeral, /dev/xvdb ]
- [ vgextend, ephemeral, /dev/xvdc ]
- [ vgextend, ephemeral, /dev/xvdd ]
- [ vgextend, ephemeral, /dev/xvde ]
- [ lvcreate, -l, 100%VG, -i, 2, -I, 64, ephemeral, -n, ephemeral ]
- [ mke2fs, /dev/ephemeral/ephemeral ]
- [ mount, /dev/ephemeral/ephemeral, /ephemeral/0 ]
# move /tmp to ephemeral FS
- [ cp, -pr, /tmp, /ephemeral/0 ]
- [ rm, -rf, /tmp ]
- [ ln, -s, /ephemeral/0/tmp, /tmp ]
# Configure NFS and mount remote filesystems
- [ mkdir, -p, /home/galaxy ]
- [ mkdir, -p, /opt/galaxy ]
- [ mkdir, -p, /mnt/galaxyTools ]
- [ mkdir, -p, /mnt/galaxyIndices ]
- [ mkdir, -p, /scratch ]
- echo 'NEED_STATD=no' > /etc/default/nfs-common
- echo 'NEED_IDMAPD=yes' >> /etc/default/nfs-common
- echo '/- /etc/auto.nfs' >> /etc/auto.master
- echo '/home/galaxy -fstype=nfs4 $ip_addr:/home/galaxy' >> /etc/auto.nfs
- echo '/opt/galaxy -fstype=nfs4 $ip_addr:/opt/galaxy' >> /etc/auto.nfs
- echo '/mnt/galaxyTools -fstype=nfs4 $ip_addr:/mnt/galaxyTools' >> /etc/auto.nfs
- echo '/mnt/galaxyIndices -fstype=nfs4 $ip_addr:/mnt/galaxyIndices' >> /etc/auto.nfs
- echo '/scratch -fstype=nfs4 $ip_addr:/scratch' >> /etc/auto.nfs
- echo '[General]' > /etc/idmapd.conf
- echo 'Verbosity = 0' >> /etc/idmapd.conf
- echo 'Pipefs-Directory = /run/rpc_pipefs' >> /etc/idmapd.conf
- echo 'Domain = globusgenomics.org' >> /etc/idmapd.conf
- echo '[Mapping]' >> /etc/idmapd.conf
- echo 'Nobody-User = nobody' >> /etc/idmapd.conf
- echo 'Nobody-Group = nogroup' >> /etc/idmapd.conf
- [ service, idmapd, restart ]
- [ service, autofs, restart ]
# Increase both hard and soft on open files
- echo '* - nofile 65000' >> /etc/security/limits.conf
# Add the galaxy user used to run all jobs
- [ addgroup, --gid, 4000, galaxy ]
- [ adduser, --uid, 4000, --ingroup, galaxy, --disabled-password, --gecos, '', galaxy ]
# Install Condor
- [ wget, 'http://repo.globusgenomics.org/packages/condor_8.2.6-288241_amd64.deb' ]
- [ dpkg, -i, 'condor_8.2.6-288241_amd64.deb' ]
# Configure Condor
- [ mkdir, -p, /ephemeral/0/condor ]
- [ chown, 'condor:condor', /ephemeral/0/condor ]
- echo 'CONDOR_HOST = $ip_addr' > /etc/condor/condor_config.local
- echo 'COLLECTOR_NAME = Globus Genomics Condor Pool' >> /etc/condor/condor_config.local
- echo 'START = GlobusOnline =?= UNDEFINED' >> /etc/condor/condor_config.local
- echo 'SUSPEND = FALSE' >> /etc/condor/condor_config.local
- echo 'PREEMPT = FALSE' >> /etc/condor/condor_config.local
- echo 'KILL = FALSE' >> /etc/condor/condor_config.local
- echo 'DAEMON_LIST = MASTER, STARTD' >> /etc/condor/condor_config.local
- echo 'ALLOW_READ = *' >> /etc/condor/condor_config.local
- echo 'ALLOW_WRITE = *' >> /etc/condor/condor_config.local
- echo 'EXECUTE = /ephemeral/0/condor' >> /etc/condor/condor_config.local
- echo 'SLOT_TYPE_1 = cpus=$cpus' >> /etc/condor/condor_config.local
- echo 'NUM_SLOTS_TYPE_1 = 1' >> /etc/condor/condor_config.local
- echo 'SLOT_TYPE_1_PARTITIONABLE = true' >> /etc/condor/condor_config.local
- echo 'FILESYSTEM_DOMAIN = globusgenomics.org' >> /etc/condor/condor_config.local
- echo 'UID_DOMAIN = globusgenomics.org' >> /etc/condor/condor_config.local
- echo 'TRUST_UID_DOMAIN = True' >> /etc/condor/condor_config.local
- echo "NETWORK_INTERFACE = $$(ec2metadata --local-ip)" >> /etc/condor/condor_config.local
- echo 'ulimit -n 65000' > /tmp/restart_condor.sh
- echo 'service condor restart' >> /tmp/restart_condor.sh
- [ bash, /tmp/restart_condor.sh ]
# Configure self-termination
- echo '#!/bin/bash' > /usr/local/bin/monitor_instance.sh
- echo 'running_secs="$$(cat /proc/uptime | cut -d'.' -f1)"' >> /usr/local/bin/monitor_instance.sh
- echo 'let minutes_left=60-running_secs/60' >> /usr/local/bin/monitor_instance.sh
- echo 'if [[ $$minutes_left -gt 2 ]]; then' >> /usr/local/bin/monitor_instance.sh
- echo ' exit 0' >> /usr/local/bin/monitor_instance.sh
- echo 'fi' >> /usr/local/bin/monitor_instance.sh
- echo 'daemonname="$$(ec2metadata --local-hostname)"' >> /usr/local/bin/monitor_instance.sh
- echo 'claimed=`condor_status -claimed -direct $$daemonname`' >> /usr/local/bin/monitor_instance.sh
- echo 'if [[ -z $$claimed ]]; then' >> /usr/local/bin/monitor_instance.sh
- echo ' /sbin/shutdown -h now' >> /usr/local/bin/monitor_instance.sh
- echo 'fi' >> /usr/local/bin/monitor_instance.sh
- [ chmod, 755, /usr/local/bin/monitor_instance.sh ]
- echo '* * * * * root /usr/local/bin/monitor_instance.sh' > /etc/cron.d/monitor_instance