Skip to content

Commit c244b16

Browse files
Merge pull request getodk#748 from getodk/remove-google-backups
Remove Google Drive backups
2 parents 65570b5 + c4e7ae4 commit c244b16

File tree

26 files changed

+238
-787
lines changed

26 files changed

+238
-787
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ In general, we try to follow these principles in dealing with encrypted and sens
9898

9999
Here is an overview of the directory structure inside of `lib/`:
100100

101-
* `bin/` contains all the executable scripts. These include `run-server.js`, which actually starts the ODK Central Backend server, but also the `cli.js` command line administration utility, and scripts like the `backup.js` executable which runs the configured backup.
101+
* `bin/` contains all the executable scripts. These include `run-server.js`, which actually starts the ODK Central Backend server, but also the `cli.js` command line administration utility, and scripts like the `restore.js` executable which restores the database from a backup file.
102102
* `data/` files deal with Submission row data in various ways. They are very independent, callable from any context (they don't rely on any database code, for example), and so they are separated out here. The `schema.js` file contains a lot of utilities for understanding and using XForms XML schema definitions, while the other files deal with Submission row data.
103103
* `http/` defines a lot of core functionality for how we use Express, the Node.js server framework we rely on. The `endpoint.js` Endpoints are wrapper functions we use on most endpoints in our code (see `resources/`), `middleware.js` are middleware layers that catch the requests as they come in and decorate various common information onto them, and `service.js` is the glue code that actually ties together the middleware and resources to form an Express service.
104104
* `model/` is the most complex area of code; it defines all the Things (Users, Forms, etc) in the server and how they are stored and retrieved from the database. It also contains our database migrations. For a deeper understanding of the structure, please see this explanation of our [Database Design](./docs/database.md).
@@ -108,6 +108,6 @@ Here is an overview of the directory structure inside of `lib/`:
108108
* `model/container.js` is an important file; all the code in `model/frames` and `model/query` rely on dependency injection, and this package file is where they are all declared so that the server knows about them. If you are adding any `Frames`s or `query` modules, you'll need to visit this file and add a line or two at the bottom.
109109
* `outbound/` contains various utilities for templating and sending messages of various kinds: `mail.js`, for example, contains all the email messages we might send as well as the machinery to do so, and `openrosa.js` contains templates for different OpenRosa XML responses.
110110
* `resources/` is where all the HTTP API endpoints are declared; they are the REST Resources of the server (hence the name). This is, in the layers we describe above, the outermost layer. Most of our resources are wrapped in an `endpoint()` function of some sort, declared in `http/`. The `endpoint()` functions help process the final output of each endpoint, performing useful operations like resolving `Promise`s, managing output `Stream`s, and handling some errors.
111-
* `task/` contains many utility operations that we use to construct the scripts in `bin/`, like `cli.js` and the backup/restore scripts. They are native `Promise`s and can be easily composed with `.then()`, like any other `Promise`. In `task.js`, there are various helpers to help print meaningful output for these operations and log audit logs on operations. There is also a `task.withContainer()` method which helps if you need any `model`/`Instance` code in a task (see `task/account.js` for usage).
111+
* `task/` contains many utility operations that we use to construct the scripts in `bin/`, like `cli.js` and the restore script. They are native `Promise`s and can be easily composed with `.then()`, like any other `Promise`. In `task.js`, there are various helpers to help print meaningful output for these operations and log audit logs on operations. There is also a `task.withContainer()` method which helps if you need any `model`/`Instance` code in a task (see `task/account.js` for usage).
112112
* `util/` defines a large number of really tiny helper functions and data structures that are used all over the application, as well as some generic tasks like cryptography. Of note is `option.js`, which defines the `Option[T]` class we use when a return type might be empty.
113113

config/default.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
"sysadminAccount": "[email protected]"
2727
},
2828
"external": {
29-
"google": {
30-
"clientId": "660095633112-h7bhsjenhp1agd0c4v3cmqk6bccgkdu0.apps.googleusercontent.com",
31-
"clientSecret": "lzu2vK1NFqqd6Y5HiN-7ByvE"
32-
},
3329
"sentry": {},
3430
"analytics": {
3531
"url": "https://data.getodk.cloud/v1/key/eOZ7S4bzyUW!g1PF6dIXsnSqktRuewzLTpmc6ipBtRq$LDfIMTUKswCexvE0UwJ9/projects/1/submission",

docs/api.md

Lines changed: 38 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ Finally, **system information and configuration** is available via a set of spec
3232

3333
Here major and breaking changes to the API are listed by version.
3434

35+
### ODK Central v2023.1
36+
37+
**Removed**:
38+
39+
- Scheduled backups to Google Drive are no longer supported. As a result, backups are no longer configurable. It is no longer possible to get or terminate a backups configuration or to use a backups configuration to GET a Direct Backup. For more information about these changes, please see [this topic](https://forum.getodk.org/t/backups-to-google-drive-from-central-will-stop-working-after-jan-31st/38895) in the ODK Forum.
40+
3541
### ODK Central v2022.3
3642

3743
**Added**:
@@ -3770,91 +3776,7 @@ Identical to [the non-Draft version](/reference/odata-endpoints/odata-form-servi
37703776

37713777
# Group System Endpoints
37723778

3773-
There are some resources available for getting or setting system information and configuration. You can [set the Usage Reporting configuration](/reference/system-endpoints/usage-reporting-configuration) for the server, or you can [retrieve the Server Audit Logs](/reference/system-endpoints/server-audit-logs). If backups were configured using an earlier version of ODK Central, you can also [get the current configuration](/reference/system-endpoints/backups-configuration) or terminate it.
3774-
3775-
## Backups Configuration [/v1/config/backups]
3776-
3777-
Earlier versions of ODK Central allowed users to configure backups to Google Drive, but it is no longer possible to do so. If backups were configured using an earlier version of ODK Central, you can get the current configuration or terminate it. On January 31, 2023, backups to Google Drive will stop working entirely, and we will remove the endpoints to get the current configuration or terminate it. Although backups to Google Drive will stop working, it will still be possible to download a [Direct Backup](/reference/system-endpoints/direct-backup). For more information about these changes, please see [this topic](https://forum.getodk.org/t/backups-to-google-drive-from-central-will-stop-working-after-jan-31st/38895) in the ODK Forum.
3778-
3779-
The backups configuration is essentially a singleton object: there can be only one backups configuration at a time.
3780-
3781-
### Getting the current configuration [GET]
3782-
3783-
If configured, this endpoint will return the present backups configuration type. For security reasons, none of the actual internal authentication and encryption information is returned.
3784-
3785-
If no backups are configured, this endpoint will return a `404`.
3786-
3787-
+ Response 200 (application/json)
3788-
+ Body
3789-
3790-
{
3791-
"type": "google",
3792-
"setAt": "2018-01-06T00:32:52.787Z"
3793-
}
3794-
3795-
+ Response 403 (application/json)
3796-
+ Attributes (Error 403)
3797-
3798-
+ Response 404 (application/json)
3799-
+ Attributes (Error 404)
3800-
3801-
### Terminating the current configuration [DELETE]
3802-
3803-
Deleting the backups configuration will permanently remove it, stopping it from running as scheduled.
3804-
3805-
+ Response 200 (application/json)
3806-
+ Attributes (Success)
3807-
3808-
+ Response 403 (application/json)
3809-
+ Attributes (Error 403)
3810-
3811-
## Direct Backup [/v1/backup]
3812-
3813-
_(introduced: version 1.1)_
3814-
3815-
ODK Central offers HTTP endpoints that will immediately perform a backup on the system database and send that encrypted backup as the response. You can `POST` with an encryption passphrase. If backups to Google Drive were [configured](/reference/system-endpoints/backups-configuration) using an earlier version of ODK Central, you can also `GET` to use the passphrase you configured then.
3816-
3817-
Note that performing the backup takes a great deal of time, during which the request will be held open. Both of these endpoints trickle junk data every five seconds while that processing is occurring to prevent the request from timing out. Depending on how much data you have, it can take many minutes for the data stream to speed up to a full transfer rate.
3818-
3819-
### Using an Ad-Hoc Passphrase [POST]
3820-
3821-
A `POST` verb will start an direct download ad-hoc backup. You will want to supply a `passphrase` with your chosen encryption passphrase. It is possible to omit this, in which case the backup will still be encrypted, but it will decrypt given an empty passphrase.
3822-
3823-
Please see the section notes above about the long-running nature of this endpoint.
3824-
3825-
+ Request (application/json)
3826-
+ Attributes
3827-
+ passphrase: `my-password` (string, optional) - The passphrase with which to encrypt the backup.
3828-
3829-
+ Response 200
3830-
+ Headers
3831-
3832-
Content-Disposition: attachment; filename=central-backup-2020-01-01T00:00:00.000Z.zip
3833-
3834-
+ Body
3835-
3836-
(binary data)
3837-
3838-
+ Response 403 (application/json)
3839-
+ Attributes (Error 403)
3840-
3841-
### Using the Configured Scheduled Backups Passphrase [GET]
3842-
3843-
A `GET` verb will start an direct download backup, but using the configured scheduled backups passphrase. If no scheduled backup has been configured, the endpoint will return not found.
3844-
3845-
Please see the section notes above about the long-running nature of this endpoint.
3846-
3847-
+ Response 200
3848-
+ Headers
3849-
3850-
Content-Disposition: attachment; filename=central-backup-2020-01-01T00:00:00.000Z.zip
3851-
3852-
+ Body
3853-
3854-
(binary data)
3855-
3856-
+ Response 403 (application/json)
3857-
+ Attributes (Error 403)
3779+
There are some resources available for getting or setting system information and configuration. You can set the [Usage Reporting configuration](/reference/system-endpoints/usage-reporting-configuration) for the server, retrieve the [Server Audit Logs](/reference/system-endpoints/server-audit-logs), or perform a [Direct Backup](/reference/system-endpoints/direct-backup).
38583780

38593781
## Usage Reporting Configuration [/v1/config/analytics]
38603782

@@ -3991,8 +3913,8 @@ Server Audit Logs entries are created for the following `action`s:
39913913
* `entity.create` when an Entity is created.
39923914
* `entity.create.error` when there is an error during entity creation process.
39933915
* `config.set` when a system configuration is set.
3994-
* `backup` when a backup operation is attempted.
39953916
* `analytics` when a Usage Report is attempted.
3917+
* Deprecated: `backup` when a backup operation is attempted for Google Drive backups.
39963918

39973919
### Getting Audit Log Entries [GET /v1/audits{?action,start,end,limit,offset}]
39983920

@@ -4025,6 +3947,36 @@ This endpoint supports retrieving extended metadata; provide a header `X-Extende
40253947
+ Response 403 (application/json)
40263948
+ Attributes (Error 403)
40273949

3950+
## Direct Backup [/v1/backup]
3951+
3952+
_(introduced: version 1.1)_
3953+
3954+
ODK Central offers an HTTP endpoint that will immediately perform a backup on the system database and send that encrypted backup as the response. To use it, `POST` with an encryption passphrase.
3955+
3956+
Note that performing the backup takes a great deal of time, during which the request will be held open. As a result, the endpoint will trickle junk data every five seconds while that processing is occurring to prevent the request from timing out. Depending on how much data you have, it can take many minutes for the data stream to speed up to a full transfer rate.
3957+
3958+
### Using an Encryption Passphrase [POST]
3959+
3960+
Use the `POST` verb to start a direct download ad-hoc backup. You will want to supply a `passphrase` with your chosen encryption passphrase. It is possible to omit this, in which case the backup will still be encrypted, but it will decrypt given an empty passphrase.
3961+
3962+
Please see the section notes above about the long-running nature of this endpoint.
3963+
3964+
+ Request (application/json)
3965+
+ Attributes
3966+
+ passphrase: `my-password` (string, optional) - The passphrase with which to encrypt the backup.
3967+
3968+
+ Response 200
3969+
+ Headers
3970+
3971+
Content-Disposition: attachment; filename=central-backup-2020-01-01T00:00:00.000Z.zip
3972+
3973+
+ Body
3974+
3975+
(binary data)
3976+
3977+
+ Response 403 (application/json)
3978+
+ Attributes (Error 403)
3979+
40283980
# Group Encryption
40293981

40303982
ODK Central supports two types of encryption:

lib/bin/backup.js

Lines changed: 0 additions & 52 deletions
This file was deleted.

lib/bin/restore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// including this file, may be copied, modified, propagated, or distributed
88
// except according to the terms contained in the LICENSE file.
99
//
10-
// This script, given a path to a backup archive created by backup.js, will
10+
// This script, given a path to a backup archive returned by /v1/backup, will
1111
// attempt to wipe the configured database and restore it from the archive.
1212

1313
const { run } = require('../task/task');

lib/bin/run-server.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ const env = config.get('default.env');
2828
const { mailer } = require('../external/mail');
2929
const mail = mailer(mergeRight(config.get('default.email'), { env }));
3030

31-
// get a google client.
32-
const googler = require('../external/google');
33-
const google = googler(config.get('default.external.google'));
34-
3531
// get a sentry and configure errors.
3632
const Sentry = require('../external/sentry').init(config.get('default.external.sentry'));
3733
Error.stackTrackLimit = 20;
@@ -49,7 +45,7 @@ const enketo = require('../external/enketo').init(config.get('default.enketo'));
4945

5046
// initialize our container, then generate an http service out of it.
5147
const container = require('../model/container')
52-
.withDefaults({ db, mail, env, google, Sentry, bcrypt, xlsform, enketo });
48+
.withDefaults({ db, mail, env, Sentry, bcrypt, xlsform, enketo });
5349
const service = require('../http/service')(container);
5450

5551
// insert the graceful exit middleware.

lib/external/google.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

lib/formats/mail.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ const messages = {
4545
accountResetDeleted: message('ODK Central account password reset', '<html>Hello!<p>A password reset has been requested for this email address, but the account has been deleted.</p><p>If this message is unexpected, simply ignore it. Otherwise, please double check the email address given for your account, and try contacting your ODK system administrator.</p></html>'),
4646

4747
// Notifies a user that their password has been changed
48-
accountPasswordChanged: message('ODK Central account password change', '<html>Hello!<p>We are emailing because you have an ODK Central data collection account, and somebody has just changed its password.</p><p>If this was you, please feel free to ignore this email.</p><p>Otherwise, please contact your local ODK system administrator immediately.</p></html>'),
49-
50-
backupFailed: message('ODK Central backup failed', '<html>Hello:<p>This is an automated system message to the listed ODK Central system administrator. ODK Central just attempted to perform a backup, but was unable to. Please visit <a href="{{{domain}}}/#/system/backups">the Backups settings page</a> on the administration website for more information.</p></html>')
48+
accountPasswordChanged: message('ODK Central account password change', '<html>Hello!<p>We are emailing because you have an ODK Central data collection account, and somebody has just changed its password.</p><p>If this was you, please feel free to ignore this email.</p><p>Otherwise, please contact your local ODK system administrator immediately.</p></html>')
5149
};
5250

5351
module.exports = { messages };

lib/model/frames/config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// including this file, may be copied, modified, propagated, or distributed
88
// except according to the terms contained in the LICENSE file.
99

10-
const { always, identity, pick } = require('ramda');
10+
const { identity } = require('ramda');
1111
const { Frame, table, readable, species } = require('../frame');
1212

1313
/* eslint-disable no-multi-spaces */
@@ -60,8 +60,6 @@ defineConfig('analytics', identity, (value) => {
6060
}
6161
return result;
6262
});
63-
defineConfig('backups.main', pick(['type']));
64-
defineConfig('backups.google', always('New or refreshed Google API credentials'));
6563

6664

6765
module.exports = { Config };

0 commit comments

Comments
 (0)