Git Product home page Git Product logo

alpine-firestore-backup's Introduction

Docker Build Status Docker Pulls Layers Version

Supported tags and respective Dockerfile links

  • latest, 268.0.0 (Dockerfile)
  • from 267.0.0 to 256.0.0 (all listed versions here)

alpine-firestore-backup

Image that performs Firestore backups based on google/cloud-sdk:alpine image.

Why this 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.

Prerequisites

Create a bucket on GCP

Create a GCP coldline bucket and save the name of your bucket.

Create a service account

Create a GCP Service account with the following rights:

  • Cloud Datastore Import Export Admin
  • Storage Admin

Prepare your env variables for Cloud Run

Please fill in the following information:

  • GCLOUD_PROJECT_ID
  • GCLOUD_BUCKET_NAME

3 ways to create your image ready to use on Cloud Run

1. Use the Cloud Run Button

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

Run on Google Cloud

2. Use a public image

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

3. Create your own image

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

3 ways to set up your Cloud Run service

Cloud Run is a serverless service to automatically serve your containers using http.

1. Use the Cloud Run Button

It will deploy it automatically.

2. Use the CLI

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\

3. Use the WebUI

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

cloud-run

Test and validate

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

Schedule it with Cloud Scheduler

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

cloud-scheduler

Monitor the backup operations

You can also check the current status of each backup operation using the following url https://alpine-firestore-backup-XXX-run.app/list

alpine-firestore-backup's People

Contributors

jlandure avatar joshuacrowley avatar frinyvonnick avatar

Stargazers

 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.