Transferring from a Hosting site to Google Cloud

Below you will find details of how I transitioned from a Hosting site to Google Cloud
If you are looking to move your domain email as well then you might as well stop reading as I haven't managed to get this working yet

First, well it wasn't first but for the sake of this page lets go for first ;)

Domain Name Set UP

I guess you could do this at the end but on this attempt I did it first.
Just follow the instructions on this, create-domain-tutorial, Page.
I already had a domain so I skipped straight to step 4. If you don't have a domain do step 1 and then go to 4. When doing step 4 skip point 7 for just now and complete the rest of the process.


Signed Certificate for https Set Up

All websites should really be https so you need to get a signed certificate and luckily google gets one for you..
Just follow the step 1 instructions on this, google-managed-certs, Page..


Load Balancing Set UP

You need to set up a load balancer...
Just follow the instructions on this, ext-https-lb-simple, Page...
I followed all these instructions...
At the step where you enter the number of instances I enterend 2 as the page suggest but I later went back and changed this to 1 and deleted the second load balancer...
You can now go back to point 7 of step 4 of the Domain set up and enter the external ip address of your load balancer...


http to https Set UP

Now you need to set up a second load balancer to transfer http to https....
The difference this time is you don't need to set up the backend of the load balancer....
Just follow the instructions on this, setting-up-traffic-management, Page.


Virtual Machine Set up

At this point you should have a Virtual machine that you can reach with http and https and your domain name.....
Now its time to set up your Virtual Machine with all your website files.....

Just follow the instructions on this, setting-up-lamp, Page.
We already installed Apache as part of the load balancer set up so we can just run:.....

sudo apt-get update.....
sudo apt-get install php libapache2-mod-php.....

For the mysql install the command, sudo apt-get install mysql-server php5-mysql php-pear, didn't work for me and I had to do:.....

sudo apt-get install default-mysql-server.....
sudo apt-get install php-mysql php-pear.....
sudo systemctl restart apache2.....

To transfer one of my databases I ran the following commands.....

sudo mysql -u root.....
show databases;.....
create database database_name;.....
GRANT ALL ON database_name.* TO username@localhost IDENTIFIED BY 'password';.....
mysql -u username -p database_name < /path/to/file/database_name.sql (database_name.sql is the export of your database that you need to create).....
use database_name.....
show tables;.....


Postfix Mail Server Set UP

Like I said, I didn't actually get this working.......

I got as far as being able to send emails from the virtual machine using sendgrid but wasn't able to recieve them and not sure it was going to be able to send and recieve mail from various domain email accounts.......

Just follow the instructions on this, postfix-mail-server, Page.


Schedular Set UP

However I did manage to get the Schedular to work........
However I have mislaid how I did it so when I find it I will post it here.

It's a bit expensive

After all that it turns out it is a bit expensive so I might need to find a cheaper way to do it.

If I find a better way I will post it here