Visual Studio Code push to Compute Engine

198 Views Asked by At

I have Compute Engine running in Google Cloud. I want to be able to push code changes from Visual Studio Code to Compute Engine, so that the changes reflect on the website hosted in CentOS 7 on Compute Engine.

I have tried linking my GitHub to Google Source Repositories successfully, but cannot find how to implement the Source Repository as my main web folder on Compute Engine or what the process is to achieve this.

1

There are 1 best solutions below

0
On

There are several ways to implement this.

  • You can write a startup script to pull down whatever is in the CSR master branch, and run that. This would require the instance to be restarted every time changes are pushed though.

  • You can automate this by writing a couple of scripts.

    First - Script to ssh into GCE VM and run the script in the GCE VM.
    Second - Script which is in the GCE VM to pull the changes from the CSR.

  • You can automate this process using something like Cloud Build or Cloud Functions (using a pubsub triggered by changes to the CSR) .

This article explains how to achieve continuous Delivery in GCP Cloud built with Compute Engine.