Firebase Functions - Post Deploy Hooks?

164 views
Skip to first unread message

Phil Hodey

unread,
Jul 5, 2017, 7:24:44 AM7/5/17
to Firebase Google Group
Hi,

I've started using Firebase functions extensively for a number of apps we manage. Historically we used nodejs containers to achieve a similar outcome but the native functions are a big win for us.

I have one question though and wondered if anybody had come up with the best design pattern for this particular use case....

We use functions to watch certain references and when a change is detected it creates a number of pseudo indexes for certain views we want to be able to display to the user without them having to download the entire dataset, it also performs a number of transforms for aggregate views of data. We have found this to be a great way to structure our data, as the source data is updated, the functions can then be used to crunch the data into any shape required for user views.

Occasionally, we may wish to alter the structure of one of the indexes, which requires the entire dataset to be re-indexed. Therein lies my question, is there a recognised way to force a function to run across an entire dataset instead of waiting for the next change?

At present, we have resorted to exposing an http endpoint that post deployment our release scripts call to force an update of all records. But I wondered if there was a more efficient or acceptable way to achieve the same result, maybe some type of post deploy hook?

Any thoughts about current approach and potential alternatives would be welcomed!

Doug Stevenson

unread,
Jul 5, 2017, 5:35:15 PM7/5/17
to Firebase Google Group
Phil,

Given the way Cloud Functions currently works, I would have done the same thing - write an HTTP function and invoke it after the deploy completes.

You could probably make a case to add support for a special function that gets run in an allocated container immediately after deploy.  That would be best expressed as a feature request.  Bear in mind, though, that there are many shades of deployment, and it might be difficult to figure out which one(s) are not eligible for a hook.

Doug

Phil Hodey

unread,
Jul 6, 2017, 1:08:41 AM7/6/17
to Firebase Google Group
Cheers Doug, pleased you agree, just wanted to make sure I wasn't missing a trick.
Reply all
Reply to author
Forward
0 new messages