So everything from this sentence onwards is prefaced with "I am not a UNIX expert, all the steps here worked for me, you might get different mileage, if your home explodes or your dog suddenly hates you I accept no liability"
After a rather tedious 4 days of fighting with Google Cloud Compute I appear to have managed to set up AwareIM on an external server - Yay for me.
I wasn't super diligent in taking notes but I did end up having to do it about three times so I am reasonably certain that it is mostly complete. I'm happy to answer questions about what I did, but I am really not going to be the best person to debug or help with stuff not in the steps below.
I chose Centos 7 as the server and MySQL as the Cloud database. My choices were based on cost and that I really dislike Windows.
Setting Up with Google Cloud.
1 Create a Project - Everything below then is associated with this project
2 Create an Cloud Compute instance (UNIX)
- choose your name carefully - it cannot be changed after the event
3 Ensure that you have enabled the SQL API for the instance
4 Create an CloudSQL instance - take a note of the instance name
5 Login to your Cloud COmpute instance
Install the SQL proxy in your Cloud Compute instance - this psychs the instance into believing that it
is dealing directly with a local mySQL
instance
- sudo yum install wget
- sudo wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64
* be aware where you are downloading this to that is where it will end up (I put mine in /bin/)
- sudo mv cloud_sql_proxy.linux.amd64 cloud_sql_proxy
- sudo chmod +x cloud_sql_proxy
- sudo ./cloud_sql_proxy -instances=[YOUR INSTANCE NAME FROM STEP4]=tcp:3306
- you will also need to install Java (sudo yum install java-1.8.0-openjdk-devel)
6 Ensure that on the Networking Console Page that you have opened ports 8080, 9000, 61616
7 Obtain a static IP address
8 Assign it to your Cloud Compute instance
9 mkdir /opt/awareim - I did this to place the Aware install in a commonly available location
10 Unzip your AwareIM.tar file (sudo tar -xvf AwareIM.tar -C /opt/awareim/)
11 Rename BASServer.props to BASServer-Default.props on the Cloud Compute
Instance in the /opt/awareim/bin folder -
Rename BASServerMySQL.props to BASServer.props
Edit the BASServer.props file use the mySQL root password but leave it set to localhost (you are
using the proxy to connect to the database)
- I downloaded nano to edit with as it is about a zillion times easier to use that vi (sudo yum
install nano)
- sudo nano /opt/aware/bin/BASServer.props
12 While in the BASServer.props edit
DirectoryServiceProvider=tcp://localhost:61616 change localhost to the name you chose in step 2
JMS_BROKER_CONNECTOR=tcp://localhost:61616 change localhost to the name you chose in step 2
Write out (Ctrl-O) and exit Ctrl-X
13 From the /opt/awareim/bin directory run the server - bash startAwareIMNoGUI.sh
14 On your Mac install the eval version of AwareIM
DO NOT RUN it
15 Edit the UIConfig.props file in the AwareIM folder and use the server name of the Cloud Compute instance where it says localhost
16 Edit the etc/hosts file on your Mac (terminal sudo nano etc/hosts) add the External IP address from step 7 and the Name from step 2
You should probably add a startup script for the Cloud SQL Proxy and to restart the server. I have not gotten that to work yet.
My learnings are:
Google Cloud Compute is not very forgiving once you have set up a server. If you name it incorrectly or you didn't provision the correct APIs I found it easier to just scratch it and start again - the help docs are not the most straightforward.
Also bear in mind that SQL Cloud doesn't need to have any of it's IP addresses exposed if you use the CloudSQL Proxy - this means that you can connect to your SQL server remotely without an IP address as long as you have the SSH keys and the instance name on your desktop. Likewise for your Cloud Compute server does not need any IP addresses or hostnames to connect to your Cloud SQL server instance it is spoofed into thinking it is local. I don't know if that makes it more secure or makes no difference.
I have also added a bunch of files to the home user folder:
/bin/BASServer.props - copied from /opt/awareim/bin
/Webapps/AwareIM/start.html
/Webapps/AwareIM/Custom/
/Webapps/AwareIM/Font-Awesome-4.7.0
In the event that I need to reinstall AwareIM I will then be able to copy these back to installation.
I still have a permissions issue on the Tomcat folder and AwareIM server gives warnings that it cannot write to scratch Dirs, but it is working at the moment.
[Edit]
This link http://www.tecmint.com/create-new-service-units-in-systemd/ explains how to setup services on Centos 7 and was really useful in making sure that the SQL Proxy runs on setup
This thread also helped with the setting up of the client
https://www.awareim.com/forum/d/9604>