{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/community/pulls/comments/107216096","pull_request_review_id":28175195,"id":107216096,"diff_hunk":"@@ -0,0 +1,155 @@\n+---\n+title: Vapor on Google App Engine Flex Tutorial\n+description: Learn how to build an app with Swift and Vapor in the Google App Engine flexible environment.\n+author: mpmcdonald\n+tags: App Engine, Swift, Vapor\n+date_published: 2017-03-21\n+---\n+This tutorial shows a sample [Swift][swift] app built with [Vapor][vapor]\n+deployed to the Google App Engine flexible environment.\n+\n+Vapor is \"a web framework and server for Swift that works on macOS and Ubuntu.\"\n+It is [open source on GitHub][vapor-github].\n+\n+This tutorial assumes basic familiarity with Swift programming.\n+\n+[swift]: http://swift.org\n+[vapor]: https://vapor.codes\n+[vapor-github]: https://github.com/vapor/vapor\n+\n+## Objectives\n+\n+1. Create a Swift \"Hello, world\" app that uses the Vapor framework.\n+1. Deploy the app to Google App Engine flexible environment.\n+\n+## Costs\n+\n+This tutorial uses billable components of Google Cloud Platform, including:\n+\n+- Google App Engine flexible environment\n+\n+Use the [Pricing Calculator][pricing] to generate a cost estimate based on your\n+projected usage.\n+\n+[pricing]: https://cloud.google.com/products/calculator\n+\n+## Before you begin\n+\n+1.  Create a project in the [Google Cloud Platform Console][console].\n+1.  Enable billing for your project.\n+1.  Install the [Google Cloud SDK][cloud-sdk].\n+\n+[console]: https://console.cloud.google.com/\n+[cloud-sdk]: https://cloud.google.com/sdk/\n+\n+## Handling dependencies\n+\n+We'll use the [Swift Package Manager][spm] to manage our app's dependencies.\n+\n+1.  Create a `package.swift` file with the following contents:\n+\n+```swift\n+import PackageDescription\n+\n+let package = Package(\n+    name: \"VaporGAE\",\n+    targets: [\n+        Target(name: \"VaporGAE\", dependencies: [])\n+    ],\n+    dependencies: [\n+        .Package(url: \"https://github.com/vapor/vapor.git\", majorVersion: 1, minor: 1)\n+    ]\n+)\n+```\n+\n+[spm]: https://github.com/apple/swift-package-manager\n+\n+## Writing the server\n+\n+1.  Create a `main.swift` with the following contents:\n+\n+```swift\n+import Foundation\n+import Vapor\n+\n+let drop = Droplet()\n+\n+// Respond to GAE health check requests\n+...\n+\n+// Basic GET request\n+...\n+\n+// Start server on 8080 (default)\n+drop.run()\n+```\n+\n+1.  Create a route to handle GAE \"health check\" requests\" (per the [custom runtime docs][custom-runtime]):\n+\n+```swift\n+// Respond to GAE health check requests\n+drop.get(\"/_ah/health\") { request in\n+    print(\"ALL - /_ah/health route handler...\")\n+    return \"OK\"\n+}\n+```\n+\n+1.  Create a route to handle `GET` requests to `/hello`:\n+\n+```swift\n+// Basic GET request\n+drop.get(\"/hello\") { request in\n+    print(\"GET - /hello route handler...\")\n+    return \"Hello from Swift on GAE Flex!!\"\n+}\n+```\n+\n+[custom-runtime]: https://cloud.google.com/appengine/docs/flexible/custom-runtimes/build#lifecycle_events\n+\n+## Creating the `Dockerfile`\n+\n+Since Swift doesn't have an officially supported GAE runtime, we'll create our\n+own.\n+\n+1.  Create a `Dockerfile` with the following contents:\n+\n+```\n+FROM ibmcom/swift-ubuntu:latest\n+LABEL Description=\"Docker image for Swift + Kitura on GAE Flex.\"\n+\n+# Expose default port for GAE\n+EXPOSE 8080\n+\n+# Copy sources\n+RUN mkdir /root/VaporGAE\n+ADD main.swift /root/VaporGAE\n+ADD Package.swift /root/VaporGAE\n+\n+# Build the app\n+RUN cd /root/VaporGAE && swift build\n+\n+# Run the app\n+USER root\n+CMD [\"/root/VaporGAE/.build/debug/VaporGAE\"]\n+```\n+\n+## Deploying the app\n+\n+1.  Create an `app.yaml` file with the following contents:\n+\n+```\n+runtime: custom\n+env: flex\n+```\n+\n+1.  Run the following command to deploy your app (make take several minutes):\n+\n+```\n+gcloud app deploy\n+```\n+\n+1.  Visit `http://[YOUR_PROJECT_ID].appspot.com/hello` to see the deployed app.","path":"tutorials/run-swift-vapor-on-google-cloud/index.md","position":null,"original_position":151,"commit_id":"99fc21e5a898f8018f5369a8fe29571a74785c22","original_commit_id":"264d62f4a7711cd33869a48ac419f7fc0bc3d0cc","user":{"login":"mcdonamp","id":2575327,"avatar_url":"https://avatars2.githubusercontent.com/u/2575327?v=3","gravatar_id":"","url":"https://api.github.com/users/mcdonamp","html_url":"https://github.com/mcdonamp","followers_url":"https://api.github.com/users/mcdonamp/followers","following_url":"https://api.github.com/users/mcdonamp/following{/other_user}","gists_url":"https://api.github.com/users/mcdonamp/gists{/gist_id}","starred_url":"https://api.github.com/users/mcdonamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcdonamp/subscriptions","organizations_url":"https://api.github.com/users/mcdonamp/orgs","repos_url":"https://api.github.com/users/mcdonamp/repos","events_url":"https://api.github.com/users/mcdonamp/events{/privacy}","received_events_url":"https://api.github.com/users/mcdonamp/received_events","type":"User","site_admin":false},"body":"Got it. Also had to add a line about adding \"/hello\" to the end","created_at":"2017-03-21T17:10:35Z","updated_at":"2017-03-21T17:10:35Z","html_url":"https://github.com/GoogleCloudPlatform/community/pull/115#discussion_r107216096","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/community/pulls/115","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/community/pulls/comments/107216096"},"html":{"href":"https://github.com/GoogleCloudPlatform/community/pull/115#discussion_r107216096"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/community/pulls/115"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/community/pulls/115","id":111713833,"html_url":"https://github.com/GoogleCloudPlatform/community/pull/115","diff_url":"https://github.com/GoogleCloudPlatform/community/pull/115.diff","patch_url":"https://github.com/GoogleCloudPlatform/community/pull/115.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/community/issues/115","number":115,"state":"open","locked":false,"title":"Adding Swift + Vapor Tutorial on GAE Flex","user":{"login":"mcdonamp","id":2575327,"avatar_url":"https://avatars2.githubusercontent.com/u/2575327?v=3","gravatar_id":"","url":"https://api.github.com/users/mcdonamp","html_url":"https://github.com/mcdonamp","followers_url":"https://api.github.com/users/mcdonamp/followers","following_url":"https://api.github.com/users/mcdonamp/following{/other_user}","gists_url":"https://api.github.com/users/mcdonamp/gists{/gist_id}","starred_url":"https://api.github.com/users/mcdonamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcdonamp/subscriptions","organizations_url":"https://api.github.com/users/mcdonamp/orgs","repos_url":"https://api.github.com/users/mcdonamp/repos","events_url":"https://api.github.com/users/mcdonamp/events{/privacy}","received_events_url":"https://api.github.com/users/mcdonamp/received_events","type":"User","site_admin":false},"body":"Adding a tutorial on Swift and Vapor. Perfect is on its way.","created_at":"2017-03-21T06:55:27Z","updated_at":"2017-03-21T17:10:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7a3f2b81696e04764fd73efac5bc7b4932c8011c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/community/pulls/115/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/community/pulls/115/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/community/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/community/issues/115/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/community/statuses/99fc21e5a898f8018f5369a8fe29571a74785c22","head":{"label":"mcdonamp:mpmcdonald-vapor","ref":"mpmcdonald-vapor","sha":"99fc21e5a898f8018f5369a8fe29571a74785c22","user":{"login":"mcdonamp","id":2575327,"avatar_url":"https://avatars2.githubusercontent.com/u/2575327?v=3","gravatar_id":"","url":"https://api.github.com/users/mcdonamp","html_url":"https://github.com/mcdonamp","followers_url":"https://api.github.com/users/mcdonamp/followers","following_url":"https://api.github.com/users/mcdonamp/following{/other_user}","gists_url":"https://api.github.com/users/mcdonamp/gists{/gist_id}","starred_url":"https://api.github.com/users/mcdonamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcdonamp/subscriptions","organizations_url":"https://api.github.com/users/mcdonamp/orgs","repos_url":"https://api.github.com/users/mcdonamp/repos","events_url":"https://api.github.com/users/mcdonamp/events{/privacy}","received_events_url":"https://api.github.com/users/mcdonamp/received_events","type":"User","site_admin":false},"repo":{"id":85658478,"name":"community","full_name":"mcdonamp/community","owner":{"login":"mcdonamp","id":2575327,"avatar_url":"https://avatars2.githubusercontent.com/u/2575327?v=3","gravatar_id":"","url":"https://api.github.com/users/mcdonamp","html_url":"https://github.com/mcdonamp","followers_url":"https://api.github.com/users/mcdonamp/followers","following_url":"https://api.github.com/users/mcdonamp/following{/other_user}","gists_url":"https://api.github.com/users/mcdonamp/gists{/gist_id}","starred_url":"https://api.github.com/users/mcdonamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcdonamp/subscriptions","organizations_url":"https://api.github.com/users/mcdonamp/orgs","repos_url":"https://api.github.com/users/mcdonamp/repos","events_url":"https://api.github.com/users/mcdonamp/events{/privacy}","received_events_url":"https://api.github.com/users/mcdonamp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mcdonamp/community","description":"Google Cloud Platform Community","fork":true,"url":"https://api.github.com/repos/mcdonamp/community","forks_url":"https://api.github.com/repos/mcdonamp/community/forks","keys_url":"https://api.github.com/repos/mcdonamp/community/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mcdonamp/community/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mcdonamp/community/teams","hooks_url":"https://api.github.com/repos/mcdonamp/community/hooks","issue_events_url":"https://api.github.com/repos/mcdonamp/community/issues/events{/number}","events_url":"https://api.github.com/repos/mcdonamp/community/events","assignees_url":"https://api.github.com/repos/mcdonamp/community/assignees{/user}","branches_url":"https://api.github.com/repos/mcdonamp/community/branches{/branch}","tags_url":"https://api.github.com/repos/mcdonamp/community/tags","blobs_url":"https://api.github.com/repos/mcdonamp/community/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mcdonamp/community/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mcdonamp/community/git/refs{/sha}","trees_url":"https://api.github.com/repos/mcdonamp/community/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mcdonamp/community/statuses/{sha}","languages_url":"https://api.github.com/repos/mcdonamp/community/languages","stargazers_url":"https://api.github.com/repos/mcdonamp/community/stargazers","contributors_url":"https://api.github.com/repos/mcdonamp/community/contributors","subscribers_url":"https://api.github.com/repos/mcdonamp/community/subscribers","subscription_url":"https://api.github.com/repos/mcdonamp/community/subscription","commits_url":"https://api.github.com/repos/mcdonamp/community/commits{/sha}","git_commits_url":"https://api.github.com/repos/mcdonamp/community/git/commits{/sha}","comments_url":"https://api.github.com/repos/mcdonamp/community/comments{/number}","issue_comment_url":"https://api.github.com/repos/mcdonamp/community/issues/comments{/number}","contents_url":"https://api.github.com/repos/mcdonamp/community/contents/{+path}","compare_url":"https://api.github.com/repos/mcdonamp/community/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mcdonamp/community/merges","archive_url":"https://api.github.com/repos/mcdonamp/community/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mcdonamp/community/downloads","issues_url":"https://api.github.com/repos/mcdonamp/community/issues{/number}","pulls_url":"https://api.github.com/repos/mcdonamp/community/pulls{/number}","milestones_url":"https://api.github.com/repos/mcdonamp/community/milestones{/number}","notifications_url":"https://api.github.com/repos/mcdonamp/community/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mcdonamp/community/labels{/name}","releases_url":"https://api.github.com/repos/mcdonamp/community/releases{/id}","deployments_url":"https://api.github.com/repos/mcdonamp/community/deployments","created_at":"2017-03-21T04:17:52Z","updated_at":"2017-03-21T04:17:54Z","pushed_at":"2017-03-21T17:09:54Z","git_url":"git://github.com/mcdonamp/community.git","ssh_url":"git@github.com:mcdonamp/community.git","clone_url":"https://github.com/mcdonamp/community.git","svn_url":"https://github.com/mcdonamp/community","homepage":"https://cloud.google.com/community","size":3520,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"df041ec5f4e4e11214699af0c07e1c9976b85092","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars3.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":50372538,"name":"community","full_name":"GoogleCloudPlatform/community","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars3.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/community","description":"Google Cloud Platform Community","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/community","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/community/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/community/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/community/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/community/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/community/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/community/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/community/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/community/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/community/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/community/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/community/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/community/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/community/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/community/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/community/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/community/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/community/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/community/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/community/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/community/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/community/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/community/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/community/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/community/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/community/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/community/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/community/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/community/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/community/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/community/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/community/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/community/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/community/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/community/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/community/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/community/deployments","created_at":"2016-01-25T18:46:16Z","updated_at":"2017-03-16T09:18:03Z","pushed_at":"2017-03-21T17:09:55Z","git_url":"git://github.com/GoogleCloudPlatform/community.git","ssh_url":"git@github.com:GoogleCloudPlatform/community.git","clone_url":"https://github.com/GoogleCloudPlatform/community.git","svn_url":"https://github.com/GoogleCloudPlatform/community","homepage":"https://cloud.google.com/community","size":3496,"stargazers_count":23,"watchers_count":23,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":21,"forks":14,"open_issues":21,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/community/pulls/115"},"html":{"href":"https://github.com/GoogleCloudPlatform/community/pull/115"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/community/issues/115"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/community/issues/115/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/community/pulls/115/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/community/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/community/pulls/115/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/community/statuses/99fc21e5a898f8018f5369a8fe29571a74785c22"}}}}
{"actor":{"display_login":"mcdonamp"}}