Monday, December 17, 2012

PhotoDB, TomEE and httpd in the cloud

This post will show how you could install our PhotoDB application and the TomEE server in the cloud with a T1 Micro box. Go to the website and open the "Management Console".

Click on "EC2".

Click on "Launch Instance".

Click "Continue".

Select "Ubuntu 12.04.1 LTS".

Click "Continue".

Click "Continue" again.

And again...

Give a name to your box and click "Continue".

Select "Create a new Key Pair", give a name to it and click "Create & Download your Key Pair".

Select "Create a new Security Group", give a name to your new group and add the "ssh" and the "http" rules to your firewall. Click "Continue".

Click "Launch".

Click "Close".

Open a terminal and execute the following command...

Click on "Instances".

"Right-Click" your running instance and click "Connect".

Click "Connect with a standalone SSH Client" and copy the example they give.

Go to your terminal and paste this command. Change the path to your key and the user name from "root" to "ubuntu".

Hit "Enter" and say "yes".

Now it is time to install our software and start TomEE. I am going to use a TomEE server with a pre-installed photodb application. Execute the following lines in order to download it to your Amazon box.

sudo apt-get update && \
sudo apt-get install -y openjdk-7-jdk make apache2 libapache2-mod-proxy-html && \
wget && \
make start-tomee && \
sudo a2enmod proxy_http && \
sudo vi /etc/apache2/mods-enabled/proxy.conf

The last command will open the "proxy.conf" file. Paste the following code to this file.

<VirtualHost *:80>
  ProxyRequests   Off
  ProxyPass  "/" http://localhost:8080/photodb/
  ProxyPassReverse "/" http://localhost:8080/photodb/

Save and close the file.

Restart the Apache (httpd) server.

sudo service apache2 restart

Type "exit" to logout and copy the address of your server.

Open a browser and paste this address.

The "user name" is "michael" and the "password" is "bad".

Done. Now you have a TomEE server running in the cloud! Time to play around. Drag some pictures to your browser...

Don't forget to "terminate" our server instance once you are done playing with it, otherwise you will keep paying for the server.