{"action":"created","comment":{"url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/pulls/comments/38120466","id":38120466,"diff_hunk":"@@ -56,12 +64,41 @@ var config = {\n     },\n     log_format: '{ \"timestamp\": \":date[iso]\", \"@fields\": { \"remote_addr\": \":remote-addr\", \"body_bytes_sent\": \":res[content-length]\", \"request_time\": \":response-time\", \"status\": \":status\", \"request\": \":method :url HTTP/:http-version\", \"request_method\": \":method\", \"http_referrer\": \":referrer\", \"http_user_agent\": \":user-agent\" } }',\n \n+    enable_cors: true,\n+\n     beforeTileRender: function(req, res, callback) {\n         callback(null);\n     },\n \n     afterTileRender: function(req, res, tile, headers, callback) {\n+\n+        // Complete render pipline first\n+        headers['Cache-Control'] = 'max-age=2592000';","path":"src/tiler/server.js","position":45,"original_position":45,"commit_id":"9e687a21579c73a82b863ee37d075e90b3c06ea8","original_commit_id":"9e687a21579c73a82b863ee37d075e90b3c06ea8","user":{"login":"mmcfarland","id":1014341,"avatar_url":"https://avatars.githubusercontent.com/u/1014341?v=3","gravatar_id":"","url":"https://api.github.com/users/mmcfarland","html_url":"https://github.com/mmcfarland","followers_url":"https://api.github.com/users/mmcfarland/followers","following_url":"https://api.github.com/users/mmcfarland/following{/other_user}","gists_url":"https://api.github.com/users/mmcfarland/gists{/gist_id}","starred_url":"https://api.github.com/users/mmcfarland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmcfarland/subscriptions","organizations_url":"https://api.github.com/users/mmcfarland/orgs","repos_url":"https://api.github.com/users/mmcfarland/repos","events_url":"https://api.github.com/users/mmcfarland/events{/privacy}","received_events_url":"https://api.github.com/users/mmcfarland/received_events","type":"User","site_admin":false},"body":"Happens to be 30 days, but is significant only in that it is a long time.  Taken from otm/nyc-trees.","created_at":"2015-08-27T17:13:05Z","updated_at":"2015-08-27T17:13:05Z","html_url":"https://github.com/WikiWatershed/model-my-watershed/pull/726#discussion_r38120466","pull_request_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/pulls/726","_links":{"self":{"href":"https://api.github.com/repos/WikiWatershed/model-my-watershed/pulls/comments/38120466"},"html":{"href":"https://github.com/WikiWatershed/model-my-watershed/pull/726#discussion_r38120466"},"pull_request":{"href":"https://api.github.com/repos/WikiWatershed/model-my-watershed/pulls/726"}}},"pull_request":{"url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/pulls/726","id":43539890,"html_url":"https://github.com/WikiWatershed/model-my-watershed/pull/726","diff_url":"https://github.com/WikiWatershed/model-my-watershed/pull/726.diff","patch_url":"https://github.com/WikiWatershed/model-my-watershed/pull/726.patch","issue_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/issues/726","number":726,"state":"open","locked":false,"title":"Allow tile requests to cache image and grid","user":{"login":"mmcfarland","id":1014341,"avatar_url":"https://avatars.githubusercontent.com/u/1014341?v=3","gravatar_id":"","url":"https://api.github.com/users/mmcfarland","html_url":"https://github.com/mmcfarland","followers_url":"https://api.github.com/users/mmcfarland/followers","following_url":"https://api.github.com/users/mmcfarland/following{/other_user}","gists_url":"https://api.github.com/users/mmcfarland/gists{/gist_id}","starred_url":"https://api.github.com/users/mmcfarland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmcfarland/subscriptions","organizations_url":"https://api.github.com/users/mmcfarland/orgs","repos_url":"https://api.github.com/users/mmcfarland/repos","events_url":"https://api.github.com/users/mmcfarland/events{/privacy}","received_events_url":"https://api.github.com/users/mmcfarland/received_events","type":"User","site_admin":false},"body":"If not receiving requests from localhost and assuming the AWS\r\ncredentials are provided to the AWS SDK, write the response of\r\nall requests to a specified S3 bucket that in practice will serve\r\nas a downstream cache provider for images and utfgrids.\r\n\r\n#### Testing\r\nAs this functionality is not designed to work while in development, the steps are initially a bit kludgy to test.\r\n\r\n1. Provision the tiler with the cache bucket name set:\r\n    `MMW_TILECACHE_BUCKET=\"tilecache.mmw-dev.azavea.com\" vagrant up tiler --provision`\r\n1. [Provide the AWS credentials](http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html) to the SDK on the tiler \r\n1. Set the TILER_HOST setting in base.py to the s3 static website root: `tilecache.mmw-dev.azavea.com.s3-website-us-east-1.amazonaws.com`\r\n1. Hang in there, just a few more steps.\r\n1. Fire up `ngrok 4000` to be able to proxy requests to your local dev tiler\r\n1. Note the hostname from above and update the `tilecache-mmw-dev.azavea.com` S3 bucket static website Routing Rules HostName property to refer to it.\r\n![screenshot from 2015-08-27 11 29 21](https://cloud.githubusercontent.com/assets/1014341/9524862/2fd10738-4caf-11e5-902d-fd77ddf5c691.png)\r\n1. Fire up `scripty debugtiler`\r\n1. Make some tile requests from the app and then notice the creation of layer/z/x/y.png & grid objects in the s3 buckets.  Running `debugtiler` should indicate that subsequent requests aren't making it to the tiler.\r\n\r\n#### Overview\r\nAs described in #447, the tiler will write to an s3 bucket which serves as cache for rendered tiles, and set up for serving over HTTP.  Routing rules will redirect requests made to s3 to a tiler endpoint, which will serve the tile and write the output to s3, preventing subsequent requests to render that tile.  Deleting the layer directory in S3 will effectively clear the cache and have them be generated again.\r\n\r\nIn a future commit, the configuration of the s3 bucket will be scripted in CloudFormation so that the upstream `HostName` value can be updated during deployment to the appropriate color stack tiler.  The TILER_URL setting will also be set to a CloudFront endpoint that will be backed by the s3 website endpoint.  This will be taken care of in a future issue when there is more bandwidth.\r\n\r\nConnects #447 ","created_at":"2015-08-27T16:46:08Z","updated_at":"2015-08-27T17:13:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"10e0898c268317d89969c6ef91e45d3291166a16","assignee":{"login":"caseypt","id":1042475,"avatar_url":"https://avatars.githubusercontent.com/u/1042475?v=3","gravatar_id":"","url":"https://api.github.com/users/caseypt","html_url":"https://github.com/caseypt","followers_url":"https://api.github.com/users/caseypt/followers","following_url":"https://api.github.com/users/caseypt/following{/other_user}","gists_url":"https://api.github.com/users/caseypt/gists{/gist_id}","starred_url":"https://api.github.com/users/caseypt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caseypt/subscriptions","organizations_url":"https://api.github.com/users/caseypt/orgs","repos_url":"https://api.github.com/users/caseypt/repos","events_url":"https://api.github.com/users/caseypt/events{/privacy}","received_events_url":"https://api.github.com/users/caseypt/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/pulls/726/commits","review_comments_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/pulls/726/comments","review_comment_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/pulls/comments{/number}","comments_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/issues/726/comments","statuses_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/statuses/9e687a21579c73a82b863ee37d075e90b3c06ea8","head":{"label":"mmcfarland:feature/tile-cache-on-req","ref":"feature/tile-cache-on-req","sha":"9e687a21579c73a82b863ee37d075e90b3c06ea8","user":{"login":"mmcfarland","id":1014341,"avatar_url":"https://avatars.githubusercontent.com/u/1014341?v=3","gravatar_id":"","url":"https://api.github.com/users/mmcfarland","html_url":"https://github.com/mmcfarland","followers_url":"https://api.github.com/users/mmcfarland/followers","following_url":"https://api.github.com/users/mmcfarland/following{/other_user}","gists_url":"https://api.github.com/users/mmcfarland/gists{/gist_id}","starred_url":"https://api.github.com/users/mmcfarland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmcfarland/subscriptions","organizations_url":"https://api.github.com/users/mmcfarland/orgs","repos_url":"https://api.github.com/users/mmcfarland/repos","events_url":"https://api.github.com/users/mmcfarland/events{/privacy}","received_events_url":"https://api.github.com/users/mmcfarland/received_events","type":"User","site_admin":false},"repo":{"id":36315791,"name":"model-my-watershed","full_name":"mmcfarland/model-my-watershed","owner":{"login":"mmcfarland","id":1014341,"avatar_url":"https://avatars.githubusercontent.com/u/1014341?v=3","gravatar_id":"","url":"https://api.github.com/users/mmcfarland","html_url":"https://github.com/mmcfarland","followers_url":"https://api.github.com/users/mmcfarland/followers","following_url":"https://api.github.com/users/mmcfarland/following{/other_user}","gists_url":"https://api.github.com/users/mmcfarland/gists{/gist_id}","starred_url":"https://api.github.com/users/mmcfarland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmcfarland/subscriptions","organizations_url":"https://api.github.com/users/mmcfarland/orgs","repos_url":"https://api.github.com/users/mmcfarland/repos","events_url":"https://api.github.com/users/mmcfarland/events{/privacy}","received_events_url":"https://api.github.com/users/mmcfarland/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mmcfarland/model-my-watershed","description":"The web application front end for Model My Watershed.","fork":true,"url":"https://api.github.com/repos/mmcfarland/model-my-watershed","forks_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/forks","keys_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/teams","hooks_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/hooks","issue_events_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/issues/events{/number}","events_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/events","assignees_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/assignees{/user}","branches_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/branches{/branch}","tags_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/tags","blobs_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/git/refs{/sha}","trees_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/statuses/{sha}","languages_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/languages","stargazers_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/stargazers","contributors_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/contributors","subscribers_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/subscribers","subscription_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/subscription","commits_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/commits{/sha}","git_commits_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/git/commits{/sha}","comments_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/comments{/number}","issue_comment_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/issues/comments{/number}","contents_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/contents/{+path}","compare_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/merges","archive_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/downloads","issues_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/issues{/number}","pulls_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/pulls{/number}","milestones_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/milestones{/number}","notifications_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/labels{/name}","releases_url":"https://api.github.com/repos/mmcfarland/model-my-watershed/releases{/id}","created_at":"2015-05-26T18:32:16Z","updated_at":"2015-06-11T21:05:42Z","pushed_at":"2015-08-27T16:49:01Z","git_url":"git://github.com/mmcfarland/model-my-watershed.git","ssh_url":"git@github.com:mmcfarland/model-my-watershed.git","clone_url":"https://github.com/mmcfarland/model-my-watershed.git","svn_url":"https://github.com/mmcfarland/model-my-watershed","homepage":null,"size":14686,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"WikiWatershed:develop","ref":"develop","sha":"f5b9c02b97bf07ebfcb7b1f6f7bd0ff6ce115e3f","user":{"login":"WikiWatershed","id":8520008,"avatar_url":"https://avatars.githubusercontent.com/u/8520008?v=3","gravatar_id":"","url":"https://api.github.com/users/WikiWatershed","html_url":"https://github.com/WikiWatershed","followers_url":"https://api.github.com/users/WikiWatershed/followers","following_url":"https://api.github.com/users/WikiWatershed/following{/other_user}","gists_url":"https://api.github.com/users/WikiWatershed/gists{/gist_id}","starred_url":"https://api.github.com/users/WikiWatershed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WikiWatershed/subscriptions","organizations_url":"https://api.github.com/users/WikiWatershed/orgs","repos_url":"https://api.github.com/users/WikiWatershed/repos","events_url":"https://api.github.com/users/WikiWatershed/events{/privacy}","received_events_url":"https://api.github.com/users/WikiWatershed/received_events","type":"Organization","site_admin":false},"repo":{"id":32742922,"name":"model-my-watershed","full_name":"WikiWatershed/model-my-watershed","owner":{"login":"WikiWatershed","id":8520008,"avatar_url":"https://avatars.githubusercontent.com/u/8520008?v=3","gravatar_id":"","url":"https://api.github.com/users/WikiWatershed","html_url":"https://github.com/WikiWatershed","followers_url":"https://api.github.com/users/WikiWatershed/followers","following_url":"https://api.github.com/users/WikiWatershed/following{/other_user}","gists_url":"https://api.github.com/users/WikiWatershed/gists{/gist_id}","starred_url":"https://api.github.com/users/WikiWatershed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WikiWatershed/subscriptions","organizations_url":"https://api.github.com/users/WikiWatershed/orgs","repos_url":"https://api.github.com/users/WikiWatershed/repos","events_url":"https://api.github.com/users/WikiWatershed/events{/privacy}","received_events_url":"https://api.github.com/users/WikiWatershed/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/WikiWatershed/model-my-watershed","description":"The web application front end for Model My Watershed.","fork":false,"url":"https://api.github.com/repos/WikiWatershed/model-my-watershed","forks_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/forks","keys_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/teams","hooks_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/hooks","issue_events_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/issues/events{/number}","events_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/events","assignees_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/assignees{/user}","branches_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/branches{/branch}","tags_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/tags","blobs_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/git/refs{/sha}","trees_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/statuses/{sha}","languages_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/languages","stargazers_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/stargazers","contributors_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/contributors","subscribers_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/subscribers","subscription_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/subscription","commits_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/commits{/sha}","git_commits_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/git/commits{/sha}","comments_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/comments{/number}","issue_comment_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/issues/comments{/number}","contents_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/contents/{+path}","compare_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/merges","archive_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/downloads","issues_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/issues{/number}","pulls_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/pulls{/number}","milestones_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/milestones{/number}","notifications_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/labels{/name}","releases_url":"https://api.github.com/repos/WikiWatershed/model-my-watershed/releases{/id}","created_at":"2015-03-23T16:02:55Z","updated_at":"2015-07-16T03:33:25Z","pushed_at":"2015-08-27T16:49:03Z","git_url":"git://github.com/WikiWatershed/model-my-watershed.git","ssh_url":"git@github.com:WikiWatershed/model-my-watershed.git","clone_url":"https://github.com/WikiWatershed/model-my-watershed.git","svn_url":"https://github.com/WikiWatershed/model-my-watershed","homepage":null,"size":17739,"stargazers_count":3,"watchers_count":3,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":115,"forks":12,"open_issues":115,"watchers":3,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/WikiWatershed/model-my-watershed/pulls/726"},"html":{"href":"https://github.com/WikiWatershed/model-my-watershed/pull/726"},"issue":{"href":"https://api.github.com/repos/WikiWatershed/model-my-watershed/issues/726"},"comments":{"href":"https://api.github.com/repos/WikiWatershed/model-my-watershed/issues/726/comments"},"review_comments":{"href":"https://api.github.com/repos/WikiWatershed/model-my-watershed/pulls/726/comments"},"review_comment":{"href":"https://api.github.com/repos/WikiWatershed/model-my-watershed/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/WikiWatershed/model-my-watershed/pulls/726/commits"},"statuses":{"href":"https://api.github.com/repos/WikiWatershed/model-my-watershed/statuses/9e687a21579c73a82b863ee37d075e90b3c06ea8"}}}}