How to set up and build previous image working in GCP - google-app-engine

I'm new to google cloud.
Our project has been deployed on google Cloud. We are using gcloud deploy commands to deploy any build and we are good with it.
My question is: what if my current build fails during production deployment and there's lots of users using the application.
So, how can I update the previous image/build immediately in GCP? I have tried it with pull docker and push it then submitting via "gcloud build submit" command... but it's not deploying actual specified docker image, it's deploying that folder where I'm running commands of "gcloud build submit"..
Please share your suggestions..

Your concern to not break all the users when you are deploying a broken version is legit, and you aren't alone!!
That's why a cool feature exist on App Engine (and also on Cloud Run): Traffic splitting.
To use it efficiently, you can deploy your new version in production like this:
gcloud app deploy --no-promote
Here the new version is deployed but 0% of the traffic is routed to it. Now use this command to increase the traffic, let say 1%
gcloud app services set-traffic <YOUR_SERVICE> --splits <OldVersionName>=99,<NewVersionName>=1
Monitor your application for a while, and, if there isn't error, continue to increase gradually the traffic, up to be confident and routed 100%
In case of bad version, set the traffic to 0% to the new version and now/or low impact to your users.

Related

Don't wait for "Updating service..."

I'm using Bitbucket Pipelines to deploy my project to Google App Engine via gcloud app deploy which does a great job accomplishing what I want.
gcloud app deploy takes like 6-8 extra minutes for "Updating service..." which is the time taking for them to update their backend infrastructure primarily the Load Balancer.
This is not an issue by itself except that it eats up my monthly Build Time from Bitbucket.
I would rather have the pipeline return as soon it sent off the build commands, and I'll check them myself on Google Cloud Logs server.
The question is: do we have any flag for gcloud app deploy to tell him not to wait for the "Updating service..." ?
These are all the gcloud app deploy flags. There's no such flag.
To see if there's a possible 'hack' you could use, you could try manually deploying your app yourself using gcloud app deploy --log-http. The --log-http flag will produce an output of all http requests made during the deploy. You'll see the endpoints being called, the http method, the headers, payload and the duration for each call. Examining those (especially around the 'updating' bit) might show you something that could potentially be of help.

Deploy application from Bitbucket to Google cloud app engine

I would like to know how to deploy the application from bitbucket using pipelines to multiple Google Cloud projects.
Here is our current set up and it is working fine.
On Bitbucket, the application repo with development/UAT test/production branches, once the pull request approved and merged into development/production, it shall deploy to the GCP app engine through the pipelines.
The problem now, we want to isolate each client in GCP which mean each client will have its own GCP project, cloud SQL, App engines, storage bucket, etc...
I need some advice on how to change the deployment workflow in bitbucket and pipelines, so will work for the new set up.
For the branches setup on bitbucket, I'm thinking like below, but if I go for option2, then it seems too much if got more clients.
Option 1 (repo branches)
development/
UAT test/
validation/
production
Option 2 (repo branches)
development/
UAT test client1/
UAT test client2/
validation_client1/
validation_client2/
production_client1/
production_client2/
The first step, I know I have to create different app.yaml for each app engine service for each client, so it can deploy the app engine service to different CGP projects/bucket/SQL instance.
Also just found out the bitbucket-pipelines.yml only support 10 steps, if I create so many branches then it will over the limits for sure.
Does anyone have any suggestions about how should be set up?
Thanks,
You could create Cloud build triggers to specific bitbucket branches or repos (whatever your branching model is defined) and deploy the app engine implementation to the App engine service on the same project, and if you need to customize other steps, you could use custom steps as described here. Finally you can take a look at how to create a basic configuration file for Cloud Build if you are not very familiar with this product

Error message "service cloudbuilt.googleapis.com is not for consumer..." when deploying App Engine application

My team and I are working on the Trendy Lights Tutorial.
We have set up all the files and also have converted the .p12 key to .pem key but failed to run the app on the Google Cloud Platform and constantly got the error message saying:
You do not have permission to access project [...] and service
"cloudbuilt.googleapis.com" is not for consumer..."
We have already whitelisted our service account for the use of Earth Engine. Does anyone know what the problem might be?
Thank you so much!
I see that you are attempting to deploy your application to the App Engine Flexible Environment.
The Flexible environment differs from the Standard environment in that it gives you more control over the individual instances that are running your deployed application. It does this by hosting your application within Docker on Compute Engine virtual machines.
Therefore, you will need to enable the Compute Engine API for your project so that the GCloud tool can start new Compute Engine virtual machines when you deploy your application.
Note: Since the Flexible environment uses Compute Engine resources, you will also need to enable billing for your project.
If after performing the above you still experience the 'cloudbuild.googleapis.com' error, I ask that you run gcloud components update, then ensure that the value of account seen in the output of the command gcloud info has Owner or Editor permissions in your project.
If it still persists after all of the above, you should then open a Public Issue Tracker to inform our backend team of the issue.

Git Push to Deploy stopped 'deploy source only' on all App Engine projects

Since yesterday evening the Push-to-Deploy stopped working totally. If I Push a Git commit to the master it's not been deployed anymore. At first I thought this was a problem related to the App Engine Project itself. I've deleted the Release Pipeline and wanted to recreate it. Now the Console only shows the instructions to create a Jenkins Pipeline.
See this documentation for information on how to set up Jenkins, and configure continuous deployment for your GCP apps.
After that I've manually deployed the app to see if there are any issues with my source. The GoogleAppEngineLauncher is deploying the application with no problem at all. I've tried to reproduce this in other AE projects and noticed all projects currently don't process the Git pushes into a deployment.
Are more users experiencing this?
Yea, Now you have to use Jenkins using google cloud instance. See the updated documentation on there website https://cloud.google.com/tools/repo/push-to-deploy

Google App Engine Launcher delete datastore

I am developing a web application using Google AppEngine (GAE).
I have make some examples using dataStore (free, non-relational) using Google AppEngine Launcher (GAEL). All is correct. However I'd like delete the datastore before to deploy an application.
I have read that I have to use the command
--clear_datastore
I don't know like running the server to delete the data store when I deploy or re-deploy the application.
I have chech some ways, for example I have write in the Application Settings(Edit==>Application Settings) in the GAEL some commands:
--clear_datastore
--clear_datastore /<ApplicationName>
--clear_datastore <ApplicationName>/
--clear_datastore <ApplicationName>
any idea?
Thank you.
Jose
The clear_datastore flag is only used to clear the development datastore which is running on your local machine with the dev_appserver. If you want to clear this development datastore, then when you run the dev appserver you can use the flags:
dev_appserver.sh --clear_datastore=yes <ApplicationName>
An important thing to note is that this only clears the development datastore. The development datastore does not get uploaded when you deploy the application. So you shouldn't be worried about clearing the local datastore before deploying the application.
If you want to delete entities that are already in your production server (running on App Engine), then you cannot do this from the command line using dev_appserver.sh. You can do this using the Datastore Admin tool in the AppEngine console. You can follow the instructions here to bulk delete data. An important note is that you have to enable the Datastore Admin tool first by following these instructions.

Resources