latest
,268.0.0
(Dockerfile)- from
267.0.0
to256.0.0
(all listed versions here)
Image that performs Firestore backups based on google/cloud-sdk:alpine
image.
We use a lot of Firebase features like Firestore. But there is no simple way to backup the data.
This image aims to be used inside the Google Cloud Platform to perform backups automatically.
See this article for more information.
Create a GCP coldline bucket and save the name of your bucket.
Create a GCP Service account with the following rights:
Cloud Datastore Import Export Admin
Storage Admin
Please fill in the following information:
GCLOUD_PROJECT_ID
GCLOUD_BUCKET_NAME
Please give a feedback on this new way to deploy it โจ
For this deployment, the new service account can't be used. Simply grant the default (<project_id>[email protected]) service account with the required roles
You can use the public gcr
image available on gcr.io/zenika-hub/alpine-firestore-backup
We publish the image in the 4 container registries to be available in the closest region:
- Global:
gcr.io/zenika-hub/alpine-firestore-backup
- Europe:
eu.gcr.io/zenika-hub/alpine-firestore-backup
- Asia:
asia.io/zenika-hub/alpine-firestore-backup
- US:
us.io/zenika-hub/alpine-firestore-backup
You can also create your own image from the repository to be independant. But you have to maintain the update of your image by yourself.
To do this, clone this repository:
git clone https://github.com/zenika/alpine-firestore-backup.git
Build:
docker image build -t gcr.io/[GCLOUD_PROJECT_ID]/alpine-firestore-backup
Push using Container Registry Authentication:
gcloud auth configure-docker
docker push gcr.io/[GCLOUD_PROJECT_ID]/alpine-firestore-backup
Cloud Run is a serverless service to automatically serve your containers using http.
It will deploy it automatically.
If you're fan of CLI, please use the following command to create your Cloud Run
service:
gcloud beta run deploy alpine-firestore-backup\
--project=my-awesome-project\
--platform=managed\
--region=europe-west1\
--image=zenika-hub/alpine-firestore-backup\
--memory=256Mi\
--allow-unauthenticated\
--set-env-vars GCLOUD_PROJECT_ID=VALUE,GCLOUD_BUCKET_NAME=VALUE\
--service-account=my-service-account@my-awesome-project.iam.gserviceaccount.com
Check the deployment using the following command:
gcloud beta run services list\
--project my-awesome-project\
--platform managed\
--region=europe-west1\
In the WebUI console, create a Cloud Run service
using the public image gcr.io/zenika-hub/alpine-firestore-backup
or your own image gcr.io/[GCLOUD_PROJECT_ID]/alpine-firestore-backup
.
Be careful to:
- Choose your newly image in
latest
- Choose "Cloud Run (fully managed)" and a location
- Enter a service name
- Select "Allow unauthenticated invocations"
- In the "Show optional settings / Environment variables", set the 3 environment variables seen in the previous section
- In the "Service account" part, select your previously created service account
You can test the service using your browser: https://alpine-firestore-backup-XXX-run.app/
Save the url created to call your Cloud Run Service.
For example: https://alpine-firestore-backup-XXX-run.app/backup
Cloud Scheduler allow you to schedule a cronjob in order to call a https endpoint at regular intervals.
Prepare a Cloud Scheduler
to send a request to your Cloud Run Service
every time you need.
For example, every Monday at 3:00am 0 3 * * 1
You can also check the current status of each backup operation using the following url https://alpine-firestore-backup-XXX-run.app/list