Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Unified Diff: services/http_server/README.md

Issue 727023002: Add instructions for how to push a Mojo http handler to Google Compute. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: add bug Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/http_server/README.md
diff --git a/services/http_server/README.md b/services/http_server/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..169b3aa8a8c759b04516996d4f25cdeb3afc0a00
--- /dev/null
+++ b/services/http_server/README.md
@@ -0,0 +1,70 @@
+How to run HTTP apps on GCE
+====
+
+These are the steps to create a Mojo app that handles some URLs and push it to run on Google Compute Engine.
+
+
+## Set up Google Cloud Platform
+Install Google Cloud Platform SDK: https://cloud.google.com/sdk/
+
+
+## Authenticate
+You'll need to set a project for the Google Cloud Platform scripts. If you're a Googler, note that you shouldn't use a corporate card for this.
+
+If you're on the Mojo team, ping jam to get added to the "mojodemos" project first.
+
+If you're not on Mojo team, then create a project on Google Compute Engine and replace "mojodemos" with your project-id below. Also make sure to enable the "Google Compute Engine" API" at your project's console https://console.developers.google.com
+
+
+```
+gcloud auth login
+gcloud config set project mojodemos
+```
+
+
+## Create a VM
+Now create a VM that'll run the binary. The Debian image doesn't work because of some GLib dependencies in our binaries that we should remove (http://crbug.com/433886). Until then, you have to use the Ubuntu image:
+```
+gcloud compute instances create YOUR-VM-NAME-HERE --image ubuntu-1404-trusty-v20141031a --image-project ubuntu-os-cloud --zone us-central1-a
+```
+
+Make note of the external IP address of this machine; you'll use this later to connect to the Mojo app.
+
+Install some required packages:
+```
+gcloud compute ssh YOUR-VM-NAME-HERE --command "sudo apt-get install libgconf-2-4 -y" --zone us-central1-a
+gcloud compute ssh YOUR-VM-NAME-HERE --command "sudo apt-get install libnss3 -y" --zone us-central1-a
+```
+
+If you're not using mojodemos project-id and created a new project, add a firewall rule to allow port 80:
+```
+gcloud compute firewall-rules create allow-http --description "Incoming http allowed." --allow tcp:80
+```
+
+
+## Push the Mojo binaries
+Create a directory to hold the binaries:
+```
+gcloud compute ssh YOUR-VM-NAME-HERE --command "mkdir ~/mojo" --zone us-central1-a
+```
+
+For this example, we'll use the examples/http_handler binary which is a minimal Mojo HTTP app. Assuming you've built the release binary:
+
+```
+gcloud compute copy-files out/Release/libhttp_handler.so out/Release/libhttp_server.so out/Release/libnetwork_service.so out/Release/mojo_shell YOUR-VM-NAME-HERE:~/mojo --zone us-central1-a
+```
+
+
+## Run the Mojo app
+```
+gcloud compute ssh YOUR-VM-NAME-HERE --command "sudo mojo/mojo_shell mojo://http_handler" --zone us-central1-a
+```
+
+Now you can visit the IP address from the previous step.
+
+
+## Delete the VM
+Once you're not using the VM anymore:
+```
+gcloud compute instances delete YOUR-VM-NAME-HERE --zone us-central1-a
+```
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698