0
votes

I am using Google Cloud / Google Compute to host my application. I was on Google App Engine and I am migrating my code to Google Compute in order to use a customized VM Instance.

I am using the tutorial here, and I am deploying my app using:

$ gcloud preview app deploy

I setup a custom VM Instance using the "Create Instance" option at the top of my Google Cloud Console:

Google Cloud Console

However, when I use the standard deploy gcloud command, my app is deployed to Managed VMs (managed by Google), and I have no control over those servers. I need to run the app on my custom VM because it has some custom OS-level software.

Any ideas on how to deploy the app to my custom VM Instance only? Even when I delete all the Managed VMs and try to deploy, the VMs are just re-created by Google.

2

2 Answers

2
votes

The gcloud app deploy command can only be used to deploy the app to classic AppEngine sandboxed environment or to the Managed VMs. It cannot deploy your application to an instance running on GCE.

You will need to incorporate your own deployment method/script depending on the programming language you're using. Of course, since GCE is just an infrastructure-as-a-service environment (versus AppEngine being a platform-as-a-service), you will also need to take care of high-availability (what happens when your instance becomes unavailable?), scalability (what happens when one instance is not enough to sustain the load of your application?), load balancing and many more topics you'll need to address.

Finally, If you need to install packages on your application servers you may consider taking the Managed VMs route. It manages for you all the infrastructure related matters (scalability, elasticity, monitoring etc) and still allows you to have your own custom runtime. It's still beta though...

0
votes

How to create a simple static Website and deploy it on Google cloud VM instance

Recommended: Docker and Google Cloud SDK should be installed

Step:1 Create a Folder “personal-website” with index.html and frontend files on your local computer

Step:2 Inside “personal-website” folder create a Dockerfile Write two lines

FROM httpd COPY . /usr/local/apache2/htdocs/personal-website

Step:3 Build image with docker and push it to Google cloud registry You should have google cloud sdk and project selected and docker authorized

Select Project using these commands: gcloud config set project [PROJECT_ID] gcloud config set compute/zone us-central1-b

After that Run these commands 1. export PROJECT_ID="$(gcloud config get-value project -q)" 2. docker build -t gcr.io/${PROJECT_ID}/personal-website:v1 . 3. gcloud auth configure-docker 4. docker push gcr.io/${PROJECT_ID}/personal-website:v1

Step:4 Create a VM instance with command with container running into it Run Command 1. gcloud compute instances create-with-container apache-vm2 --container-image gcr.io/test-project-220705/personal-website:v1