You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Postgres with your Parse app, you need to manage your indexes yourself.
38
+
37
39
Details about the configuration options can be found on [pg-promise](https://github.com/vitaly-t/pg-promise/wiki/Connection-Syntax). Some useful combinations are below:
38
40
39
41
* SSL with verification - `postgres://localhost:5432/db?ca=/path/to/file`
40
42
* SSL with no verification - `postgres://localhost:5432/db?ssl=true&rejectUnauthorized=false`
41
43
42
44
### Caveats
43
45
46
+
* You will need to configure a [file adapter](#configuring-file-adapters) in order to store files.
44
47
* Join tables are resolved in memory, there is no performance improvements using Postgres over MongoDB for relations or pointers.
45
48
* Mutating the schema implies running ALTER TABLE, therefore we recommend you setup your schema when your tables are not full.
46
-
* Properly index your tables to maximize the performance.
47
49
* The postgres URL for 4.2.0 and below only supports the following configuration options:
Copy file name to clipboardExpand all lines: _includes/parse-server/file-adapters.md
+36-40
Original file line number
Diff line number
Diff line change
@@ -17,15 +17,13 @@ When using `Postgres`, you will need to configure `S3Adapter`, `GCSAdapter`, or
17
17
18
18
If you are using `Mongo` and don't need file encryption, there are no additional steps needed to use the `GridStoreAdapter`. If you'd like to enable file encryption follow these instructions to configure Parse Server to use `GridStoreAdapter` with file encryption.
19
19
20
-
***Notice: If you are coming from an older version of Parse Server versions <= 4.2.0, you should remove `fileKey` from your configurations as it is not being used anyways since legacy parse.com. `fileKey` has been repurposed for file encryption.***
21
-
22
-
### Set up file encryption (available in parse-server 4.3.0+)
23
-
The `GridStoreAdapter` can encrypt files at rest in `Mongo` using AES256-GCM, allowing the adapter to detect if files are tampered with.
20
+
### Set up file encryption
21
+
File encryption is available in parse-server 4.4.0+. The `GridStoreAdapter` can encrypt files at rest in `Mongo` using AES256-GCM, allowing the adapter to detect if files are tampered with.
24
22
25
23
To use, simply do any of the following:
26
-
- Use the environment variable `PARSE_SERVER_FILE_KEY`
27
-
- Pass in --fileKey in the command line when starting your server
28
-
- Initialize ParseServer with `fileKey="Your file encryptionKey"`.
24
+
- Use the environment variable `PARSE_SERVER_ENCRYPTION_KEY`
25
+
- Pass in --encryptionKey in the command line when starting your server
26
+
- Initialize ParseServer with `encryptionKey="Your file encryptionKey"`.
29
27
30
28
An example starting your Parse Server in `index.js` is below:
fileKey:process.env.PARSE_SERVER_FILE_KEY, //Add your file key here. Keep it secret
36
+
encryptionKey:process.env.PARSE_SERVER_ENCRYPTION_KEY, //Add your file key here. Keep it secret
39
37
...
40
38
});
41
39
```
42
40
43
41
Be sure not to lose your key or change it after encrypting files.
44
42
45
-
### Enabling encryption on a server that already has unencrypted files (available in parse-server 4.4.0+)
43
+
### Enabling encryption on a server that already has unencrypted files
46
44
When this is the case, it is recommended to start up a development parse-server (or a separate process from your main process) that has the same configuration as your production server. On the development server, initialize the file adapter as above with the new key and do the following after initialization in your `index.js`:
47
45
48
46
```javascript
49
47
//You probably want to back up your unencrypted files before doing this.
50
48
//This can take awhile depending on how many files and how large they are. It will attempt to rotate the key of all files in your filesSubDirectory
console.log('Files rotated to newKey: '+ rotated);
53
51
console.log('Files that couldn't be rotated to newKey:' + notRotated);
54
52
```
55
53
56
-
### Rotating your encryption key (available in parse-server 4.4.0+)
57
-
Periodically you may want to rotate your fileKey for security reasons. When this is the case, it is recommended to start up a development parse-server (or a separate process from your main process) that has the same configuration as your production server. On the development server, initialize the file adapter with the new key and do the following in your `index.js` (you will need your `oldKey`):
54
+
### Rotating your encryption key
55
+
Periodically you may want to rotate your encryptionKey for security reasons. When this is the case, it is recommended to start up a development parse-server (or a separate process from your main process) that has the same configuration as your production server. On the development server, initialize the file adapter with the new key and do the following in your `index.js` (you will need your `oldKey`):
58
56
59
57
```javascript
60
58
//This can take awhile depending on how many files and how large they are. It will attempt to rotate the key of all files in your filesSubDirectory
console.log('Files rotated to newKey:' + rotated);
63
61
console.log('Files that couldn't be rotated to newKey: '+ notRotated);
64
62
```
65
63
66
-
### Removing file encryption (available in parse-server 4.4.0+)
67
-
When this is the case, it is recommended to start up a development parse-server (or a separate process from your main process) that has the same configuration as your production server. Different from the previous examples, don't initialize your fileAdapter with a `fileKey`. Pass in your `oldKey` to `rotateFileKey()`.
64
+
### Removing file encryption
65
+
When this is the case, it is recommended to start up a development parse-server (or a separate process from your main process) that has the same configuration as your production server. Different from the previous examples, don't initialize your fileAdapter with a `encryptionKey`. Pass in your `oldKey` to `rotateEncryptionKey()`.
console.log('Files rotated to unencrypted with noKey: '+ rotated);
83
81
console.log('Files that couldn't be rotated to unencrypted with noKey:' + notRotated);
84
82
85
83
```
86
84
87
85
### Rotating the key for a subset of files
88
-
This is useful if for some reason there were errors and some of the files weren't rotated and returned in`notRotated`. Theprocess is the same as the previous examples, but pass in your `oldKey` along with the array of`fileNames` to `rotateFileKey()`.
86
+
This is useful if for some reason there were errors and some of the files weren't rotated and returned in`notRotated`. Theprocess is the same as the previous examples, but pass in your `oldKey` along with the array of`fileNames` to `rotateEncryptionKey()`.
89
87
90
88
```javascript
91
89
//This can take awhile depending on how many files and how large they are. It will attempt to rotate the key of all files in your filesSubDirectory
console.log('Files rotated to newKey: ' + rotated);
94
92
console.log('Files that couldn't be rotated to newKey: ' + notRotated);
95
93
```
@@ -308,13 +306,13 @@ new GCSAdapter(projectId, keyfilePath, bucket, options)
308
306
309
307
## Configuring `FSAdapter`
310
308
311
-
To use the `FSAdapter`, simply initialize your Parse Server in `index.js` by doing the following:
309
+
To use the [FSAdapter](https://github.com/parse-community/parse-server-fs-adapter), simply initialize your Parse Server in `index.js` by doing the following:
312
310
313
311
```javascript
314
312
var FSFilesAdapter =require('@parse/fs-files-adapter');
315
313
316
314
var fsAdapter =newFSFilesAdapter({
317
-
"filesSubDirectory":"my/files/folder"// optional
315
+
"filesSubDirectory":"my/files/folder"// optional, defaults to ./files
318
316
});
319
317
320
318
var api =newParseServer({
@@ -324,22 +322,20 @@ var api = new ParseServer({
324
322
})
325
323
```
326
324
327
-
***Notice: If used with Parse Server versions <= 4.2.0, DO NOT PASS in `PARSE_SERVER_FILE_KEY` or `fileKey` from parse-server. Instead pass your key directly to `FSFilesAdapter` using your own environment variable or hardcoding the string. Parse Server versions 4.3.0+ can pass in `PARSE_SERVER_FILE_KEY` or `fileKey`.***
328
-
329
325
### Using `FSAdapter` with multiple instances of Parse Server
330
-
When using parse-server-fs-adapter across multiple Parse Server instances it's important to establish "centralization" of your file storage (this is the same premise as the other file adapters, you are sending/recieving files through a dedicated link). You can accomplish this at the file storage level by Samba mounting (or any other type of mounting) your storage to each of your parse-server instances, e.g if you are using Parse Server via docker (volume mount your SMB drive to `- /Volumes/SMB-Drive/MyParseApp1/files:/parse-server/files`). All Parse Server instances need to be able to read/write to the same storage in order for parse-server-fs-adapter to work properly with parse-server. If the file storage isn't centralized, parse-server will have trouble locating files and you will get random behavior on client-side.
326
+
When using [parse-server-fs-adapter](https://github.com/parse-community/parse-server-fs-adapter) across multiple Parse Server instances it's important to establish "centralization" of your file storage (this is the same premise as the other file adapters, you are sending/recieving files through a dedicated link). You can accomplish this at the file storage level by Samba mounting (or any other type of mounting) your storage to each of your parse-server instances, e.g if you are using Parse Server via docker (volume mount your SMB drive to `- /Volumes/SMB-Drive/MyParseApp1/files:/parse-server/files`). All Parse Server instances need to be able to read/write to the same storage in order for parse-server-fs-adapter to work properly with parse-server. If the file storage isn't centralized, parse-server will have trouble locating files and you will get random behavior on client-side.
331
327
332
-
### Set up file encryption (available in parse-server-fs-adapter 1.1.0+)
333
-
The `FSAdapter` can encrypt files at rest for local storage using AES256-GCM, allowing the adapter to detect if files are tampered with.
328
+
### Set up file encryption
329
+
File encryption is available in parse-server-fs-adapter 1.1.0+. The `FSAdapter` can encrypt files at rest for local storage using AES256-GCM, allowing the adapter to detect if files are tampered with.
334
330
335
-
To use, simply do the same as above, but add a `fileKey`:
331
+
To use, simply do the same as above, but add a `encryptionKey`:
336
332
337
333
```javascript
338
334
var FSFilesAdapter =require('@parse/fs-files-adapter');
"fileKey":"someKey"//mandatory if you want to encrypt files
337
+
"filesSubDirectory":"my/files/folder", // optional, defaults to ./files
338
+
"encryptionKey":"someKey"//mandatory if you want to encrypt files
343
339
});
344
340
345
341
var api =newParseServer({
@@ -351,54 +347,54 @@ var api = new ParseServer({
351
347
352
348
Be sure not to lose your key or change it after encrypting files.
353
349
354
-
### Enabling encryption on a server that already has unencrypted files (available in parse-server-fs-adapter 1.1.0+)
350
+
### Enabling encryption on a server that already has unencrypted files
355
351
When this is the case, it is recommended to start up a development parse-server (or a separate process from your main process) that has the same configuration as your production server. On the development server, initialize the file adapter as above with the new key and do the following after initialization in your `index.js`:
356
352
357
353
```javascript
358
354
//You probably want to back up your unencrypted files before doing this.
359
355
//This can take awhile depending on how many files and how large they are. It will attempt to rotate the key of all files in your filesSubDirectory
console.log('Files rotated to newKey: '+ rotated);
362
358
console.log('Files that couldn't be rotated to newKey:' + notRotated);
363
359
```
364
360
365
-
### Rotating your encryption key (available in parse-server-fs-adapter 1.1.0+)
366
-
Periodically you may want to rotate your `fileKey` for security reasons. When this is the case, it is recommended to start up a development parse-server (or a separate process from your main process) that has the same configuration as your production server. On the development server, initialize the file adapter with the new key and do the following in your `index.js` (you will need your `oldKey`):
361
+
### Rotating your encryption key
362
+
Periodically you may want to rotate your `encryptionKey` for security reasons. When this is the case, it is recommended to start up a development parse-server (or a separate process from your main process) that has the same configuration as your production server. On the development server, initialize the file adapter with the new key and do the following in your `index.js` (you will need your `oldKey`):
367
363
368
364
```javascript
369
365
//This can take awhile depending on how many files and how large they are. It will attempt to rotate the key of all files in your filesSubDirectory
console.log('Files rotated to newKey:' + rotated);
372
368
console.log('Files that couldn't be rotated to newKey: '+ notRotated);
373
369
```
374
370
375
-
### Removing file encryption (available in parse-server-fs-adapter 1.1.0+)
376
-
When this is the case, it is recommended to start up a development parse-server (or a separate process from your main process) that has the same configuration as your production server. Different from the previous examples, don't initialize your fileAdapter with a `fileKey`. Pass in your `oldKey` to `rotateFileKey()`.
371
+
### Removing file encryption
372
+
When this is the case, it is recommended to start up a development parse-server (or a separate process from your main process) that has the same configuration as your production server. Different from the previous examples, don't initialize your fileAdapter with a `encryptionKey`. Pass in your `oldKey` to `rotateEncryptionKey()`.
console.log('Files rotated to unencrypted with noKey: '+ rotated);
392
388
console.log('Files that couldn't be rotated to unencrypted with noKey:' + notRotated);
393
389
394
390
```
395
391
396
392
### Rotating the key for a subset of files
397
-
This is useful if for some reason there were errors and some of the files weren't rotated and returned in`notRotated`. Theprocess is the same as the previous examples, but pass in your `oldKey` along with the array of`fileNames` to `rotateFileKey()`.
393
+
This is useful if for some reason there were errors and some of the files weren't rotated and returned in`notRotated`. Theprocess is the same as the previous examples, but pass in your `oldKey` along with the array of`fileNames` to `rotateEncryptionKey()`.
398
394
399
395
```javascript
400
396
//This can take awhile depending on how many files and how large they are. It will attempt to rotate the key of all files in your filesSubDirectory
0 commit comments