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

SSH into your GCE instance as described in the last step of Running Docker on Google Compute Engine

Choose a password for your RabbitMQ instance, eg, supersecret2

Now launch RabbitMQ using the password you chose:

sudo docker run -d -p 5672:5672 -p 15672:15672 -e RABBITMQ_PASS=supersecret2 tutum/rabbitmq

Add firewall rules

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
$ gcloud compute firewalls create allow-5672 --allow tcp:5672

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.

Find your amqp URI

You will need to know your amqp URI for the next steps. The amqp URI is made up of:

amqp://<username>:<rabbitmq_password>@<external_ip>/

So in the example of this tutorial, that would be:

amqp://admin:[email protected]/

Launch OpenOCR HTTP Server

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

$ sudo docker run -d -p 8080:8080 tleyden5iwx/open-ocr open-ocr-httpd -amqp_uri "amqp://admin:[email protected]/" -http_port 8080

You must substitue the amqp_uri parameter used above to reflect your actual amqp_uri, depending on your ip address and password.

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://admin:[email protected]/"

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

Verify that it's working

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.