Monday, 29 May 2017

Good practice to initialize a database on Google App Engine

So I'm moving my application to the cloud. Google App Engine to be precise. Before on my own VPS I have a Dockerfile fix the entire build.

I want to get away from this and let Google handle this as DevOps is taking up too much time. I'd rather focus on business logic.

So here is what I used to do:

  • Do stuff locally
  • Push to specific branch on GitLab
  • Gitlab would build a docker container, test it and deploy to my server

Now in the process of building the container the following is called.

npm install --production
npm run task:pop
npm run start

Google App Engine fixes npm install and npm start. npm run task:pop in my case populates the database initially. This is only required once. Unless I push new code then I want it to rerun. npm run task:pop drops every collection and then populates new ones.

Are there any best practices to how one would drop the database and then populate it via npm run task:pop when deploying to Google App Engine without having to create a custom runtime container (stated here https://cloud.google.com/appengine/docs/flexible/custom-runtimes/)



via Karl Morrison

No comments:

Post a Comment