Deploying simple Django application to Google App Engine taking 30 minutes - google-app-engine

I'm evaluating GAE for a new project. I'm deploying a very simple Django app to GAE Flexible and I'm finding it takes about 30 minutes to deploy. The actual build step takes just a few seconds, but it gets stuck on "Updating service [default]..." for a very long time. I'm deploying via the shell using "gcloud app deploy". This happens even after the first deploy. I don't see anything in the logs.

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.

which GCP component to use to fetch data from an API

I'm a little bit confused between gcp components, here is my use case :
daily, I need to fetch data from an external API (the API return json data), store it in GCS then load it in Bigquery, I already created the python script fetching the data and store it in GCS and i'm confused which component to use for deployment :
Cloud run : from the doc it is used for deploying services, so I think its a bad choose
Cloud function: I think it works, but it is used for even based processing (through single purpose function...)
composer :(I'll use composer to orchestrate tasks, such as preprocessing of files in GCS, load them to BQ, transfert them to an archive Bucket) through kubernetesPodOperator, create a task that trigger the script to get the data
compute engine: I don't think that its the best chose since there are better ones
app engine: also I don't think it a good idea since it is used to deploy and scale web app ...
(correcte me if i'm wrong in what I said, ) so my question is : what is the GCP component used for this kind of task
Cloud run : from the doc it is used for deploying services
app engine: also I don't think it a good idea since it is used to deploy and scale web app ...
I think you've misunderstood. Both Cloud run and Google App Engine (GAE) are serverless offerings from Google Cloud. You deploy your code to any of them and you can invoke their urls which in turn will cause your code to execute and do stuff like go fetch data from somewhere and save it somewhere.
Google App Engine has a shorter timeout than Cloud Run (can't remember if Cloud Run has time out). So, if your code will take a long time to run, you don't want to use Google App Engine (unless you make it a background task) and if you don't need a UI, then you don't need GAE.
For your specific scenario, you can deploy your code to Cloud Run and use Cloud Scheduler to schedule it to be invoked at specific times. We have that architecture running in a similar scenario (we have a task that runs once daily; it's deployed to Cloud Run; Google Scheduler invokes the endpoint, it runs and saves data to datastore linked to an App Engine App). We wrote a blog article on deploying to Cloud Run and another on securing your cloud run (based off our experience in the earlier described scenario)
GAE Timeout:
Every request to a Google App Engine (Standard) must complete within 1 - 10 minutes for automatic scaling and up to 24 hours for basic scaling (see documentation). For Google App Engine Flexible, the timeout is 60 minutes (documentation).

How do i use cron to update a file in app engine?

So I have this github repo that updates every 24 hours and I want to pull a file every 24 hours; from this repo to my Google Cloud app engine environment; is there any way I can pull that file every 24 hours using the App Engine cron?
The app is running on an app engine.
Yes, it's possible. But, you have not given us enough info to help. For instance, what language are you using?
If you have a url to a file, you can fetch that from your app. Then, you can save that file to your GCS storage bucket and access it there from your app.
You can use Cloud Build triggers based on GH commits to get the updated file and trigger the app to be deployed to GAE. If the file is updated at the exact same time everyday, you can use Cloud Scheduler to run like a cron job.

Deployment PHP App to Google App Engine took so long time

Hello I'm facing a problem today with GAE SDK which it took a lot of time to update my app, before that it was fast to upload and took minute or less than that.
Even so, I went to Google Cloud Status Dashboard to check and verify if GAE service is outage and it wasn't outage.
This is my screenshot for my console, and this is Google Cloud Status Dashboard at the same time.
Any idea?
Thanks

Start/Stop Google app engine custom runtime instances

I made a small web service using Node.js and PhantomJS, and deployed it to Google app engine using its flexible environments...
The problem is, the service is used only for half an hour each day, but the VM instances is running all time and I pay for that...
So I need to be automatically able to start the instance(s) before scheduled run time of my app, and then automatically stop them
I tried use Cron jobs to call start/stop via the API, as in here, but it failed..
Thanks for advance
We don't seem to currently expose the version stop method in the rest API:
https://cloud.google.com/appengine/docs/admin-api/
However - you can stop a version by running this command:
gcloud app versions list
gcloud app versions stop <version>
That will make sure the VMs get shut down. When you're ready to turn them back on...
gcloud app versions start <version>
Hope this helps!

Resources