1
2 from starcluster import static
3
4 config_template = """
5 ####################################
6 ## StarCluster Configuration File ##
7 ####################################
8
9 [global]
10 # configure the default cluster template to use when starting a cluster
11 # defaults to 'smallcluster' defined below. this template should be usable
12 # out-of-the-box provided you've configured your keypair correctly
13 DEFAULT_TEMPLATE=smallcluster
14 # enable experimental features for this release
15 ENABLE_EXPERIMENTAL=False
16 # number of seconds to wait when polling instances (default: 30s)
17 #REFRESH_INTERVAL=15
18 # specify a web browser to launch when viewing spot history plots
19 #WEB_BROWSER=chromium
20
21 [aws info]
22 # This is the AWS credentials section.
23 # These settings apply to all clusters
24 # replace these with your AWS keys
25 AWS_ACCESS_KEY_ID = #your_aws_access_key_id
26 AWS_SECRET_ACCESS_KEY = #your_secret_access_key
27 # replace this with your account number
28 AWS_USER_ID= #your userid
29 # Uncomment to specify a different Amazon AWS region (OPTIONAL)
30 # (defaults to us-east-1 if not specified)
31 # NOTE: AMIs have to be migrated!
32 #AWS_REGION_NAME = eu-west-1
33 #AWS_REGION_HOST = ec2.eu-west-1.amazonaws.com
34 # Uncomment these settings when creating an instance-store (S3) AMI (OPTIONAL)
35 #EC2_CERT = /path/to/your/cert-asdf0as9df092039asdfi02089.pem
36 #EC2_PRIVATE_KEY = /path/to/your/pk-asdfasd890f200909.pem
37
38 # Sections starting with "key" define your keypairs
39 # (see the EC2 getting started guide tutorial on using ec2-add-keypair to learn
40 # how to create new keypairs)
41 # Section name should match your key name e.g.:
42 [key gsg-keypair]
43 KEY_LOCATION=/home/myuser/.ssh/id_rsa-gsg-keypair
44
45 # You can of course have multiple keypair sections
46 # [key my-other-gsg-keypair]
47 # KEY_LOCATION=/home/myuser/.ssh/id_rsa-my-other-gsg-keypair
48
49 # Sections starting with "cluster" define your cluster templates
50 # Section name is the name you give to your cluster template e.g.:
51 [cluster smallcluster]
52 # change this to the name of one of the keypair sections defined above
53 KEYNAME = gsg-keypair
54
55 # number of ec2 instances to launch
56 CLUSTER_SIZE = 2
57
58 # create the following user on the cluster
59 CLUSTER_USER = sgeadmin
60
61 # optionally specify shell (defaults to bash)
62 # (options: %(shells)s)
63 CLUSTER_SHELL = bash
64
65 # AMI for cluster nodes.
66 # The base i386 StarCluster AMI is %(x86_ami)s
67 # The base x86_64 StarCluster AMI is %(x86_64_ami)s
68 NODE_IMAGE_ID = %(x86_ami)s
69 # instance type for all cluster nodes
70 # (options: %(instance_types)s)
71 NODE_INSTANCE_TYPE = m1.small
72
73 # Uncomment to disable installing/configuring a queueing system on the
74 # cluster (SGE)
75 #DISABLE_QUEUE=True
76
77 # Uncomment to specify a different instance type for the master node (OPTIONAL)
78 # (defaults to NODE_INSTANCE_TYPE if not specified)
79 #MASTER_INSTANCE_TYPE = m1.small
80
81 # Uncomment to specify a separate AMI to use for the master node. (OPTIONAL)
82 # (defaults to NODE_IMAGE_ID if not specified)
83 #MASTER_IMAGE_ID = %(x86_ami)s (OPTIONAL)
84
85 # availability zone to launch the cluster in (OPTIONAL)
86 # (automatically determined based on volumes (if any) or
87 # selected by Amazon if not specified)
88 #AVAILABILITY_ZONE = us-east-1c
89
90 # list of volumes to attach to the master node (OPTIONAL)
91 # these volumes, if any, will be NFS shared to the worker nodes
92 # see "Configuring EBS Volumes" below on how to define volume sections
93 #VOLUMES = oceandata, biodata
94
95 # list of plugins to load after StarCluster's default setup routines (OPTIONAL)
96 # see "Configuring StarCluster Plugins" below on how to define plugin sections
97 #PLUGINS = myplugin, myplugin2
98
99 # list of permissions (or firewall rules) to apply to the cluster's security
100 # group (OPTIONAL).
101 #PERMISSIONS = ssh, http
102
103 ###########################################
104 ## Defining Additional Cluster Templates ##
105 ###########################################
106
107 # You can also define multiple cluster templates.
108 # You can either supply all configuration options as with smallcluster above,
109 # or create an EXTENDS=<cluster_name> variable in the new cluster section to
110 # use all settings from <cluster_name> as defaults. Below are a couple of
111 # example cluster templates that use the EXTENDS feature:
112
113 # [cluster mediumcluster]
114 # Declares that this cluster uses smallcluster as defaults
115 # EXTENDS=smallcluster
116 # This section is the same as smallcluster except for the following settings:
117 # KEYNAME=my-other-gsg-keypair
118 # NODE_INSTANCE_TYPE = c1.xlarge
119 # CLUSTER_SIZE=8
120 # VOLUMES = biodata2
121
122 # [cluster largecluster]
123 # Declares that this cluster uses mediumcluster as defaults
124 # EXTENDS=mediumcluster
125 # This section is the same as mediumcluster except for the following variables:
126 # CLUSTER_SIZE=16
127
128 #############################
129 ## Configuring EBS Volumes ##
130 #############################
131
132 # A new [volume] section must be created for each EBS volume you wish to use
133 # with StarCluser. The section name is a tag for your volume. This tag is used
134 # in the VOLUMES setting of a cluster template to declare that an EBS volume is
135 # to be mounted and nfs shared on the cluster. (see the commented VOLUMES
136 # setting in the example 'smallcluster' template above)
137 # Below are some examples of defining and configuring EBS volumes to be used
138 # with StarCluster:
139
140 # Sections starting with "volume" define your EBS volumes
141 # Section name tags your volume e.g.:
142 # [volume biodata]
143 # (attach 1st partition of volume vol-c9999999 to /home on master node)
144 # VOLUME_ID = vol-c999999
145 # MOUNT_PATH = /home
146
147 # Same volume as above, but mounts to different location
148 # [volume biodata2]
149 # (attach 1st partition of volume vol-c9999999 to /opt/ on master node)
150 # VOLUME_ID = vol-c999999
151 # MOUNT_PATH = /opt/
152
153 # Another volume example
154 # [volume oceandata]
155 # (attach 1st partition of volume vol-d7777777 to /mydata on master node)
156 # VOLUME_ID = vol-d7777777
157 # MOUNT_PATH = /mydata
158
159 # Same as oceandata only uses the 2nd partition instead
160 # [volume oceandata]
161 # (attach 2nd partition of volume vol-d7777777 to /mydata on master node)
162 # VOLUME_ID = vol-d7777777
163 # MOUNT_PATH = /mydata
164 # PARTITION = 2
165
166 #####################################
167 ## Configuring StarCluster Plugins ##
168 #####################################
169
170 # Sections starting with "plugin" define a custom python class which can
171 # perform additional configurations to StarCluster's default routines. These
172 # plugins can be assigned to a cluster template to customize the setup
173 # procedure when starting a cluster from this template
174 # (see the commented PLUGINS setting in the 'smallcluster' template above)
175 # Below is an example of defining a plugin called 'myplugin':
176
177 # [plugin myplugin]
178 # myplugin module either lives in ~/.starcluster/plugins or is
179 # in your PYTHONPATH
180 # SETUP_CLASS = myplugin.SetupClass
181 # extra settings are passed as arguments to your plugin:
182 # SOME_PARAM_FOR_MY_PLUGIN = 1
183 # SOME_OTHER_PARAM = 2
184
185 ############################################
186 ## Configuring Security Group Permissions ##
187 ############################################
188
189 # [permission ssh]
190 # protocol can be: tcp, udp, or icmp
191 # protocol = tcp
192 # from_port = 22
193 # to_port = 22
194 # cidr_ip = <your_ip>/32
195
196 # example for opening port 80 on the cluster to a specific IP range
197 # [permission http]
198 # protocol = tcp
199 # from_port = 80
200 # to_port = 80
201 # cidr_ip = 18.0.0.0/24
202 """ % {
203 'x86_ami': static.BASE_AMI_32,
204 'x86_64_ami': static.BASE_AMI_64,
205 'instance_types': ', '.join(static.INSTANCE_TYPES.keys()),
206 'shells': ', '.join(static.AVAILABLE_SHELLS.keys()),
207 }
208
209 DASHES = '-' * 10
210 copy_below = ' '.join([DASHES, 'COPY BELOW THIS LINE', DASHES])
211 end_copy = ' '.join([DASHES, 'END COPY', DASHES])
212 copy_paste_template = '\n'.join([copy_below, config_template, end_copy]) + '\n'
213