This article will help provide some easy to apply recipes to back up your Firebase project, in a single Github Action workflow.
To implement this workflow you will be needing
We will be making a snapshot backup that is being replaced for each run and another accumulative one that is adding every new backup into an historical archive.
Make sure that your GCP project has a “backups bucket”. It should be listed in your Google Cloud Platform Console, but not in the Firebase console…
In a couple of minutes from now, you will have a Github Action workflow that does all the heavy lifting of publishing your dart package or Flutter plugin to pub.dev for you.
Let’s get started.
First you need to get and setup your credentials for publishing the package. Make sure that you publish your first version manually from the command line so that your package gets listed and you become the owner of that listing.
After that, find your credentials.json file either in ~/.pub-cache or ~/<your flutter root>/.pub-cache/
$ cat ~/.pub-cache/credentials.json
{
“accessToken”:”<access-token>”,
”refreshToken”:”<refresh-token>”,
”tokenEndpoint”:”https://accounts.google.com/o/oauth2/token",
"scopes":["openid","https://www.googleapis.com/auth/userinfo.email"],
"expiration":1570721159347
}
Imagine that you’re having a game where thousands of players are producing inputs to the game state simultaneously. Let’s say we’re counting votes on five popular contestants. We want to be able to easily present a real time score-board without being concerned about scaling issues.
If you have been working with Firebase before, you might have found yourself creating a “user” object to complement the information that we retrieve from Firebase authentication. If you are new to Firebase, you are likely to find this article useful in a very near future.
You will need to install the crypto-js
NPM package dependency for your cloud functions. We'll be using the MD5 hash function for fetching gravatar images.
~/awesomeproject $ cd functions
~/awesomeproject/functions $ npm i --save crypto-js
Before you go any further, you need to know that your project must be on a “non-free price plan”…
You can leverage integration with Google App Engine, which has a very easy to manage task scheduler and Python is a good choice of language since it’s easy to write very compact yet powerful applications.
In this example we’ll be sending push notifications from Google App Engine’s scheduler to a HTTPS Cloud Function endpoint. And, oh… did I mention that we’ll accomplish this in less than 40 lines of code, including configuration files!!!
Tik tok let’s go
Make sure that you know the basics behind Google App Engine and how…
This is the opening line for a concept called “distributed counters” in the Cloud Firestore documentation, which goes on to explain a fairly complicated random distribution of shard counters to reduce the probability of collisions upon document write. But “reduce the probability” are the words to pay attention to.
So, what’s the problem here? What happens if you ignore the warnings and decide to try your luck?
This example will use Firebase cloud functions to simulate aggressively simultaneous actors to our highly popular (and also fictive) movie review application.
First we’ll make a naive example of just boldly going…
Let me just head you in the right direction first, to watch David East’s awesome video on how to serve an Express app with cloud functions… and actually, that can be the end of the story. You can stop reading after watching that if you want. But in the article that follows below the video, I’ll showcase a real example on how I took a Node/Express app and ported it to Firebase with minimal configuration changes (and no changes at all to the actual app).
As anyone who has studied at university, you know that you should start with…
This is one of those sequels that actually outdo the original piece, similarly to The Empire Strikes Back, Godfather II and Dawn of the living dead. But please read the original article for context and foundation.
As we looked at how to set up automatic Android builds and unit testing with Gitlab CI in the mentioned article above, this article will be explaining how we at Oddbit are running automated tests with Firebase Test Lab and continuous integration.
Unless you didn’t already know it, Firebase allows you to run automated robo-tests or instrumented tests of your APK on physical devices…
At the end of the article, you will find a complete Gitlab CI configuration script that is ready to be used, straight out of the box.
Gitlab is definitely not getting a proportional amount of credits that they deserve. At least not in my circles and part of the world. But I do my fair share of praising whenever I get the chance.
GitHub is great for the open source community. But Gitlab is a one-stop-shop solution for a developer team like ours. …
By following the example in this article you will be using Slack slash-commands and incoming webhook to implement a simple game that we can call ping pong (not to be confused with the sport that incidentally has the same name).
Each of these sections can be studied separately if you are already familiar with one or more of the others.
If you’re not planning to distribute your app, then the OAuth section is optional. And the complete code for this project is available on Github
You will need to…
Google Developer Expert for Firebase, nerd and passionate problem solver | Founder of Kumpul coworking space in Bali