You need to install Google Cloud SDK and check if you have gcloud command available in terminal. After installing gcloud you need to configure gcloud sdk by running
gcloud init command.
I am assuming, you have configured your Google Cloud SQL instance for your project. If yes, then continue, otherwise you need to read “Google Cloud SQL Quickstarter Guide“.
Now Download cloud_sql_proxy.linux.amd64 package in your local machine with
"sudo wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64"
mv cloud_sql_proxy.linux.amd64 cloud_sql_proxy
and give execution permission by
chmod +x cloud_sql_proxy
Create application default credentials using “gcloud auth application-default login” command
Create a directory
sudo mkdir -p /cloudsql for Google Cloud SQL proxy unix socket and make that directory writable
sudo chmod 777 /cloudsql
start sql socket proxy by
./cloud_sql_proxy -dir=/cloudsql &
Now you can have working mysql DSN “mysql:unix_socket=/cloudsql/INSTANCE_CONNECTION_NAME” which you can use in your application and your application will work with Google Cloud SQL instance directly from local machine.
Please ask me anything about this post in comment below. I will be glad to assist you happily.
Whole the night I was struggling to build a safe house for my codes where my codes can live longer safely. Sounds funny? Yes, it is. So whenever you or I think about to build a safe place to host our codes then first priority we consider about Backup and Restoring files with less hassle. And today I figured our a very sophisticated way about to handle synchronizing or backup/restore your files between your Linux flavor computer and Rackspace Cloud Files.
In my research case I had one cloud server on Rackspace. That server was powered by Ubuntu Server 14.04 LTS. I usually use Rackspace Cloud Files to keep my backup files on cloud so I can easily use them. So I wanted to figure our a very simple way to handle the backup which will automatically take backup and store those backups to Rackspace Cloud Files.
Suddenly for God’s sake I got a link in Rackspace forum that was about FileConveyor. OMG! This tools really works amazing. So I can easily upload backup from my cloud server to Rackspace Cloud Files with this life saving FileConveyor.
Here is the process to install FileConveyor in your server or personal Linux flavor computer.
You’ll need to modify the config to fit your environment and account details.
In the “Sources” section change the “scanPath” property to the directory you want to sync.
In the “Servers” section set “username” and “api_key” to match your credentials, and set “container” to the name of the container to hold the synced files.
In the “Rules” section set the “path” property to the subdirectory to sync to in the container. Leave the value blank to sync to the root of the container (path=””).
Now run this awesome tools with this
sudo python src/fileconveyor/fileconveyor/arbitrator.py command.
Note: If you see any error like Transport class not found or something related to transport class then please install django-cumulus==1.0.10 package with this command
pip install django-cumulus==1.0.10. Now again run FileConveyor and it will start syncing.
It’s cool! huh? Of course it will save you from losing life for codes.
To stop the fileconveyor process run this kill -TERM
cat ~/.fileconveyor.pid command