Am I able to check Cron Jobs when App is deployed?
Locally it is: localhost:8000/cron
I was guessing maybe my-service.my-app.appspot.com/cron, but didn't work.
No. But you can check them in your admin console:
https://console.cloud.google.com/appengine/taskqueues?project=my-app&tab=CRON
As per Seraf own anser, you have to run
gcloud app deploy cron.yaml
in order to upload cron tasks, as per:
https://cloud.google.com/appengine/docs/flexible/python/scheduling-jobs-with-cron-yaml?hl=es-419#uploading_cron_jobs
Related
I'm building a custom image for App Engine Flexible with gcloud app deploy currently. I've played with using Kaniko to get caching working with gcloud builds submit for other projects, but is it possible to enable Kaniko for a build submitted with gcloud app deploy?
I've tried running gcloud config set builds/use_kaniko True, which doesn't seem to change the build behavior.
It seems like one option would be to build an image first via gcloud builds submit, then use gcloud app deploy --image-url=..., but I wasn't sure if there was a more streamlined way.
As you already said in your question, a good approach would be to first use Google Cloud Build to create your own image using your Dockerfile to then use it when deploying your application to Google App Engine.
In Google Cloud Container Builder you can run Kaniko by adding it as a build step in the build config:
steps:
- name: gcr.io/kaniko-project/executor:latest
args: ["--dockerfile=<path to Dockerfile>",
"--context=<path to build context>",
"--destination=<gcr.io/[PROJECT]/[IMAGE]:[TAG]>"]
More information can be found in these two blog posts about Google Cloud and kaniko. Post 1 & 2.
After that you can deploy your application by specifying the --image-url flag in the gcloud command:
gcloud app deploy --image-url=gcr.io/[PROJECT]/[IMAGE]:[TAG]
The problem is that I try to delete, or update the cron job and nothing gets updated on the google side.
gcloud app deploy cron.yaml - I sent an empty file with only cron: in there, and it still displays old cron jobs.
I then tried to update the cron jobs to new settings, and it still displays old information.
Either the documentation doesn't give you the correct directions how to manage cronjobs or I must be doing something extremely wrong.
Solution
Needed to specify the project to deploy to: gcloud app deploy cron.yaml --project=my-project
Needed to specify the project to deploy to: gcloud app deploy cron.yaml --project=my-project
I'm deploying an app in Google Cloud that has multiple microservices. For one of them, I wish to use a push queue. I configured my queue.yaml file as follows:
queue:
- name: equeue
rate: 10/s
retry_parameters:
task_retry_limit: 1
task_age_limit: 2d
I spin up the SDK and the queue is working fine, just as it should. But then I go to push it to my app on Google Cloud using:
gcloud app deploy --project=<projectname> --promote --stop-previous-version
The code all loads correctly, but the queue never gets created. I am getting errors from my code as follows:
API error 1 (taskqueue: UNKNOWN_QUEUE)
And when I look in the console, on https://console.cloud.google.com/appengine/taskqueues, the queue has not been created.
I've read the documentation and it seems to indicate that all I need to do is create the queue.yaml file and deploy the app (and that has worked for me in the past, albeit with an older version of the SDK.)
In case it helps, here are the components I'm running locally:
Google Cloud SDK 164.0.0
app-engine-go
app-engine-python 1.9.57
bq 2.0.24
core 2017.07.25
gcloud
gsutil 4.27
Thanks!
Dan
The queue.yaml is an app-level configuration file, not a service-specific one. See (marginally related) Why do I need to deploy a "default" app before I can deploy multiple services in GCP?
While in a single service app case deploying the default service might also update one or more of these app-level configs that is not guaranteed in a multi-service app case. Which is why each of these configs also comes with an individual dedicated method of deployment which can be performed independently of and/or without updating any of the app's services.
For queue.yaml in particular deployment can be done using gcloud app deploy:
gcloud app deploy [...] queues.yaml
or, if you're using the GAE SDK, using appcfg.py update_queues:
appcfg.py update_queues -A <app_id>
I used to deploy AppEngine apps with appcfg.py which, as far as I remember, was automatically deploying the index.yaml file as part of the app deployment.
Now that I'm using gcloud app deploy I've found out the hard way that I also have to run gcloud app deploy index.yaml to get the indices created.
Why was gcloud designed that way?
After indexes are uploaded, it can take a few minutes for them to actually build. While they build, any app that attempts to use those indexes will fail. The behavior in appcfg.py of uploading both at the same time can actually result in apps failing for a few minutes while the indexes build.
The behavior in gcloud app is more explicit to avoid these issues. If you are adding new indexes and new code that depends on it, you should use this procedure:
gcloud app deploy index.yaml
# wait for indexes to build
gcloud app deploy app.yaml
I have multiple apps with cron.yaml deploying on google appengine within same project id. But when one deploys, its over writing cron defs from other app. Both apps has its own target defined but deployment using maven is over writing cron defs. I couldn't find much info. online or google docs. Any idea how to accomplish this?
Cron is configured per project, not module. You have to merge all of this files into one, and deploy just this file.
To update just cron file, Maven have a special task:
mvn appengine:update_cron
It will upload cron.yaml for current project