Skip to content
This repository
  • 3 commits
  • 7 files changed
  • 0 comments
  • 1 contributor
186  README
... ...
@@ -1,19 +1,183 @@
1  
-apt-get install rabbitmq-server (or equivalent)
  1
+OTPSetup is a python libary for automating and managing the deployment of OpenTripPlanner instances on AWS. It was developed for the OTP-Deployer application (http://deployer.opentripplanner.org).
2 2
 
3  
-python setup.py install
  3
+A typical setup consists of a collection of EC2 instances/AMIs and S3 storage buckets, with AMQP used for managing inter-component communication workflow. Below is an overview of the current OTP-Deployer setup:
4 4
 
5  
-wget https://bitbucket.org/ubernostrum/django-registration/downloads/django-registration-0.8-alpha-1.tar.gz
  5
+EC2-based Components:
6 6
 
7  
-tar -xzf django-registration-0.8-alpha-1.tar.gz
8  
-cd django-registration-0.8-alpha-1/
9  
-python setup.py install 
  7
+- Controller instance: Hosts the core components, including the RabbitMQ message server, Django webapp (public and admin), and database. Manages communication between the various other components described below.
10 8
 
11  
-easy_install django-registration-defaults
  9
+- Validator instance: Dedicated instance for validating submitted GTFS feeds. Normally idle, the validator instance is woken up by the controller when GTFS files are submitted, and receives the feed locations on S3 via AMQP message. 
12 10
 
13  
-rabbitmqctl add_vhost /kombu
14  
-rabbitmqctl add_user kombu [password]
15  
-rabbitmqctl set_permissions -p /kombu kombu ".*" ".*" ".*"
  11
+- Graph-builder instance: Dedicated instance for building OTP graphs. Normally idle when not building a graph, the controller instance is woken up by the controller when a graph needs to be built, and receives the GTFS locations on S3 via AMQP message.
16 12
 
17  
-python manage.py overload admin client
  13
+- Proxy server instance: Runs nginx server and automates setup of DNS redirect from public domains (e.g. ___.deployer.opentripplanner.org) to internal EC2 instances. Communicates with the controller via AMQP.
18 14
 
  15
+- Deployment instance AMI: An AMI that is used to create instances that host an OTP graph and webapp. There are two deployment instance types (each with its own AMI): single-deployment, where each OTP instance gets its own dedicated EC2 instance, created as needed; and multi-deployment, where deployment host instances are created in advance by the admin and OTP instances are assigned to them as the graphs are created, with each host capable of hosting as many OTP instances as its memory will allow. Communicates with the controller via AMQP.
  16
+
  17
+(See the WORKFLOW file for more detailed documentation of the messaging workflow.)
  18
+
  19
+
  20
+S3-based Components -- 
  21
+
  22
+- "otp-gtfs" bucket: user-uploaded GTFS files will be stored here
  23
+
  24
+- "otp-graphs" bucket: successfully built graphs are stored here, along with graph builder output and instance request data (GTFS feeds, OSM extract, GB config file, etc.) 
  25
+
  26
+- "otpsetup-resources" bucket: should contain centralized settings template file (settings-template.py) and current versions of following OTP files: graph-builder.jar, opentripplanner-api-webapp.war, and opentripplanner-webapp.war
  27
+
  28
+- planet.osm volume: a dedicated volume that contains a copy of planet.osm. The graph-builder attaches to this upon startup
  29
+
  30
+- NED tile library: a collection of 1-degree NED tiles, downloaded by the graph builder when building NED-enabled graphs 
  31
+
  32
+
  33
+
  34
+To get started with OTPSetup (single-deployment-per-host mode):
  35
+
  36
+
  37
+** SETTING UP THE CONTROLLER INSTANCE **
  38
+
  39
+Install the RabbitMQ server:
  40
+
  41
+$ apt-get install rabbitmq-server (or equivalent)
  42
+
  43
+Clone the OTPSetup repo into a local directory (e.g. /var/otp/) and run the setup script:
  44
+
  45
+$ git clone git://github.com/openplans/OTPSetup.git
  46
+
  47
+$ python setup.py install
  48
+
  49
+Install Django-Registration:
  50
+
  51
+$ wget https://bitbucket.org/ubernostrum/django-registration/downloads/django-registration-0.8-alpha-1.tar.gz
  52
+
  53
+$ tar -xzf django-registration-0.8-alpha-1.tar.gz
  54
+$ cd django-registration-0.8-alpha-1/
  55
+$ python setup.py install 
  56
+
  57
+$ easy_install django-registration-defaults
  58
+
  59
+Set up the RabbitMQ server:
  60
+
  61
+$ rabbitmqctl add_vhost /kombu
  62
+$ rabbitmqctl add_user kombu [password]
  63
+$ rabbitmqctl set_permissions -p /kombu kombu ".*" ".*" ".*"
  64
+
  65
+Finish the Django setup:
  66
+
  67
+(Note: if you wish to use a database other than SQLite for Django, set it up here and modify settings.py as appropriate)  
  68
+
  69
+$ python manage.py overload admin client
  70
+
  71
+$ python manage.py syncdb
  72
+
  73
+Copy the otpsetup-controller script from OTPSetup/init.d to /etc/init.d and make it executable:
  74
+
  75
+$ cp /var/otp/OTPSetup/init.d/otpsetup-controller /etc/init.d
  76
+$ chmod a+x /etc/init.d/otpsetup-controller
  77
+
  78
+(If OTPSetup was installed to a directory other than /var/otp, modify otpsetup-controller to reflect this)
  79
+
  80
+Modify the "runserver" line to point to the outside address to the django front-end.
  81
+
  82
+Register the script as a bootup script using update-rc.d (on Debian-like systems) or equivalent:
  83
+
  84
+$ update-rc.d otpsetup-controller defaults 
  85
+
  86
+Create controller-specific keys using and specify in OTPSetup/
  87
+Restart the instance to invoke the boot script.
  88
+
  89
+
  90
+
  91
+** SETTING UP THE VALIDATOR INSTANCE **
  92
+
  93
+Clone the OTPSetup repo into a local directory (e.g. /var/otp/):
  94
+
  95
+$ git clone git://github.com/openplans/OTPSetup.git
  96
+
  97
+Copy the otpsetup-val script from OTPSetup/init.d to /etc/init.d and make it executable
  98
+
  99
+$ cp /var/otp/OTPSetup/init.d/otpsetup-val /etc/init.d
  100
+$ chmod a+x /etc/init.d/otpsetup-val
  101
+
  102
+(If OTPSetup was installed to a directory other than /var/otp, modify otpsetup-val to reflect this)
  103
+
  104
+Register the script as a bootup script using update-rc.d (on Debian-like systems) or equivalent:
  105
+
  106
+$ update-rc.d otpsetup-val defaults 
  107
+
  108
+Restart the instance to invoke the boot script.
  109
+
  110
+
  111
+
  112
+** SETTING UP THE GRAPH-BUILDER INSTANCE **
  113
+
  114
+Clone the OTPSetup repo into a local directory (e.g. /var/otp/):
  115
+
  116
+$ git clone git://github.com/openplans/OTPSetup.git
  117
+
  118
+Copy the otpsetup-val script from OTPSetup/init.d to /etc/init.d and make it executable:
  119
+
  120
+$ cp /var/otp/OTPSetup/init.d/otpsetup-gb /etc/init.d
  121
+$ chmod a+x /etc/init.d/otpsetup-bg
  122
+
  123
+(If OTPSetup was installed to a directory other than /var/otp, modify otpsetup-val to reflect this)
  124
+
  125
+Register the script as a bootup script using update-rc.d (on Debian-like systems) or equivalent:
  126
+
  127
+$ update-rc.d otpsetup-gb defaults 
  128
+
  129
+Set up the graph builder resources directory and note location in settings.py (see README in the OTPSetup/gb-resources).
  130
+
  131
+Restart the instance to invoke the boot script.
  132
+
  133
+
  134
+
  135
+** SETTING UP THE PROXY SERVER INSTANCE **
  136
+
  137
+Install Nginx:
  138
+
  139
+$ apt-get install nginx
  140
+
  141
+Clone the OTPSetup repo into a local directory (e.g. /var/otp/)
  142
+
  143
+$ git clone git://github.com/openplans/OTPSetup.git
  144
+
  145
+Copy the otpsetup-deploy script to /etc/init.d and make it executable
  146
+
  147
+$ cp /var/otp/OTPSetup/init.d/otpsetup-deploy /etc/init.d
  148
+$ chmod a+x /etc/init.d/otpsetup-deploy
  149
+
  150
+Restart the instance to invoke the boot script.
  151
+
  152
+
  153
+
  154
+** SETTING UP THE DEPLOYMENT IMAGE (SINGLE-DEPLOYMENT VERSION) **
  155
+
  156
+Create an empty instance from which the image will be produced
  157
+
  158
+Install Tomcat:
  159
+
  160
+$ apt-get install tomcat6
  161
+
  162
+Modify catalina.sh to provide suffucient memory to OTP, e.g. add the line:
  163
+JAVA_OPTS="$JAVA_OPTS -Xms4g -Xmx4g"
  164
+
  165
+Clone the OTPSetup repo into a local directory (e.g. /var/otp/)
  166
+
  167
+$ git clone git://github.com/openplans/OTPSetup.git
  168
+
  169
+Copy the otpsetup-deploy script to /etc/init.d and make it executable
  170
+
  171
+$ cp /var/otp/OTPSetup/init.d/otpsetup-deploy /etc/init.d
  172
+$ chmod a+x /etc/init.d/otpsetup-deploy
  173
+
  174
+(If OTPSetup was installed to a directory other than /var/otp, modify otpsetup-deploy to reflect this)
  175
+
  176
+Register the script as a bootup script using update-rc.d (on Debian-like systems) or equivalent
  177
+
  178
+$ update-rc.d otpsetup-deploy defaults 95
  179
+
  180
+(note: otpsetup-deploy must run *after* tomcat in the boot sequence)
  181
+
  182
+Create the AMI based on the instance in this form, and specify its ID in settings.py
19 183
 
117  WORKFLOW
@@ -6,42 +6,131 @@ Parameters: {'transload': URL, 'gtfs_file_id' : integer}
6 6
 Sent by: webapp
7 7
 Handled by: transloader
8 8
 
9  
-This is sent when GTFS needs to be downloaded from a URL and loaded
  9
+transload is sent when GTFS needs to be downloaded from a URL and loaded
10 10
 into S3.  Sends validate_request.
11 11
 
12 12
 Routing key: validate_request
13 13
 Parameters: {'files' : [list of s3 keys], 'request_id' : integer}
14  
-Sent by: webapp, transloader
  14
+Sent by: public webapp, transloader
15 15
 Handled by: checker
16 16
 
17 17
 This causes the GTFS validator to validate the GTFS data.  Sends
18  
-validation_done.
  18
+validation_done back to the controller.
19 19
 
20 20
 Routing key: validation_done
21 21
 Parameters: {'request_id' : integer, 'output' : [{'key': s3 id, 'errors' : text}, ...]})
22 22
 Sent by: checker
23  
-Handled by: django_consumer
  23
+Handled by: controller_consumer
24 24
 
25  
-django_consumer updates the webapp database and sends out an email
26  
-to the admins requesting that the validated data be approved
  25
+after validation completes, controller_consumer updates the webapp database
  26
+with validation results and sends out an email to the admins requesting that
  27
+the validated data be approved for graph building
27 28
 
28 29
 Routing key: create_instance
29 30
 Parameters: { 'files' : [list of s3 keys], 'request_id' : integer }
30  
-Sent by: webapp
  31
+Sent by: admin webapp
31 32
 Handled by: graph_builder
32 33
 
  34
+After , the graph_builder worker istance is activated (as needed)
  35
+
33 36
 Routing key: graph_done
34 37
 Parameters: { 'request_id' : integer, 'success' : boolean, 'key': s3 id, 'output' : text }
35 38
 Sent by: graph_builder
36  
-Handled by: graph_consumer
  39
+Handled by: controller_consumer
37 40
 
38  
-graph_consumer does one of two things: if graph building was successful, it spins 
39  
-up a new deployment instance and dispatches a deploy_instance message. If graph
40  
-building failed, graph_consumer sends an email to the admins alerting of the failure
  41
+the controller recieves graph_done messages and updates the django db
  42
+with the graph builder results. the remaining workflow differs based on
  43
+whether this a single- or multi-deployment application.
  44
+
  45
+SINGLE-DEPLOYMENT:
41 46
 
42 47
 Routing key: deploy_instance
43  
-Parameters: { 'request_id' : integer, 'key': s3 id, 'output' : text }
44  
-Sent by: graph_consumer
  48
+Parameters: { 'request_id' : integer, 'key': graph s3 id, 'output' : text }
  49
+Sent by: controller_consumer
45 50
 Handled by: deployer
46 51
 
47  
-deployer emails the admins upon successful deployment
  52
+controller publishes message with link to built graph and spins up deployment
  53
+instance to receive it
  54
+
  55
+Routing key: deployment_ready
  56
+Parameters: { 'request_id' : integer, 'hostname': text }
  57
+Sent by: deployer
  58
+Handled by: controller_consumer
  59
+
  60
+deployed instance notifies controller once complete, which then tells proxy
  61
+to set up DNS mapping
  62
+
  63
+Routing key: setup_proxy
  64
+Parameters: { 'request_id' : integer, 'hostname' : text }
  65
+Sent by: controller_consumer
  66
+Handled by: proxy_consumer
  67
+
  68
+proxy server sets up mapping and notifies controller of public url
  69
+
  70
+Routing key: proxy_done
  71
+Parameters: { 'request_id' : integer, 'public_url' : text }
  72
+Sent by: proxy_consumer
  73
+Handled by: controller_consumer
  74
+
  75
+after deployment sequence is complete, the controller emails the admins with
  76
+details
  77
+
  78
+
  79
+MULTI-DEPLOYMENT:
  80
+
  81
+The following message chain is invoked when a multi-deployment host is being created:
  82
+
  83
+Routing key: launch_multideployer
  84
+Parameters: { 'request_id' }
  85
+Sent by: admin client
  86
+Handled by: multideployer_launch
  87
+
  88
+the admin client publishes a launch_multideployer message and creates a new instance to receive it
  89
+
  90
+Routing key: multideployer_ready
  91
+Parameters: { 'request_id' : integer, 'host_ip' : text, 'instance_id' : text, 'otp_version' : text, 'auth_password' : text }
  92
+Sent by: multideployer_launch
  93
+Handled by: controller_consumer
  94
+
  95
+newly-launched host tells controller it is ready (note: 'request_id' here refers to the new host request, not an OTP instance request)
  96
+
  97
+Routing key: init_proxy_multi
  98
+Parameters: { 'request_id' : integer, 'host_ip' : text }
  99
+Sent by: controller_consumer
  100
+Handled by: proxy_consumer
  101
+
  102
+proxy consumer is notified of new multi-deployment host, sets up DNS routing to host isntance for admin access to tomcat. no response needed.
  103
+
  104
+
  105
+The following message chain is invoked when an individual OTP instance is being deployed on a multi-deployment host:
  106
+
  107
+Routing key: deploy_graph_multi
  108
+Parameters: { 'request_id' : integer, 'instance_id' : text, 'graph_key' : text }
  109
+Sent by: controller_consumer
  110
+Handled by: multideployer_consumer
  111
+
  112
+controller tells specific host to deploy new graph; host receives and sends 'done' message after deploying
  113
+
  114
+Routing key: multideployment_done
  115
+Parameters: { 'request_id' : integer }
  116
+Sent by: multideployer_consumer
  117
+Handled by: controller_consumer
  118
+
  119
+controller is told that deployment was complete, then tells proxy to create DNS mapping
  120
+
  121
+Routing key: register_proxy_multi
  122
+Parameters: { 'request_id' : integer, 'host_ip' : text }
  123
+Sent by: controller_consumer
  124
+Handled by: proxy_consumer
  125
+
  126
+proxy server sets up mapping and notifies controller of public url
  127
+
  128
+Routing key: proxy_done
  129
+Parameters: { 'request_id' : integer, 'public_url' : text }
  130
+Sent by: proxy_consumer
  131
+Handled by: controller_consumer
  132
+
  133
+after deployment sequence is complete, the controller emails the admins with
  134
+details
  135
+
  136
+
5  gb_resources/README
@@ -3,12 +3,9 @@ This directory includes various libraries and templates that the graph-builder m
3 3
 The following resources are already included:
4 4
 
5 5
 gp_resources/templates -- python templates used to generate the graph-builder config file
6  
-gb_resources/graphanno -- utility to read graph-builder annotations from a built graph file
7 6
 gb_resources/osmtools -- utility to contruct an osmosis extraction polygon based on GTFS data
8 7
 
9 8
 ** The following must be added manually after unpacking **
10 9
 
11  
-gb_resources/otpbg -- directory containing a copy of OTP's graph-builder.jar (& dependencies). OTP version should match that used on the deployment instances
12  
-
13 10
 gb_resources/osmosis -- a copy of the Osmosis program; download from http://wiki.openstreetmap.org/wiki/Osmosis (this can be a symlink; gb_resources/osmosis/bin/osmosis should run program)
14  
-
  11
+gb_resources/osmfilter -- a copy of osmfilter; download from http://wiki.openstreetmap.org/wiki/Osmfilter
103  otpsetup/proxy_consumer/handlers.py
... ...
@@ -0,0 +1,103 @@
  1
+#!/usr/bin/python
  2
+
  3
+from kombu import Exchange
  4
+from otpsetup import settings
  5
+
  6
+import subprocess
  7
+
  8
+# legacy message handler:
  9
+
  10
+exchange = Exchange("amq.direct", type="direct", durable=True)
  11
+
  12
+def setup_proxy(conn, body):
  13
+
  14
+    if not 'request_id' in body or not 'hostname' in body:
  15
+        print 'message missing required parameters'
  16
+        return
  17
+   
  18
+    request_id = body['request_id']
  19
+    print 'request: %s' % request_id
  20
+    hostname = body['hostname']
  21
+    
  22
+    hostname = hostname[3:].replace('-','.')
  23
+
  24
+    site_config  = open('/etc/nginx/sites-enabled/site-%s' % request_id, 'w')
  25
+
  26
+    site_config.write('server {\n')
  27
+    site_config.write('    listen       80;\n')
  28
+    site_config.write('    server_name  req-%s.deployer.opentripplanner.org;\n' % request_id)
  29
+    site_config.write('\n')
  30
+    site_config.write('    access_log   /var/log/nginx/dep-%s.access.log;\n' % request_id)
  31
+    site_config.write('\n')
  32
+    site_config.write('    location / {\n')
  33
+    site_config.write('      proxy_pass     http://%s:8080;\n' % hostname)
  34
+    site_config.write('    }\n')
  35
+    site_config.write('}\n')
  36
+
  37
+    site_config.close()
  38
+    
  39
+    subprocess.call(['/etc/init.d/nginx','reload'])
  40
+
  41
+    public_url = "http://req-%s.deployer.opentripplanner.org" % request_id
  42
+
  43
+    # tell controller that proxy mapping is complete
  44
+    publisher = conn.Producer(routing_key="proxy_done", exchange=exchange)
  45
+    publisher.publish({'request_id' : request_id, 'public_url' : public_url})
  46
+
  47
+# multideployer message handler:
  48
+
  49
+def init_proxy_multi(conn, body): 
  50
+
  51
+    host_id = body['host_id']
  52
+    host_ip = body['host_ip']
  53
+
  54
+    site_config  = open('/etc/nginx/sites-enabled/host-%s' % host_id, 'w')
  55
+
  56
+    site_config.write('server {\n')
  57
+    site_config.write('    listen       80;\n')
  58
+    site_config.write('    server_name  host-%s.deployer.opentripplanner.org;\n' % host_id)
  59
+    site_config.write('\n')
  60
+    site_config.write('    location / {\n')
  61
+    site_config.write('      proxy_pass     http://%s:8080;\n' % host_ip)
  62
+    site_config.write('    }\n')
  63
+    site_config.write('}\n')
  64
+
  65
+    site_config.close()
  66
+
  67
+    subprocess.call(['/etc/init.d/nginx','reload'])
  68
+
  69
+
  70
+def register_proxy_multi(conn, body):
  71
+
  72
+    if not 'request_id' in body or not 'host_ip' in body:
  73
+        print 'message missing required parameters'
  74
+        return
  75
+   
  76
+    request_id = body['request_id']
  77
+    host_ip = body['host_ip']
  78
+    
  79
+    site_config  = open('/etc/nginx/sites-enabled/site-%s' % request_id, 'w')
  80
+
  81
+    site_config.write('server {\n')
  82
+    site_config.write('    listen       80;\n')
  83
+    site_config.write('    server_name  req-%s.deployer.opentripplanner.org;\n' % request_id)
  84
+    site_config.write('\n')
  85
+    site_config.write('    location / {\n')
  86
+    site_config.write('      proxy_pass     http://%s:8080/otp-webapp-req-%s/;\n' % (host_ip, request_id))
  87
+    site_config.write('    }\n')
  88
+    site_config.write('\n')
  89
+    site_config.write('    location /opentripplanner-api-webapp {\n')
  90
+    site_config.write('      proxy_pass     http://%s:8080;\n' % host_ip)
  91
+    site_config.write('    }\n')
  92
+    site_config.write('}\n')
  93
+
  94
+    site_config.close()
  95
+    
  96
+    subprocess.call(['/etc/init.d/nginx','reload'])
  97
+
  98
+    public_url = "http://req-%s.deployer.opentripplanner.org" % request_id
  99
+
  100
+    # tell controller that proxy mapping is complete
  101
+    publisher = conn.Producer(routing_key="proxy_done", exchange=exchange)
  102
+    publisher.publish({'request_id' : request_id, 'public_url' : public_url})
  103
+
50  otpsetup/proxy_consumer/main.py
... ...
@@ -1,58 +1,30 @@
1 1
 #!/usr/bin/python
2 2
 
3  
-from django.core.mail import send_mail
4 3
 from kombu import Exchange, Queue
5 4
 from otpsetup.shortcuts import DjangoBrokerConnection
6 5
 from otpsetup import settings
7 6
 
8  
-import subprocess, sys
  7
+import handlers
  8
+
  9
+print "Starting Proxy Consumer"
9 10
 
10 11
 exchange = Exchange("amq.direct", type="direct", durable=True)
11  
-queue = Queue("setup_proxy", exchange=exchange, routing_key="setup_proxy")
12 12
 
13  
-print "Starting Proxy Consumer"
  13
+queues = [
  14
+    Queue("setup_proxy", exchange=exchange, routing_key="setup_proxy"),
  15
+    Queue("init_proxy_multi", exchange=exchange, routing_key="init_proxy_multi"),
  16
+    Queue("register_proxy_multi", exchange=exchange, routing_key="register_proxy_multi")
  17
+]
14 18
 
15 19
 def handle(conn, body, message):
16  
-
17  
-    if not 'request_id' in body or not 'hostname' in body:
18  
-        print 'message missing required parameters'
19  
-        message.ack()
20  
-        return
21  
-   
22  
-    request_id = body['request_id']
23  
-    print 'request: %s' % request_id
24  
-    hostname = body['hostname']
25 20
     
26  
-    hostname = hostname[3:].replace('-','.')
27  
-
28  
-    site_config  = open('/etc/nginx/sites-enabled/site-%s' % request_id, 'w')
29  
-
30  
-    site_config.write('server {\n')
31  
-    site_config.write('    listen       80;\n')
32  
-    site_config.write('    server_name  req-%s.deployer.opentripplanner.org;\n' % request_id)
33  
-    site_config.write('\n')
34  
-    site_config.write('    access_log   /var/log/nginx/dep-%s.access.log;\n' % request_id)
35  
-    site_config.write('\n')
36  
-    site_config.write('    location / {\n')
37  
-    site_config.write('      proxy_pass     http://%s:8080;\n' % hostname)
38  
-    site_config.write('    }\n')
39  
-    site_config.write('}\n')
40  
-
41  
-    site_config.close()
42  
-    
43  
-    subprocess.call(['/etc/init.d/nginx','reload'])
44  
-
45  
-    public_url = "http://req-%s.deployer.opentripplanner.org" % request_id
46  
-
47  
-    # tell controller that proxy mapping is complete
48  
-    publisher = conn.Producer(routing_key="proxy_done", exchange=exchange)
49  
-    publisher.publish({'request_id' : request_id, 'public_url' : public_url})
50  
-
  21
+    key = message.delivery_info['routing_key']
  22
+    getattr(handlers, key)(conn, body)
51 23
     message.ack()
52 24
 
53 25
 with DjangoBrokerConnection() as conn:
54 26
 
55  
-    with conn.Consumer(queue, callbacks=[lambda body, message: handle(conn, body, message)]) as consumer:
  27
+    with conn.Consumer(queues, callbacks=[lambda body, message: handle(conn, body, message)]) as consumer:
56 28
         # Process messages and handle events on all channels
57 29
         while True:
58 30
             conn.drain_events()
187  otpsetup/settings-template.py.example
... ...
@@ -0,0 +1,187 @@
  1
+# Django settings for otpsetup project.
  2
+import os
  3
+from registration_defaults.settings import *
  4
+
  5
+AWS_ACCESS_KEY_ID = "{awsaccesskey}"
  6
+AWS_SECRET_KEY = "{awssecretkey}
  7
+
  8
+S3_BUCKET = "otp-gtfs"
  9
+GRAPH_S3_BUCKET = "otp-graphs"
  10
+
  11
+DEFAULT_FROM_EMAIL = "your_email@example.com"
  12
+
  13
+LOGIN_REDIRECT_URL = "/"
  14
+
  15
+ADMIN_EMAILS = ['otp_admin@example.com']
  16
+
  17
+DEBUG = True
  18
+TEMPLATE_DEBUG = DEBUG
  19
+
  20
+ADMINS = (
  21
+    # ('Your Name', 'your_email@example.com'),
  22
+)
  23
+
  24
+MANAGERS = ADMINS
  25
+
  26
+# Graph builder settings
  27
+GRAPH_BUILDER_RESOURCE_DIR = "/var/otp/resources/"
  28
+PLANET_OSM_PATH = '/var/otp/osm/planet-latest.osm.pbf'
  29
+NED_ENABLED = True
  30
+
  31
+# IDs of AMIs and VPC
  32
+VALIDATOR_AMI_ID = "ami-9fc919f6"
  33
+GRAPH_BUILDER_AMI_ID = "ami-2838e741"
  34
+DEPLOYMENT_AMI_ID = "ami-17ee307e"
  35
+MULTIDEPLOYER_AMI_ID = "ami-0290356b"
  36
+VPC_SUBNET_ID = "subnet-25ca6e4d"
  37
+
  38
+# admin password for tomcat install on deployment instances
  39
+TOMCAT_ADMIN_PASSWORD = "your tomcat password"
  40
+
  41
+DATABASES = {
  42
+    'default': {
  43
+        'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
  44
+        'NAME': '',                      # Or path to database file if using sqlite3.
  45
+        'USER': '',                      # Not used with sqlite3.
  46
+        'PASSWORD': '',                  # Not used with sqlite3.
  47
+        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
  48
+        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
  49
+    }
  50
+}
  51
+
  52
+# Local time zone for this installation. Choices can be found here:
  53
+# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  54
+# although not all choices may be available on all operating systems.
  55
+# On Unix systems, a value of None will cause Django to use the same
  56
+# timezone as the operating system.
  57
+# If running in a Windows environment this must be set to the same as your
  58
+# system time zone.
  59
+TIME_ZONE = 'America/New_York'
  60
+
  61
+# Language code for this installation. All choices can be found here:
  62
+# http://www.i18nguy.com/unicode/language-identifiers.html
  63
+LANGUAGE_CODE = 'en-us'
  64
+
  65
+SITE_ID = 1
  66
+
  67
+# If you set this to False, Django will make some optimizations so as not
  68
+# to load the internationalization machinery.
  69
+USE_I18N = True
  70
+
  71
+# If you set this to False, Django will not format dates, numbers and
  72
+# calendars according to the current locale
  73
+USE_L10N = True
  74
+
  75
+# Absolute filesystem path to the directory that will hold user-uploaded files.
  76
+# Example: "/home/media/media.lawrence.com/media/"
  77
+MEDIA_ROOT = ''
  78
+
  79
+# URL that handles the media served from MEDIA_ROOT. Make sure to use a
  80
+# trailing slash.
  81
+# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
  82
+MEDIA_URL = ''
  83
+
  84
+# Absolute path to the directory static files should be collected to.
  85
+# Don't put anything in this directory yourself; store your static files
  86
+# in apps' "static/" subdirectories and in STATICFILES_DIRS.
  87
+# Example: "/home/media/media.lawrence.com/static/"
  88
+STATIC_ROOT = ''
  89
+
  90
+# URL prefix for static files.
  91
+# Example: "http://media.lawrence.com/static/"
  92
+STATIC_URL = '/static/'
  93
+
  94
+# URL prefix for admin static files -- CSS, JavaScript and images.
  95
+# Make sure to use a trailing slash.
  96
+# Examples: "http://foo.com/static/admin/", "/static/admin/".
  97
+ADMIN_MEDIA_PREFIX = '/static/admin/'
  98
+
  99
+# Additional locations of static files
  100
+STATICFILES_DIRS = (
  101
+    # Put strings here, like "/home/html/static" or "C:/www/django/static".
  102
+    # Always use forward slashes, even on Windows.
  103
+    # Don't forget to use absolute paths, not relative paths.
  104
+)
  105
+
  106
+# List of finder classes that know how to find static files in
  107
+# various locations.
  108
+STATICFILES_FINDERS = (
  109
+    'django.contrib.staticfiles.finders.FileSystemFinder',
  110
+    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  111
+#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
  112
+)
  113
+
  114
+# Make this unique, and don't share it with anybody.
  115
+SECRET_KEY = 'pfl(!%+!6y%l+p)4f6!tmtj+a*f26!n%ye@xa%6fybnm@yq$vg'
  116
+
  117
+# List of callables that know how to import templates from various sources.
  118
+TEMPLATE_LOADERS = (
  119
+    'django.template.loaders.filesystem.Loader',
  120
+    'django.template.loaders.app_directories.Loader',
  121
+#     'django.template.loaders.eggs.Loader',
  122
+)
  123
+
  124
+MIDDLEWARE_CLASSES = (
  125
+    'django.middleware.common.CommonMiddleware',
  126
+    'django.contrib.sessions.middleware.SessionMiddleware',
  127
+    'django.middleware.csrf.CsrfViewMiddleware',
  128
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
  129
+    'django.contrib.messages.middleware.MessageMiddleware',
  130
+)
  131
+
  132
+ROOT_URLCONF = 'otpsetup.urls'
  133
+
  134
+TEMPLATE_CONTEXT_PROCESSORS = ('django.contrib.messages.context_processors.messages',
  135
+                            'django.contrib.auth.context_processors.auth')
  136
+
  137
+TEMPLATE_DIRS = (
  138
+    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
  139
+    # Always use forward slashes, even on Windows.
  140
+    # Don't forget to use absolute paths, not relative paths.
  141
+    os.path.join(os.path.dirname(__file__), "templates"),
  142
+)
  143
+
  144
+INSTALLED_APPS = (
  145
+    'django.contrib.auth',
  146
+    'django.contrib.contenttypes',
  147
+    'django.contrib.sessions',
  148
+    'django.contrib.sites',
  149
+    'django.contrib.messages',
  150
+    'django.contrib.staticfiles',
  151
+    'otpsetup.client',
  152
+    'registration',
  153
+    # Uncomment the next line to enable the admin:
  154
+    'django.contrib.admin',
  155
+    # Uncomment the next line to enable admin documentation:
  156
+    'django.contrib.admindocs',
  157
+)
  158
+
  159
+# A sample logging configuration. The only tangible logging
  160
+# performed by this configuration is to send an email to
  161
+# the site admins on every HTTP 500 error.
  162
+# See http://docs.djangoproject.com/en/dev/topics/logging for
  163
+# more details on how to customize your logging configuration.
  164
+LOGGING = {
  165
+    'version': 1,
  166
+    'disable_existing_loggers': False,
  167
+    'handlers': {
  168
+        'mail_admins': {
  169
+            'level': 'ERROR',
  170
+            'class': 'django.utils.log.AdminEmailHandler'
  171
+        }
  172
+    },
  173
+    'loggers': {
  174
+        'django.request': {
  175
+            'handlers': ['mail_admins'],
  176
+            'level': 'ERROR',
  177
+            'propagate': True,
  178
+        },
  179
+    }
  180
+}
  181
+
  182
+
  183
+BROKER_HOST = "localhost"
  184
+BROKER_PORT = 5672
  185
+BROKER_USER = "kombu"
  186
+BROKER_PASSWORD = "your kombu password"
  187
+BROKER_VHOST = "/kombu"
14  otpsetup/settings.py.example
@@ -6,6 +6,7 @@ AWS_ACCESS_KEY_ID = "your aws access key"
6 6
 AWS_SECRET_KEY = "your aws secret key"
7 7
 
8 8
 S3_BUCKET = "otp-gtfs"
  9
+GRAPH_S3_BUCKET = "otp-graphs"
9 10
 
10 11
 DEFAULT_FROM_EMAIL = "your_email@example.com"
11 12
 
@@ -27,10 +28,15 @@ GRAPH_BUILDER_RESOURCE_DIR = "/var/otp/resources/"
27 28
 PLANET_OSM_PATH = '/var/otp/osm/planet-latest.osm.pbf'
28 29
 NED_ENABLED = True
29 30
 
30  
-# AMI ID's for automated startup of validator and graph-builder
31  
-VALIDATOR_AMI_ID = "ami-dd24f0b4"
32  
-GRAPH_BUILDER_AMI_ID = "ami-f9459190"
  31
+# IDs of AMIs and VPC
  32
+VALIDATOR_AMI_ID = "ami-9fc919f6"
  33
+GRAPH_BUILDER_AMI_ID = "ami-2838e741"
  34
+DEPLOYMENT_AMI_ID = "ami-17ee307e"
  35
+MULTIDEPLOYER_AMI_ID = "ami-0290356b"
  36
+VPC_SUBNET_ID = "subnet-25ca6e4d"
33 37
 
  38
+# admin password for tomcat install on deployment instances
  39
+TOMCAT_ADMIN_PASSWORD = "your tomcat password"
34 40
 
35 41
 DATABASES = {
36 42
     'default': {
@@ -177,5 +183,5 @@ LOGGING = {
177 183
 BROKER_HOST = "localhost"
178 184
 BROKER_PORT = 5672
179 185
 BROKER_USER = "kombu"
180  
-BROKER_PASSWORD = "lxcJZooKna.wg"
  186
+BROKER_PASSWORD = "your kombu password"
181 187
 BROKER_VHOST = "/kombu"

No commit comments for this range

Something went wrong with that request. Please try again.