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
{{ message }}
This repository was archived by the owner on Sep 1, 2022. It is now read-only.
A Docker image for the [Parse Server](https://parseplatform.org/) with Dashboard pre-installed and a new feature to delete orphan files when a document associated with them is removed from the database.
7
+
A Docker image for the [Parse Server](https://parseplatform.org/) with Dashboard pre-installed and a new feature to delete orphan files when an object associated with them is removed from the database.
8
8
9
9
It's based on [Express](https://expressjs.com) and supports single and multiple applications per instance.
10
10
@@ -19,11 +19,9 @@ Run the container using the image **vegidio/parse**:
19
19
```
20
20
$ docker run -d \
21
21
-e SERVER_URL=http://hostname \
22
+
-e DB_URL=mongodb://db_host:27017 \
22
23
-e MASTER_KEY=12345678 \
23
24
-e APP_IDS=app1,app2 \
24
-
-e DB_HOST=mongodb://database_host:27017 \
25
-
-e DB_USERNAME=db_username \
26
-
-e DB_PASSWORD=db_password \
27
25
-e LIVE_QUERIES='app1:Movie,Actor|app2:Post' \
28
26
-e DELETE_ORPHANS='app1:Review|app2:Comment' \
29
27
-e DASHBOARD_USERNAME=dashboard_username \
@@ -34,12 +32,20 @@ $ docker run -d \
34
32
35
33
The full list of environment variables and how they can be used to configure your Parse Server can be found in the [Parameters](#-parameters) section.
36
34
37
-
### Multiple applications
35
+
### Multiple Applications
38
36
39
37
If you want to run more than one application in the same instance then you just need to add them in the environment variable `APP_IDS`, in a single string separated by comma `,`.
40
38
41
39
For example, the environment variable `-e APP_ID=app1,app2,app3` will create 3 apps called `app1`, `app2` and `app3`.
42
40
41
+
### URLs
42
+
43
+
*__Apps:__ each app in the Parse Server can be accessed through the URL [server_url/app/`app_id`]().
44
+
*__GraphQL:__ each app can also be accessed through GraphQL with the URL [server_url/app/`app_id`/graphql]().
45
+
*__Dashboard:__ The Parse Dashboard can be accessed through the URL [server_url/dashboard]().
46
+
47
+
## ✨ Special Features
48
+
43
49
### Live Query
44
50
45
51
To enable **Live Queries** you must specify during the initialization of your Parse Server exactly what applications and classes should have this feature enabled. To do that, add the environment variable `LIVE_QUERIES` with a content with this format:
@@ -56,37 +62,50 @@ where:
56
62
57
63
For example, the environment variable `-e LIVE_QUERIES='app1:Movie,Actor|app2:Post'` will enable Live Queries in the classes `Movie` and `Actor` that belong to `app1`; and it will also enable Live Queries in the class `Post` that belong to `app2`.
58
64
59
-
### URLs
65
+
### Delete Orphan Files
60
66
61
-
*__Apps:__ each app in the Parse Server can be accessed through the URL [hostname/app/`app_id`]().
62
-
*__GraphQL:__ each app can also be accessed through GraphQL with the URL [hostname/app/`app_id`/graphql]().
63
-
*__Dashboard:__ The Parse Dashboard can be accessed through the URL [hostname/dashboard]().
67
+
By default, when a file is saved in the Parse Server and later deleted, only the file reference is actually removed from the database, but the file itself remains there. After some adding and removing files in the Parse Server, you will end up with many orphan files saved that are only occupying space.
64
68
65
-
## 🧩 Parameters
69
+
To avoid this problem you can set the environment variable `DELETE_ORPHANS` with the names of the classes that must automatically removed any orphan files when an object is deleted or updated. This variable must have the following format:
66
70
67
-
Here is the full list of parameters used by the Parse Server:
If your database requires authentication then you need to set the parameters below when you run the Parse Server, otherwise they can be ignored:
77
+
-`<appId>`: is the unique ID of your parse application, followed by the colon sign (`:`).
78
+
-`<Class>`: is the name of the class where the orphan files must be removed. If you want to remove orphan files from more than one class then each class must be separated by a comma (`,`).
79
+
- Each application and its classes must be separated by a pipe sign (`|`).
72
80
73
-
-`DB_USERNAME`: the username used to login in the database. This user must have access to create new schemas.
74
-
-`DB_PASSWORD`: the password used to login in the database.
81
+
For example, the environment variable `-e DELETE_ORPHANS='app1:Movie,Actor|app2:Post'` will remove orphan files from the classes `Movie` and `Actor` that belong to `app1`; and it will also delete orphan files from the class `Post` that belong to `app2`.
75
82
76
-
### Optional
83
+
##🧩 Parameters
77
84
78
-
-`LIVE_QUERIES`: please see [Live Query](#live-query) above.
79
-
-`DELETE_ORPHANS`: TBD
85
+
Here is the full list of parameters used by the Parse Server:
80
86
81
87
### Mandatory
82
88
83
-
-`DB_HOST`: the hostname and port where the database is hosted. You **must** include here the protocol `mongodb://` or `postgres://`, according to the database that you are using.
84
-
-`SERVER_URL`: the remote URL to access your Parse Server. You **must** include the protocol (`http://` or `https://`) here and the port, if needed.
89
+
-`SERVER_URL`: the remote URL to access your Parse Server. You **must** include the protocol here (`http://` or `https://`) and the port, if needed.
90
+
-`DB_URL`: the connection URL to the database. You **must** include here the protocol (`mongodb://` or `postgres://`) according to the database that you are using. If your database requires authentication, don't forget to include username and password as well. For example: `mongodb://username:password@localhost:27017`.
85
91
-`MASTER_KEY`: the key used to grant access to the users that want to access the Parse API.
86
92
-`APP_IDS`: one ore more unique IDs, separated by comma `,` to identify your apps. These IDs will also be used to form the URLs of your Parse apps.
87
93
-`DASHBOARD_USERNAME`: the username used to login in the Parse Dashboard.
88
94
-`DASHBOARD_PASSWORD`: the password used to login in the Parse Dashboard.
89
95
96
+
### Optional
97
+
98
+
-`LIVE_QUERIES`: please see [Live Query](#live-query) above.
99
+
-`DELETE_ORPHANS`: please see [Delete Orphan Files](#delete-orphan-files) above.
100
+
101
+
## 🛠 Build the image
102
+
103
+
If you prefer to build this image yourself, instead of using the pre-built image available on [Docker Hub](https://hub.docker.com/r/vegidio/parse), then enter the following command in terminal, in the project's root directory:
0 commit comments