|
1 | 1 | # parse-files-utils
|
2 |
| -Utilities to list and migrate Parse files |
| 2 | +Utilities to list and migrate Parse files. |
3 | 3 |
|
4 |
| -This utility will print in the terminal all the files URL's from the parse server |
| 4 | +This utility will do the following: |
5 | 5 |
|
6 |
| -This can be really useful when you migrate your files and want to move the files from the Parse S3 host to you own. |
| 6 | +1. Get all files across all classess in a Parse database. |
| 7 | +2. Print file URLs to console OR transfer to S3, GCS, or filesystem. |
| 8 | +3. Rename files so that [Parse Server](https://github.com/ParsePlatform/parse-server) no longer detects that they are hosted by Parse. |
| 9 | +4. Update MongoDB with new file names. |
7 | 10 |
|
8 |
| -This utility won't save the files anywhere else. You can save the results to a file or pipe the results to another program: |
| 11 | +#### \*WARNING\* |
| 12 | +As soon as this script transfers files away from Parse.com hosted files (and renames them in the database) |
| 13 | +any clients that use api.parse.com will no longer be able to access the files. |
| 14 | +See the section titled "5. Files" in the [Parse Migration Guide](https://parse.com/migration) |
| 15 | +and Parse Server [issue #1582](https://github.com/ParsePlatform/parse-server/issues/1582). |
9 | 16 |
|
10 |
| -## usage |
| 17 | +## Installation |
11 | 18 |
|
12 |
| -``` |
13 |
| -$ node index.js |
14 |
| -``` |
| 19 | +1. Clone the repo: `git clone [email protected]:parse-server-modules/parse-files-utils.git` |
| 20 | +2. cd into repo: `cd parse-file-utils` |
| 21 | +3. Install dependencies: `npm install` |
| 22 | + |
| 23 | +## Usage |
15 | 24 |
|
16 |
| -you can optionally specify a json configuration file |
| 25 | +The quickest way to get started is to run `node index.js` and follow the command prompts. |
17 | 26 |
|
| 27 | +You can optionally specify a js/json configuration file (see [config.example.js](./config.example.js)). |
18 | 28 | ```
|
19 |
| -$ node index.js ./config.json |
| 29 | +$ node index.js config.js |
20 | 30 | ```
|
21 | 31 |
|
22 |
| -Example `config.json`: |
23 |
| - |
24 |
| -``` |
25 |
| -{ |
26 |
| - "applicationId": "PVpAyhBmNuouwPBNksRLPVpAyhBmNuouwPBNksRL", |
27 |
| - "masterKey": "DQzeY9lelKLPeWQH6zhsNUqnrudyOU07hjC6g53a", |
28 |
| - "serverURL": "http://parse-server.yourdomain.com/parse" |
29 |
| -} |
30 |
| -``` |
| 32 | +### Available configuration options |
| 33 | + |
| 34 | +* `applicationId`: Parse application id. |
| 35 | +* `masterKey`: Parse master key. |
| 36 | +* `mongoURL`: MongoDB connection url. |
| 37 | +* `serverURL`: The URL for the Parse server (default: http://api.parse.com/1). |
| 38 | +* `filesToTransfer`: Which files to transfer. Accepted options: `parseOnly`, `parseServerOnly`, `all`. |
| 39 | +* `renameInDatabase` (boolean): Whether or not to rename files in MongoDB. |
| 40 | +* `filesystemPath`: The path/directory to save files to when transfering to filesystem. |
| 41 | +* `aws_accessKeyId`: AWS access key id. |
| 42 | +* `aws_secretAccessKey`: AWS secret access key. |
| 43 | +* `aws_profile`: AWS credentials profile. Can be specified in lieu of `aws_accessKeyId` and `aws_secretAccessKey`. |
| 44 | +* `aws_bucket`: S3 bucket name. |
| 45 | +* `gcs_projectId`: GCS project id. |
| 46 | +* `gcs_keyFilename`: GCS key filename (ie. `credentials.json`). |
| 47 | +* `gcs_bucket`: GCS bucket name. |
| 48 | +* `asyncLimit`: The number of files to process at the same time (default: 5). |
0 commit comments