Python telegram bot persistence with google app engine - google-app-engine

I am deploying a Telegram BOT using Python Telegram Bot library on Google App Engine flexible environment and have enabled bot and conversation persistence on this.
The challenge I am facing is, if I update the app and deploy again the conversation has to be restarted since I am unable to copy the persistence file from the previous version of the app.
How do I ensure that the same persistence files are used whenever I deploy a new version of the APP?
Any help is appreciated.
Thank you

If you are writing to the /tmp directory or storing that file inside App Engine's file system, that is expected to happen.
The docs for the standard environment explain this as well, and when you're doing a new deploy the instance you were using gets deleted and then you lose your persistence file with the logs of the chat.
You should consider moving the file to Cloud Storage or using any other storage system to save the changes and upload/downlaod the file on a regular basis in order to avoid that.

Related

Any way to update/change deployed source code online via Google Cloud?

I have deployed source code via gcloud command line with no issue. However, I am currently away from my desktop and see a critical change to my app.yaml file that I would like to make.
Is this possible to do via my Google Cloud account?
You can use the App Engine Admin API to patch the specific version of your service and update the instance type since your app is using App Engine Standard. You can use the "Try this API" feature to update it right from your browser.

Why does writing to GCS bucket result in local dev blob store entries instead?

I use the Google App Engine Standard environment to develop my Python app using Development SDK 1.9.61.
I'm trying to learn to use Google Cloud Storage in my app by following these instructions. I verified that my default and staging buckets do exist via the cloud console, and manually uploaded a sample file to each bucket using my browser.
Next, I programmatically uploaded some files to a bucket (so I thought) via my local development app instance per Google's instructions.
However, when I checked my cloud storage buckets via my GCP Console in my browser, I could not find the files. After searching my local development SDK console, I eventually found the files located in the local "Blobstore Viewer".
I'm confused, based on Google's instructions I expected to find the files in my project's cloud storage bucket.
I searched the App Engine Python Release Notes for some potential SDK version changes to explain this behavior, but couldn't find anything relevant.
Is this the way it's supposed to work? Are Google's instructions in error?
If you upload files to a local development server, those exist in-memory on your machine. The GCP Console doesn't interact with your local development server, it interacts with the public (production) Google Cloud Storage API.
So in essence, the files on your local dev server are in a completely different namespace. If you want to interact with the production version of Google Cloud Storage and see the results in the GCP console, you'll need to use a non-dev-server deployment of your application.

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.

Firebase made local datastore inaccessable when added to a Golang app

I want to use Firebase Auth UI with a Google AppEngine app written in Go. I installed Firebase and used the Firebase console to add my app. It appears that Firebase took control of the local dev. datastore file (something keeps making the directory it's in read only so Python can't open it when I issue a new data_path instruction).
If I delete the Firebase app, a warning message indicates: "You lose access to your entire project, including your project's apps"
Does this mean that the resources of my original GAE Go app will be deleted too?
For now I just want to restore my Golang datastore connectivity in my development environment - is it safe to delete this Firebase project? Should I remove the Firebase tools ?
thanks!

Transferring large files from S3 to Google Cloud Storage in App Engine

I'm using boto in an App Engine backend instance to get the file and the GAE Storage APIs to store it. I raised the default fetch deadline.
However for files that go over the 32M limit, there's a problem and ResumableDownloadHandler doesn't help there because the GCS file handle has an incompatible interface.
Can anyone suggest an existing solution that would be resumable and not require a file-system?
This is a known problem, which we're working on. In the meantime you can use the Google Python client library as an alternative to the Files API.

Resources