Create an Emergence Server on Google Cloud Engine


#1

#1. Create GCE Project

Once logged into the Google Developer Console, create a new project or selected an existing project.

#2. Create VM Instance

  1. When in a project, select ‘VM instances’ under Compute Engine and then click ‘New Instance’.
  2. Choose your machine type and for your boot disk select a 20gb SSD running ubuntu 14.04, we’ll use this to run the operating system and mount the emergence data on another disk.
  3. Under ‘Additional Disks’ create a new blank disk using a size of your choosing.
  4. Click Create and wait until google’s done creating the instance

#3. Configure Network Rules
Once created we need to unblock the mysql and backend ports that emergence uses. Under the Network tab, add the two following Firewall rules:

Name: emergence-manager
Destination IP Ranges: Allow from any source (0.0.0.0/0)
Allowed protocols / ports: tcp:9083

Name: emergence-mysql
Destination IP Ranges: Allow from any source (0.0.0.0/0)
Allowed protocols / ports: tcp:3306;udp:3306

#4. Install Emergence
Now you can install emergences using the instructions found here: http://emr.ge/docs/setup/ubuntu/14.04

#5. Disk Mounting
Once Emergence is running we want to mount all of the data from Emergence to the second persistent disk we created.

To be continued…

#6. Configure DNS

To get domains working properly with your instance (both root and subdomains) use the following two DNS settings. The first point your domain at the specified IP and the second wildcard allow emergence to manage subdomains.

Type: A Record
Host: example.com
Data: External IP of Instance

Type: CNAME
Host: example.com
Data: *.example.com

#7. Install your workstation’s SSH key to the server
Assuming you have Google’s Cloud SDK setup on your machine, you should be able to ssh in using the following command:

Set project:

gcloud config set project YOUR_PROJECT_ID

Set key files (you must login one to update your key files)

gcloud compute ssh USERNAME@YOUR_INSTANCE_NAME --zone YOUR_INSTANCE_ZONE

You can most easily find the values for all the placeholders in the URL for Google’s developer console when you have the details page for your instance open. Once you’ve used gcloud compute ssh at least once to connect from your workstation, your workstation’s private key at ~/.ssh/google_compute_engine will work with any standard SSH client going forward. gcloud authenticates you based on your Google account the first time you connect and installs the key for you.

#8. Get MySQL Access with External Client (MySQL Workbench, Querious etc.)

To get this working you need to set the bind host in the mysql configs. You can find the instructions for that here: http://emr.ge/docs/developing/accessing-mysql

Then to access use the following settings:

Host: 127.0.0.1
User: root
Password: (get from /emergence/config.json)
Security: SSH
SSH Host: host name or IP of your server
SSH User: username when logged into the ssh terminal in CGE
SSH Password: Select the ‘google_compute_engine’ file saved from CGE likely at (~/.ssh/google_compute_engine)


#2

@tyler I’d break off moving the /emergence tree to its own disk as a separate guide that’s not focused on GCE, but then from here have an optional step that tells you how to create/attach a new disk with GCE and then links out to the other guide for the rest of those steps

Also opening up MySQL’s port to the public is dangerous and unnecessary, best practice is using an SSH tunnel for connecting to MySQL.