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:

gce:~$ 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:supersecret2@142.222.178.49/

To make life easier in later stesp, export that as an environment variable on your GCE instance:

gce:~$ export AMQP_URI=amqp://admin:supersecret2@142.222.178.49/

Launch OpenOCR HTTP Server

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

gce:~$ sudo docker run -d -p 8080:8080 tleyden5iwx/open-ocr open-ocr-httpd -amqp_uri "${AMQP_URI}" -http_port 8080

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_URI}"

Verify that it's working

$ 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.