How to preserve development datastore from clearing itself on reboot - google-app-engine

I need to change my local datastore path of APP Engine. I have followed methods specified here How can I persist the local datastore for GoogleAppEngineLauncher between reboots? . I tried changing datastore path but it didn't work. I am using App Engine SDK 1.6.4, Python 2.7 and NDB as datastore on Windows 7. Also I could not find default datastore location on my computer as stated in dev_appserver.py -help output (which is a temp location but I searched while application was running and datastore was serving).
My objective is to stop local datastore cleaning itself on each launch (I am using launcher).

The datastore SHOULD persist between reboots.
When you shut down, the server you should see a message "Applying all pending transactions and saving the datastore" in the console. If not, you maybe seeing the following issue (two questions, same issue, first one has a workaround)
GAE SDK 1.6.4 dev_appserver datastore flush
App Engine local datastore content does not persist

Related

Local or development Google Cloud Firestore database with App Engine

In my previous App Engine projects I used the Cloud Datastore, and during development I could debug my app on the local server and it would use a local database, stored in a file I could wipe out if I wanted to start from scratch.
With Cloud Firestore, even when I'm running locally it's talking to my real cloud database. Is there still a local option? Note that I'm not talking about client-side persistence, I'm talking about a mock development DB.
Google recommends setting up multiple projects if you want dev/staging/production, and I'm guessing that's the answer, but I'd like to know before adjusting my workflow.
I think (now only a few months later) that this is supported. When I run my app, using dev_appserver.py, I see a message
INFO 2019-02-14 00:08:56,030 admin_server.py:150] Starting admin server at: http://localhost:8000
Going to that URL shows me all the instances I have been seeing. These seem to persist even when the dev_appserver is restarted. Reading this and other posts I was convinced that my development was using my actual cloud database, but going to https://console.firebase.google.com/project/myproject was showing completely different content.
Just to be sure (because google is google and everything is named the same) I'm using an appengine app and a gcloud project, storing things to Firestore using ndb.Models...
Oh, but careful. My app I was also using the cloudstorage (blobstore?) and even though the localhost:8000 showed these, THESE WERE THE REMOTE INSTANCES.
There is a local emulator for Firestore when using the Firebase CLI:
https://firebase.google.com/docs/rules/emulator-setup

Can I build a golang command-line tool that talks to a localhost appengine datastore?

I have a standard appengine + datastore app (not flex) built in golang using these APIs:
google.golang.org/appengine
google.golang.org/appengine/datastore
I'm trying to write a command-line tool in golang to do various batch things with the datastore, such as migrating data, running consistency checks and so forth. The cli tool uses this API:
cloud.google.com/go/datastore
I can get the cli tool to talk to my hosted appengine datastore, but I can't figure out how to get it to talk to the localhost dev_appserver.py datastore. The 1st call to datastore datastoreClient.GetAll(ctx, q, nil) always hangs.
I read some of the API code, and it looks like I need to set DATASTORE_EMULATOR_HOST to point to http://localhost:some_port, but I can't get this to work w/ any of the 3 servers that are started up by dev_appserver.py (ports 8000, 8080, 53536).
Am I on the right track? I've read a lot of posts & help, but they're either too old, or talk about appengine flex and so forth.
Thanks.
You could always use the standalone Datastore emulator.
Install it:
gcloud components install cloud-datastore-emulator
Start the emulator (do this in a background shell, the command runs in the foreground):
gcloud beta emulators datastore start
And then setup the environment for your application by running:
$(gcloud beta emulators datastore env-init)
Then run your app, and it should pick up and connect to the Datastore emulator automatically.

Where are Node apps deployed using gcloud SDK?

I've deployed a Node app to Google Cloud. It works beautifully.
However, where is the app running? Where in the directory structure of my instance is it stored?
I'd also like to identify where stdout is on that process. The logging solution in the GAE console is powerful but excessive for some of the simple debugging tasks I have.
Your application runs inside a Docker container and hosted on one or more instances that AppEngine provisioned for you when you deployed your application. AppEngine is managed runtime environment and thus you are not supposed to access the instance/container directly. The internal directory structure is exactly the same as you've built it during the development process.
The stdout is redirected to Google Cloud Logging. You can filter the log by severity (debug, errors, everything etc..) to reduce the amount of data you need to read.

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.

Connecting to a datastore in GAE when developing in eclipse

I don't get something about the use of datastore in a gae app.
I can see after deploying to GAE your app would be using their datastore in the cloud. But when you are still developing the app in eclipse on your local machine, how is it talking to GAE's datastore?
A local simulation of the appengine datastore is created and used - you're not talking to the actual GAE datastore.
You can view your local datastore by going to :
http://localhost:8888/_ah/admin
while your application is running locally.
(using the correct port for your application)

Resources