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
Copy file name to clipboardExpand all lines: README.md
+22-26Lines changed: 22 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,15 +29,21 @@ There is also support for legacy XMPP protocol for FCM.
29
29
30
30
This will start the database at `localhost:9001`
31
31
32
-
3.2. To use as an embedded in-memory database instance (Not recommended for production deployments), set the `spring.datasource.url=jdbc:hsqldb:mem:/appserver` in `application-<profile>.properties`.
32
+
3.2. To use as an embedded in-memory database instance (Not recommended for production deployments), set the `spring.datasource.url=jdbc:hsqldb:mem:/appserver` in `application-<profile>.properties`. Also, change the properties in `src/main/resources/application.properties` to dev or prod according to your requirements.
33
33
34
-
4. Build the project using gradle wrapper and run using spring boot. Note: This project uses JAVA 11, please download and install it before building. On mac or linux, run the below -
34
+
4. Build the project using gradle wrapper and run using spring boot. Note: This project uses JAVA 11, please download and install it before building.
35
+
36
+
5. The build will need to create a logs directory. The default path is `/usr/local/var/lib/radar/appserver/logs`. Either create the directory there using `sudo mkdir -p /usr/local/var/lib/radar/appserver/logs` followed by `sudo chown $USER /usr/local/var/lib/radar/appserver/logs` or change logs file directory in `src/main/resources/logback-spring.xml` to local log directory like `<property name="LOGS" value="logs" />`
37
+
38
+
6. There are 2 ways to communicate with the Firebase Cloud Messaging- XMPP and Admin SDK. At least one of these needs to be configured. To configure these, please look at the [FCM section](#fcm).
39
+
40
+
7. To run the build on mac or linux, run the below -
35
41
```bash
36
42
./gradlew bootRun
37
43
```
38
44
You can also run in an IDE (like IntelliJ Idea) by giving the `/src/main/java/org/radarbase/appserver/AppserverApplication.java` as the main class.
39
45
40
-
5. The App-server is now connected to the FCM XMPP server and is able to send and receive messages. On your mobile application, try sending an upstream message using the FCM sdk for your platform. Notification scheduling parses payloads from upstream messages containing the action SCHEDULE. The format of the data payload of upstream message should contain at least-
46
+
8. The App-server is now connected to the FCM XMPP server and is able to send and receive messages. On your mobile application, try sending an upstream message using the FCM sdk for your platform. Notification scheduling parses payloads from upstream messages containing the action SCHEDULE. The format of the data payload of upstream message should contain at least-
41
47
```json
42
48
{
43
49
"data":
@@ -54,11 +60,11 @@ There is also support for legacy XMPP protocol for FCM.
54
60
}
55
61
```
56
62
57
-
6. Voila!, you will now receive a notification at the schedule time (specified by `time` in the payload) on your device.
63
+
9. Voila!, you will now receive a notification at the schedule time (specified by `time` in the payload) on your device.
58
64
59
-
7. You can also achieve the same using more reliable and flexible REST API using the schedule endpoint. Please refer to REST API section below for more info.
65
+
10. You can also achieve the same using more reliable and flexible REST API using the schedule endpoint. Please refer to REST API section below for more info.
60
66
61
-
8. API documentation is available via Swagger UI when you launch the app server. Please refer to the Documentation section below.
67
+
11. API documentation is available via Swagger UI when you launch the app server. Please refer to the Documentation section below.
62
68
63
69
## REST API
64
70
@@ -107,6 +113,8 @@ The same result as stated in [Getting Started](#getting-started) can be achieved
107
113
There are other features provided via the REST endpoints. These can be explored using swagger-ui. Please refer to [Documentation](#documentation) section.
108
114
109
115
## FCM
116
+
117
+
### XMPP
110
118
The FCM related code is provided in the `org.radarbase.fcm` package. This can be explored in java-docs as mention in the [Documentation](#documentation) section.
111
119
To use Firebase Cloud Messaging(FCM), you will need to configure the following properties -
112
120
@@ -116,7 +124,11 @@ To use Firebase Cloud Messaging(FCM), you will need to configure the following p
116
124
| fcmserver.serverkey | Server Key from FCM. Can be found in the FCM project settings | NA | Yes |
117
125
| fcmserver.fcmsender | The Sender to use for sending messages. There is a choice of using XMPP or FCM Admin SDK. |`org.radarbase.fcm.downstream.XmppFcmSender`| No |
118
126
119
-
**Note:** Only sending messages via XMPP protocol supports Delivery Receipts on FCM.
127
+
**Note:** Only sending messages via XMPP protocol supports Delivery Receipts on FCM.
128
+
129
+
### AdminSDK
130
+
To configure AdminSDK, follow the official Firebase [documentation](https://firebase.google.com/docs/admin/setup#initialize-sdk) till you setup the enviroment variable. In the properties file, you would need to change `fcmserver.fcmsender` to `org.radarbase.fcm.downstream.AdminSdkFcmSender` and set `fcmserver.xmpp.upstream.enable` to `false`.
131
+
120
132
121
133
## Docker/ Docker Compose
122
134
The AppServer is also available as a docker container. It's [Dockerfile](/Dockerfile) is provided with the project. It can be run as follows -
@@ -132,7 +144,7 @@ The same can be achieved by running as a docker-compose service. Just specify th
132
144
```yml
133
145
services:
134
146
appserver:
135
-
image: radarbase/radar-appserver:0.0.1
147
+
image: radarbase/radar-appserver:1.1.0
136
148
restart: always
137
149
ports:
138
150
- 8080:8080
@@ -344,7 +356,7 @@ To enable security of specific provider, please read the sections below.
344
356
### Management Portal
345
357
To enable security via the [RADAR Management Portal](https://github.com/RADAR-base/ManagementPortal), set the following property -
346
358
```ini
347
-
managementportal.security.enabled=true
359
+
security.radar.managementportal.url=true
348
360
```
349
361
This will instantiate all the classes needed for security using the management portal. Per endpoint level auth is controlled using Pre and Post annotations for each permission.
350
362
All the classes are located in [/src/main/java/org/radarbase/appserver/auth/managementportal](/src/main/java/org/radarbase/appserver/auth/managementportal).
@@ -468,20 +480,4 @@ This will run checkstyle, PMD, spot bugs, unit tests and integration tests.
468
480
- Uses [lombok.data](https://projectlombok.org/) in most places to reduce boiler plate code and make it more readable.
469
481
- Has support for Auditing of database entities.
470
482
- Uses and extends the Spring XMPP integration library for implementing the XMPP protocol.
471
-
- Extends `XmppConnectionFactoryBean` with support for Reconnection and connection draining implementation using a Back-off strategy.
472
-
473
-
### TODO
474
-
475
-
- Add better documentation.
476
-
- Add validation of notification requests using the protocol and enrolment date of the user.
477
-
- Add endpoint to filter notifications based on different params.
478
-
-~~Update lastOpened metric for user when a request is received.~~
479
-
-~~Add batch scheduling of notifications.~~
480
-
- Add Management Portal service for getting any missing info not present in a request.
481
-
- Add support for sending messages via Firebase Admin SDK.
482
-
-~~Make the Xmpp Connection more robust by adding reconnection logic.~~
483
-
- Break out the org.radarbase.fcm package into its own module to be used as a library.
484
-
-~~Add docker builds.~~
485
-
- Add a Angular UI to view, update and schedule/send notifications to subjects.
486
-
- Investigate the feasibility of adding as an integration to the Management Portal for various tasks. (For instance, a new token can be sent via push notification using a button on MP to the device if the token has expired).
487
-
-~~Add security to the application using MP OAuth client resource.~~
483
+
- Extends `XmppConnectionFactoryBean` with support for Reconnection and connection draining implementation using a Back-off strategy.
0 commit comments