Google Docker

Objective


Learn how to set up a machine on Google Cloud.


Steps


  1. Create an account on Google Cloud
  2. Create a machine
    1. Specify which image to use and which flavor
    2. Insert your SSH Key
    3. Update Firewall Rules
  3. Connect to the Machine
  4. Download the pre-requisites, the installer & run the Installer pre script on the machine
    1. Zip docker certificates



Step 1: Create an account on Google Cloud


  • Begin by Creating a Google Cloud account →  Click Here.
    • Follow the steps of Google Cloud wizard



Step 2: Create a machine


  • Click on Compute Engine → VM Instances → Create Instance
  • Specify the machine image type, OS and version:  Ubuntu 16.04 LTS
  • Specify the flavor: 3.75 GB Compute v1
  • Click on: Management, disks, networking, SSH keys
    • Select SSH Keys Tab
    • Paste your public ssh key value
  • Click on VPC Networks → Firewall Rules
    • Enable the ports needed to deploy the Cloud and connect to Mongo and Nginx
Create VM InstanceEnter your SSH KeyFirewall Rules Configuration



Step 3: Connect to the Machine


Once you add your public ssh key, the username shows up next to it in the google wizard. use that username to SSH the machine.

Connect to the Machine
# connect to the machine using the IP address
> ssh %username%@%external ip address of machine%
External IP Address



Step 4: Download the pre-requisites, the installer & run the Installer pre script on Google Machine


Once you SSH to the machine, you can download and run the installer pre installation script to get all the dependencies so that cloud deployment works.

Prepare the machine

Download & Run SOAJS Installer pre scripts
# download update apt-get, npm and zip
> sudo su
> apt-get update && apt-get -y upgrade
> apt-get install npm
> apt-get install zip

# download the latest version of nodejs
> curl -sL https://deb.nodesource.com/setup_6.x | bash && apt-get install -y nodejs
Run the installer
# download installer 
> mkdir -p /opt/soajs/node_modules 
> cd /opt/soajs/node_modules 
> sudo npm install soajs.installer 

# run installer pre script 
> cd soajs.installer/scripts/pre 
> sudo /opt/soajs/node_modules/soajs.installer/scripts/pre/docker-linux.sh <%YOUR_CUSTOM_DOMAIN%>

Download Docker Certificates

Zip and Download the generated docker certificates from the above step to your local machine.

zip certificates
> cd /root
> zip -r certs.zip certs/*
> mv /root/certs.zip ~

From here on, use the installer from your local machine to deploy SOAJS on the remote machine you created.