Skip to content

Installation on Google Compute Engine

Traun Leyden edited this page Jun 21, 2014 · 17 revisions

Create GCE instance and ssh in

Follow the instructions on Running Docker on Google Compute Engine.

At this point you should be ssh'd into your GCE instance

Launch RabbitMQ instance on CloudAMQP

While it is possible to launch RabbitMQ on GCE, it requires the use of container links, so this tutorial uses CloudAMQP instead

  • Create a new account on CloudAMQP
  • Launch a new AMQP instance
  • From the AMQP Console get your AMQP URL, eg, amqp://cgj:BScjD@tiger.cloudamqp.com/cgj

Add firewall rule

This should be run on your workstation, and assumes you've already installed the gcloud utility as described in Running Docker on Google Compute Engine.

$ gcloud compute firewalls create allow-8080 --allow tcp:8080

Launch OpenOCR HTTP Server

SSH into your GCE instance as described in the last step of Running Docker on Google Compute Engine, and then do the following:

sudo docker run -d -p 8080:8080 tleyden5iwx/open-ocr open-ocr-httpd -amqp_uri "amqp://cgj:BScjD@tiger.cloudamqp.com/cgj" -http_port 8080

You must change the amqp_uri parameter to the one you created in the previous step: Launch RabbitMQ instance on CloudAMQP

To verify that it worked, run:

curl http://localhost:8080

and you should see "OpenOCR is running!" in the HTML returned.

Launch OpenOCR Worker

This assumes you are still SSH'd into your GCE instance.

Run a worker with:

sudo docker run -d tleyden5iwx/open-ocr open-ocr-worker -amqp_uri "amqp://cgj:BScjD@tiger.cloudamqp.com/cgj"

Again, you must replace the amqp_uri parameter with the one you created in the previous step.

Verify that it's working

First find your external IP

On your workstation with the gcloud tool installed, run:

$ gcloud compute instances list -l
name     status  zone          machineType internalIP   externalIP
open-ocr RUNNING us-central1-a f1-micro    10.240.74.44 142.222.178.49

Your external ip is listed under the externalIP column, eg 142.222.178.49 in this example.

Make a REST API curl request

$ curl -X POST -H "Content-Type: application/json" -d '{"img_url":"http://bit.ly/ocrimage","engine":"tesseract"}' http://142.222.178.49:8080/ocr

and you should see the following decoded OCR text output:

You can create local variables for the pipelines within the template by
prefixing the variable name with a “$" sign. Variable names have to be
composed of alphanumeric characters and the underscore. In the example
below I have used a few variations that work for variable names.