10-17-2017 08:17 AM - edited 09-05-2018 02:29 AM
Here is a link to my Instructable documenting the setup of a controller on a Free micro instance of Google Cloud Platform.
The resources are limited, but several people have been running it with smaller deployments without problem.
Update: 9/5/2018 Added commands for Google Cloud Shell to make deployment even easier. Open a text file and make some modifications for your specific needs and then copy/paste to create everything needed. Paired with the script from @PetriR this makes the deployment very quick and easy.
10-17-2017 09:37 AM
Thanks! I also have a Unifi Controller set up in the Google Cloud using the "always free" tier. I used your instructions to set up a 1GB swap file.
So far I've been very happy with the Google Cloud. My AWS free trial hasn't expired yet so I was looking for cheaper alternatives when I found Google Cloud Compute.
11-17-2017 07:04 AM
12-22-2017 07:34 AM - edited 12-22-2017 07:55 AM
DId this recently as well. Works very nicely.
One other suggestion--I created a google cloud storage bucket for backups. Then I dropped a simple cron script into the /etc/cron.daily folder of the instance that syncs the contents of /var/lib/unifi/backup into the storage bucket.
This is important to retain the backup folder separately from the instance, just in case the VM dies and becomes unusable. If that happens, you can then spin up another instance and easily restore the backup from the storage bucket.
gsutil rsync -r -d /var/lib/unifi/backup gs://[name_of_storage_bucket]
dont forget to chmod +x to make the script executable by crontab.
You could also take snapshots of the instance, but that will only preserve the status quo. I like having the backup file separately for more flexibility in case I want to upgrade to a different version of the controller, or use a different image for the instance.
Finally, I will just point out that the entropy error in Ubuntu which causes long boot times for the instnance can be easily fixed by installing
sudo apt-get install haveged
as noted in this post
12-27-2017 09:08 AM
Thanks for the note on haveged. Is there anything you need to do after installing it? I did the apt-get you mentioned and rebooted and it still took 8 minutes compared to 20 before I installed it.
[2017-12-27 16:57:39,728] <launcher> INFO system - Hostname: unifi-controller [2017-12-27 17:05:21,954] <localhost-startStop-1> WARN SessionIdGeneratorBase - Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [459,019] milliseconds.
I'll take a closer look at the storage bucket as well. I'm not familiar with them but a good idea if you can copy the backups to it.
12-27-2017 06:29 PM - edited 12-27-2017 06:30 PM
Not really sure why you still have such a long boot time. Mine takes just a few seconds to come alive. I am using a Ubuntu 16.04 image with all the apt-get upgrades. I simply ran the install command for haveged, nothing special or anything.
12-27-2017 06:48 PM
I've upgraded to 17.10 so maybe that plays into it somewhat. I'm not sure.
I almost have the storage buckets setup. I can manually copy the backup files but the cron script isn't working just yet. I'm documenting in instructables at the same time and I think it is causing some copy and paste errors, so going to manually bang out the script and see if that resolves it.
12-28-2017 01:24 PM
I would like to know some stats from the people who are using the free google cloud.
1. How many sites per controller?
2. Average devices per site?
3. Clients per site?
4. DPI and Settings, minimum stats saved? DPI on/off?
5. Guest Portal?
6. VPN tunnels between sites, only multisite controllers or if your are manually creating the vpns?
We just switched from a cloud key back to a headless windows controller. Had 30+ sites on the CK with no portals or stats retention or DPI. CK kept crashing. Window pc no issues or ram or cpu spikes with about 35 sites now, with DPI on some sites and vpn tunnels between sites too. 600+ client devices
12-28-2017 09:55 PM
Thank you @MallocArray for the great instructions. I got my GCP Controller all up and running with minimal stress.
A few minor updates to the documentation you may consider:
- Minor typo: 'VPN Network' should be VPC Network'
- I would also suggest making clear that 'Menu' means the Google Cloud Platform primary Memu and no the VM Instance Menu
- Step 2 5.1.5 is 'Create' rather than 'Save'
12-29-2017 11:20 AM
@ncscomm The free VM in GCP won't be up for that large of an install. I'm not sure how large the Cloud Key is designed to support, but this VM is less than the Cloud Key specs wise.
I'm running my home from with, USG, 2 UAP and 18 clients with no problems. I sometimes have a guest portal, but always a guest network.
01-09-2018 08:41 AM
Someone on Instructables pointed out that their IP changed when they restarted their instance. I wasn't experiencing that until the last week when mine changed for the first time.
I updated Step 2 with another sub-step 6 that covers creating a Static IP reservation so it won't happen in the future.
01-09-2018 11:07 AM
that was me. Really appreciate your guide. Only thing I would change is that I would deploy this to an SSD and just eat the cost per month as this helps with the performance of the micro deployment.
01-13-2018 11:23 PM - edited 01-13-2018 11:25 PM
Im just going to say i looked at Google Cloud after getting locked out of my paid instance on LightSail (twice last week), and went no thanks (on top of why continually chase trying to stay under a free limit...$5 a month, thats a cup of coffee folks...), went over to digitalocean where i should have gone in the first place...same price $5/m...and they have a VNC console to your instance, so even if you (or LightSail in my case - no support ticket option on lower tier, even paid...joke) lock yourself out of ssh access, you can login to the dashboard and VNC back into it and recover, and if thats not enough theres also a recovery image they can mount for you.
You are not going to get that on most of the VPS servers...certianly not on LightSail (turns head and spits) and i suspect Google Cloud free
01-17-2018 11:29 AM
I'll say now that at least for me it's not about the $5/mo. I have a colo in LA, a Knownhost VPS and a DO droplet (which now that they've increased the RAM allocated to droplets I can move down one level, until just very recently for $5 at DO you would only get 512Mb of RAM.) and I'm currently testing a Scaleway server to see how it compares to DO).
For me, it's the fun part of doing something with nothing (which is one reason I love SBC's so much). I haven't had a chance to play around with GCP and this was a way to do so. I'm using this for my home network and the free tier may be a touch underpowered I haven't had any complaints or issues staying under the free limit.