Rollback : Undo the previous deployment that failed to complete in Google App Engine[Python]
When we deploy project on Google App Engine and due to some error it got cancelled. It may happen if user manually cancel the deployment of project in between or due to slow network or any other reason. This leads to incomplete deployment of projects and revoke deploy from the next time as the existing deployment is in progress. Rollback is the option to undo the previous deployment that failed to complete but marked as in progress deployment.
There are two ways to solve this using rollback option of appcfg.py command.

Solution 1:-

1) Set environment variable for python

2) Place your project’s app.yaml in 

C:\Program Files(x86)\Google\google_appengine

3) Open cmd and using change the directory to 

cd C:\Program Files (x86)\Google\google_appengine

4) Run the command

python appcfg.py rollback app.yaml

5) Remove the app.yaml file from that folder after rollback as the this command uses app.yaml information when you upload the app.

Solution 2:-

Use the following command :-

appcfg.py rollback “<directory>”

Further Reading

http://array151.com/blog/appcfg-one-click-deployment-to-google-app-engine/

http://array151.com/blog/appcfg-download-source-code-and-logs-from-gae/

http://array151.com/blog/how-to-get-xhtml2pdf-working-on-google-app-engine/

http://array151.com/blog/channel-api-server-to-client-communication/

Sticky Notes : Share your notes across all your devices using Google Drive

Sticky notes is a desktop application that comes with Windows operating system. It is a note making tool that allows users to add notes to the desktop window. Due to the desktop application, there is no by default support to share same sticky-notes between different computers. But this post will guide you to share your notes across all your devices.


Sync sticky notes to Google drive

1) Download Google Drive and install

2) Windows save Sticky-Notes files under “%AppData%Microsoft/StickyNotes

3) Cut this folder “Sticky Notes” from Microsoft folder and paste to Google Drive folder “C:Users<user_name>Google Drive

4) Now make soft link into Microsoft folder. Open cmd and run

mklink /J "%AppData%MicrosoftSticky Notes" "C:Users<user_name>Google DriveSticky Notes" 

(Note: Change user in path)

5) This will sync All the notes into your Google Drive.

Sync on Other Machine 

1) Delete the StickyNotes folder from “%AppData%Microsoft

2) Perform Step 4 from Above.

 3) Done
Google Compute Engine : Move VM Instance from One Project to Other
In the previous post we have learned how you can change your machine type of running VM instance on Google Compute Engine. This post will guide you how you can move your running instance from one project to some other project.

Steps :-

1) We need to make image of instance and copy it on Google Bucket. For this SSH into instance that you want to move.
 Developer Console -> Compute Engine -> VM Instance -> SSH (any-instance)

2) Make temporary directory to copy the image of running instance

sudo mkdir /mnt/tmp
3) Now list the drives
ls -l /dev/disk/by-id/google-*

4) Check disk that you want to export to bucket (as we are moving instance and it is mostly installed on sda)

5) As we are going to create image on temporary folder so there must have enough space for new image file. For this we can mount non persistent disk if not enough space on prime drive (sda). In case you don’t have external disk you can create new one from Developer Console and attach it to running instance.

6)  The following command will format and mount the external non persistent disk (sdb)

sudo /usr/share/google/safe_format_and_mount -m "mkfs.ext4 -F" /dev/sdb /mnt/tmp 
7) Now using imagebunde package create image of vm instance
sudo gcimagebundle -d /dev/sda -o /mnt/tmp/ --log_file=/tmp/abc.log 
8) Now check the new tar file in location
   ls -l /mnt/tmp
9) To export this on Google Bucket we need to provide owner permission to service account. For this check the service account by this command
curl "http://metadata/computeMetadata/v1/instance/service-   accounts/" -H "Metadata-Flavor:Google"
10) Now provide this service account the owner permission on Google Bucket from Developer Console

 

11) Change the permission of your newly created image (tar file)

/mnt/tmp/d0e9184d539ae7c0274590942ef05af13450.image.tar.gz

 using

chmod u=rwx,g=rwx,o=rwx      mnt/tmp/d0e9184d539ae7c0274590942ef05af13450.image.tar.gz

12 ) Copy this tar file to Google Bucket using

gsutil cp /mnt/tmp/d0e9184d539ae7c0274590942ef05af13450.image.tar.gz gs://bucket_name

13 ) Check this file on Google Bucket and share it publicly.

14) Now under new project create a new image from Developer Console

Developer Console -> Compute Engine -> Images -> New Image -> Select image source from google bucket 

and type

gs://bucket-name/filename  

15) Make an instance from Developer Console using this image created above.

Netbeans Plugin : Install python in netbeans

No direct plugin is available that can be installed from netbeans marketplace itself. To support python in netbeans, you need to download plugin files manually and install it.

Steps :-

1) Open NetBeans and click  “Tools” -> “Plugins”.
2) Click the “Downloaded” .
3) Click the “Add Plugins…” button.

4) Browse to the folder you unzipped the Python plugin files to.

5) Select all *.nbm” files.

6) Click “Open” and Click “Install”.

7) Restart your browser.

8) Done

Google Compute Engine : Change Machine Type of Running VM

Google Cloud Platform is a suite of public cloud computing services offered by Google. The platform includes a range of hosted services for compute, storage and application development that run on Google hardware. Google Compute Engine is one of the services that provide to create scalable, high performance and secure virtual machines running on Google hardware.
This post will guide you to update the machine type of existing running instance. For this, you have to install Google Cloud SDK.

Steps

1) Delete the instance that you want to upgrade by keeping its boot disk.

gcloud compute instances delete <instance-name> --keep-disks boot

2) Now create image from this boot disk

gcloud compute images create <any-image-name> --source-disk <instance-name>

3) Now Check Images list

gcloud compute images list

4) Now create a new instance from developer console or using gcloud compute and select your image as the boot disk.

5) Done.

Note

You can verify this by creating a file on the instance before deleting it. And after creating a new instance from this you can verify the created file.

For more on google compute engine checkout next post.

Access MySQL using public IP of VM instance (Google Server)

If you have MySQL on VM hosted on Google server then by default it listens on the local IP address of the machine that is on localhost (127.0.0.1). If you want to access MySQL using public IP of VM then following are some steps :

1) SSH into VM instance.

2) Go to /etc/mysql directory using

cd /etc/mysql

3) Edit my.cnf file. By default, the permissions are u=rw,g=r,o=r so we need to change its permissions to edit using

sudo chmod u=rwx,g=rwx,o=rwx my.cnf

4) Now edit this file using

vi my.cnf 

5) Under [mysqld] directive change bind-address to 0.0.0.0

bind-address=<YOUR-SERVER-IP>

6) Comment out the skip-networking

# skip-networking

7) Save my.cnf by pressing Esc and :wq and hit enter

8) Restart the Mysql service using

 etc/init.d/mysqld restart

9) Login to mysql using

mysql -u root -p mysql

10) Grant access to user using

GRANT ALL ON *.* TO <user_name>@'%' IDENTIFIED BY '<PASSWORD>';

where

 *.* -> database_name.tables (can provide access to particular database)
‘%’ -> IP_address (provide access to particular ip)

11) You need to open TCP port 3306 using iptables or BSD pf firewall using

/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT

12) Add firewall rule on Google VM instance

Project Name -> Compute Engine -> Network -> Click on default Network

13) Add firewall Rule like

Provide any name and under Allowed protocols and ports -> tcp:3306;

13) Done 🙂

en_USEnglish
en_USEnglish