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