An open API service indexing awesome lists of open source software.

https://github.com/mondo-mob/spring-boot-gae

Spring Boot on Google App Engine with Datastore support
https://github.com/mondo-mob/spring-boot-gae

Last synced: 3 months ago
JSON representation

Spring Boot on Google App Engine with Datastore support

Awesome Lists containing this project

README

          

Google Cloud Datastore Backup
====================

A spring module to perform Google Cloud Datastore exports of your application data.
This uses the new Cloud Datastore Admin API rather than the original Cloud Datastore Admin console.

See: https://cloud.google.com/datastore/docs/export-import-entities

Datastore exports are long running operations. This module keeps track of operations it starts in a BackupOperation datastore entity.
After an operation is started it will queue tasks to update the status of the operation until it is complete.

NOTE: **Backups can only be performed against a real GCP project and not the App Engine Development Environment.**
In a deployed environment the module will use the Default Google Credential for your application and the project it is running in.
You can test the module locally by specifying a real project and service account credential you wish to use.

Quick start
-----

- Add backup queue config into the queues.xml file:
```

backup-queue
push
1/s

20
120
5

```

- Create a Google Cloud Storage bucket to store the datastore exports. This must be a regional bucket in the same region as your app.

- Authorise the App Engine Default Service to perform datastore exports. In Google Cloud Console IAM & Admin add the following IAM role:
`Datastore -> Cloud Datastore Import Export Admin`

- Add spring configuration to enable the module:
```
spring:
contrib:
gae:
datastore:
backup:
bucket: my-app-backup-bucket
queue: backup-queue
```

- Add cron config to schedule backup:

```

/task/backup/start?name=FullBackup
Datastore backup of all data
every day 03:00
Australia/NSW

```

Configuration
-------------

The following configuration properties can be set:

| Property | Description | Required |
| ------------- |------------- | -----------|
| bucket | the GCS bucket to export to | Y |
| queue | the queue to use for backup tasks | Y |
| project | the name of the project you wish to export | N. Defaults to the name of the active project |
| credential | path to a Google Service Account credential file (JSON format). | N. Defaults to the "App Engine default service account" |

Authorising Access
------------------

You must give the service account the correct permissions to access the Datastore Admin API.
Unless you have provided a specific service account credential this will be the "App Engine default service account"

In Google Cloud Console IAM & Admin add the following IAM role:

`Datastore -> Cloud Datastore Import Export Admin`

Scheduling
-----

Schedule backups by adding a cron task to your application.

```

/task/backup/start?name=FullBackup
Datastore backup of all data
every day 03:00
Australia/NSW

```

By default all data is exported. You can filter the backup to specific entity kinds or namespaces by providing the kinds or namespaceIds params as a comma separated list.

```

/task/backup/start?name=ConfigBackup&kinds=Config,Users,ReferenceData&namespaceIds=ABC
Datastore backup of config data
every day 03:00
Australia/NSW

```