Skip to content

Commit

Permalink
Merge pull request #886 from wultra/develop
Browse files Browse the repository at this point in the history
Merge develop to master
  • Loading branch information
banterCZ authored Oct 25, 2024
2 parents 4929586 + e3e788e commit 0ff4ec7
Show file tree
Hide file tree
Showing 37 changed files with 704 additions and 632 deletions.
19 changes: 10 additions & 9 deletions docs/Configuration-Properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ The Push Server uses the following public configuration properties:

## PowerAuth Push Service Configuration

| Property | Default | Note |
|---|---|---|
| `powerauth.push.service.applicationName` | `powerauth-push` | Technical name of the instance |
| `powerauth.push.service.applicationDisplayName` | `PowerAuth Push Server` | Display name of the instance |
| `powerauth.push.service.applicationEnvironment` | `_empty_` | Environment identifier |
| `powerauth.push.service.message.storage.enabled` | `false` | Whether persistent storing of sent messages is enabled |
| `powerauth.push.service.registration.multipleActivations.enabled` | `false` | Whether push registration supports "associated activations" |
| `powerauth.push.service.registration.retry.backoff` | `100` | Duration in milliseconds before a retry attempt during device registration in case of an insert error |
| `owerauth.push.service.registration.retry.maxAttempts` | `2` | Max number of retry attempts during device registration in case of an insert error |
| Property | Default | Note |
|-------------------------------------------------------------------|-------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `powerauth.push.service.applicationName` | `powerauth-push` | Technical name of the instance |
| `powerauth.push.service.applicationDisplayName` | `PowerAuth Push Server` | Display name of the instance |
| `powerauth.push.service.applicationEnvironment` | `_empty_` | Environment identifier |
| `powerauth.push.service.message.storage.enabled` | `false` | Whether persistent storing of sent messages is enabled |
| `powerauth.push.service.registration.multipleActivations.enabled` | `false` | Whether push registration supports "associated activations" |
| `powerauth.push.service.registration.retry.backoff` | `100` | Duration in milliseconds before a retry attempt during device registration in case of an insert error |
| `powerauth.push.service.registration.retry.maxAttempts` | `2` | Max number of retry attempts during device registration in case of an insert error |
| `powerauth.push.service.clients.cache.refreshAfterWrite` | `5m` | APNS, FCM and HMS client configuration is cached. It is evicted if updated via administration on a single node. This is a smart fallback for the clustered environment. |

## PowerAuth Push Campaign Setup

Expand Down
1 change: 1 addition & 0 deletions docs/Migration-Instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

This page contains PowerAuth Push Server migration instructions.

- [PowerAuth Push Server 1.9.0](./PowerAuth-Push-Server-1.9.0.md)
- [PowerAuth Push Server 1.8.0](./PowerAuth-Push-Server-1.8.0.md)
- [PowerAuth Push Server 1.7.0](./PowerAuth-Push-Server-1.7.0.md)
- [PowerAuth Push Server 1.6.0](./PowerAuth-Push-Server-1.6.0.md)
Expand Down
8 changes: 8 additions & 0 deletions docs/PowerAuth-Push-Server-1.7.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ This guide contains instructions for migration from PowerAuth Push Server versio

## Database Changes

For convenience, you can use liquibase for your database migration.

If you prefer to make manual DB schema changes, please use the following SQL scripts:

- [PostgreSQL script](./sql/postgresql/migration_1.6.0_1.7.0.sql)
- [Oracle script](./sql/oracle/migration_1.6.0_1.7.0.sql)
- [MSSQL script](./sql/mssql/migration_1.6.0_1.7.0.sql)


### Huawei Mobile Services

Expand Down
18 changes: 18 additions & 0 deletions docs/PowerAuth-Push-Server-1.9.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Migration from 1.8.x to 1.9.x

This guide contains instructions for migration from PowerAuth Push Server version `1.8.x` to version `1.9.x`.

## Database Changes

For convenience, you can use liquibase for your database migration.

If you prefer to make manual DB schema changes, please use the following SQL scripts:

- [PostgreSQL script](./sql/postgresql/migration_1.8.0_1.9.0.sql)
- [Oracle script](./sql/oracle/migration_1.8.0_1.9.0.sql)
- [MSSQL script](./sql/mssql/migration_1.8.0_1.9.0.sql)


### App Credentials Timestamp

To improve caching, the columns `timestamp_created`, and `timestamp_last_updated` have been added into the table `push_app_credentials`.
167 changes: 14 additions & 153 deletions docs/Push-Server-Database.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ You can download DDL scripts for supported databases:

- [PostgreSQL](./sql/postgresql/create_push_server_schema.sql)
- [Oracle](./sql/oracle/create_push_server_schema.sql)
- [MS SQL](./sql/mssql/create_push_server_schema.sql)

## Tables

Expand All @@ -26,26 +27,6 @@ You can download DDL scripts for supported databases:

Stores push tokens specific for a given device.

#### Schema

```sql
CREATE TABLE push_device_registration (
id INTEGER NOT NULL CONSTRAINT push_device_registration_pkey PRIMARY KEY,
activation_id VARCHAR(37),
user_id VARCHAR(255),
app_id INTEGER NOT NULL,
platform VARCHAR(255) NOT NULL,
push_token VARCHAR(255) NOT NULL,
timestamp_last_registered TIMESTAMP(6) NOT NULL,
is_active BOOLEAN
);

CREATE INDEX push_device_app_token ON push_device_registration (app_id, push_token);
CREATE INDEX push_device_user_app ON push_device_registration (user_id, app_id);
CREATE UNIQUE INDEX push_device_activation ON push_device_registration (activation_id);
CREATE UNIQUE INDEX push_device_activation_token ON push_device_registration (activation_id, push_token);
```

#### Columns

| Name | Type | Info | Note |
Expand Down Expand Up @@ -80,37 +61,21 @@ CREATE UNIQUE INDEX push_device_activation_token ON push_device_registration (ac

Stores per-app credentials used for communication with APNs / FCM.

#### Schema

```sql
CREATE TABLE push_app_credentials (
id INTEGER NOT NULL CONSTRAINT push_app_credentials_pkey PRIMARY KEY,
app_id VARCHAR(255) NOT NULL,
ios_key_id VARCHAR(255),
ios_private_key BYTEA,
ios_team_id VARCHAR(255),
ios_bundle VARCHAR(255),
ios_environment VARCHAR(32),
android_private_key BYTEA,
android_project_id VARCHAR(255)
);

CREATE UNIQUE INDEX push_app_cred_app ON push_app_credentials (app_id);
```

#### Columns

| Name | Type | Info | Note |
|-----------------------|--------------|-----------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id` | INTEGER | primary key, index, autoincrement | Unique credential record ID. |
| `app_id` | VARCHAR(255) | index | Associated application ID. |
| `ios_key_id` | VARCHAR(255) | - | Key ID used for identifying a private key in APNs service. |
| `ios_private_key` | BYTEA | - | Binary representation of P8 file with private key used for Apple's APNs service. |
| `ios_team_id` | VARCHAR(255) | - | Team ID used for sending push notifications. |
| `ios_bundle` | VARCHAR(255) | - | Application bundle ID, used as a APNs "topic". |
| `ios_environment` | VARCHAR(32) | - | Per-application APNs environment setting. `NULL` or unknown value inherits from global server configuration, values `development` or `production` override the settings. |
| `android_private_key` | BYTEA | - | Firebase service account private key used when obtaining access tokens for FCM HTTP v1 API. |
| `android_project_id` | VARCHAR(255) | - | Firebase project ID, used when sending push messages using FCM. |
| Name | Type | Info | Note |
|--------------------------|--------------|--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id` | INTEGER | primary key, index, autoincrement | Unique credential record ID. |
| `app_id` | VARCHAR(255) | index | Associated application ID. |
| `ios_key_id` | VARCHAR(255) | - | Key ID used for identifying a private key in APNs service. |
| `ios_private_key` | BYTEA | - | Binary representation of P8 file with private key used for Apple's APNs service. |
| `ios_team_id` | VARCHAR(255) | - | Team ID used for sending push notifications. |
| `ios_bundle` | VARCHAR(255) | - | Application bundle ID, used as a APNs "topic". |
| `ios_environment` | VARCHAR(32) | - | Per-application APNs environment setting. `NULL` or unknown value inherits from global server configuration, values `development` or `production` override the settings. |
| `android_private_key` | BYTEA | - | Firebase service account private key used when obtaining access tokens for FCM HTTP v1 API. |
| `android_project_id` | VARCHAR(255) | - | Firebase project ID, used when sending push messages using FCM. |
| `timestamp_created` | TIMESTAMP | `NOT NULL DEFAULT CURRENT_TIMESTAMP` | Timestamp when the record was created. |
| `timestamp_last_updated` | TIMESTAMP | | Timestamp when the record was last updated. |

#### Keys

Expand All @@ -130,24 +95,6 @@ CREATE UNIQUE INDEX push_app_cred_app ON push_app_credentials (app_id);

Stores individual messages that were sent by the push server and their sent status.

#### Schema

```sql
CREATE TABLE push_message (
id INTEGER NOT NULL CONSTRAINT push_message_pkey PRIMARY KEY,
device_registration_id INTEGER NOT NULL,
user_id VARCHAR(255) NOT NULL,
activation_id VARCHAR(37),
is_silent BOOLEAN DEFAULT false NOT NULL,
is_personal BOOLEAN DEFAULT false NOT NULL,
message_body TEXT NOT NULL,
timestamp_created TIMESTAMP(6) NOT NULL,
status INTEGER NOT NULL
);

CREATE INDEX push_message_status ON push_message (status);
```

#### Columns

| Name | Type | Info | Note |
Expand Down Expand Up @@ -180,22 +127,6 @@ CREATE INDEX push_message_status ON push_message (status);

Stores particular campaigns together with notification messages.

#### Schema

```sql
CREATE TABLE push_campaign (
id INTEGER NOT NULL CONSTRAINT push_campaign_pkey PRIMARY KEY,
app_id INTEGER NOT NULL,
message TEXT NOT NULL,
is_sent BOOLEAN DEFAULT false NOT NULL,
timestamp_created TIMESTAMP(6) NOT NULL,
timestamp_sent TIMESTAMP(6),
timestamp_completed TIMESTAMP(6)
);

CREATE INDEX push_campaign_sent ON push_campaign (is_sent);
```

#### Columns

| Name | Type | Info | Note |
Expand Down Expand Up @@ -226,20 +157,6 @@ CREATE INDEX push_campaign_sent ON push_campaign (is_sent);

Stores users who are going to get notification from specific campaign.

#### Schema

```sql
CREATE TABLE push_campaign_user (
id INTEGER NOT NULL CONSTRAINT push_campaign_user_pkey PRIMARY KEY,
campaign_id INTEGER NOT NULL,
user_id INTEGER NOT NULL,
timestamp_created TIMESTAMP(6) NOT NULL
);

CREATE INDEX push_campaign_user_campaign ON push_campaign_user (campaign_id, user_id);
CREATE INDEX push_campaign_user_detail ON push_campaign_user (user_id);
```

#### Columns

| Name | Type | Info | Note |
Expand Down Expand Up @@ -268,27 +185,6 @@ CREATE INDEX push_campaign_user_detail ON push_campaign_user (user_id);

Stores the messages to be delivered to particular users.

#### Schema

```sql
CREATE TABLE push_inbox (
id INTEGER NOT NULL CONSTRAINT push_inbox_pk PRIMARY KEY,
inbox_id VARCHAR(37) NOT NULL,
user_id VARCHAR(255) NOT NULL,
type VARCHAR(32) NOT NULL;
subject TEXT NOT NULL,
summary TEXT NOT NULL;
body TEXT NOT NULL,
read BOOLEAN DEFAULT false NOT NULL,
timestamp_created TIMESTAMP NOT NULL,
timestamp_read TIMESTAMP
);

CREATE INDEX push_inbox_id ON push_inbox (inbox_id);
CREATE INDEX push_inbox_user ON push_inbox (user_id);
CREATE INDEX push_inbox_user_read ON push_inbox (user_id, read);
```

#### Columns

| Name | Type | Info | Note |
Expand Down Expand Up @@ -324,16 +220,6 @@ CREATE INDEX push_inbox_user_read ON push_inbox (user_id, read);

Stores the messages to application mapping.

#### Schema

```sql
CREATE TABLE push_inbox_app (
app_credentials_id INTEGER NOT NULL,
inbox_id INTEGER NOT NULL,
CONSTRAINT push_inbox_app_pk PRIMARY KEY (inbox_id, app_credentials_id)
);
```

#### Columns

| Name | Type | Info | Note |
Expand Down Expand Up @@ -363,57 +249,32 @@ CREATE TABLE push_inbox_app (

Sequence for application credentials registered in the system.

#### Schema

```sql
CREATE SEQUENCE push_credentials_seq;
```
<!-- end -->

<!-- begin database sequence push_device_registration_seq -->
### Push Device Registration Sequence

Sequence for device registrations in the system.

#### Schema

```sql
CREATE SEQUENCE push_device_registration_seq;
```
<!-- end -->

<!-- begin database sequence push_message_seq -->
### Push Message Sequence

Sequence for push messages sent by the system.

#### Schema

```sql
CREATE SEQUENCE push_message_seq;
```
<!-- end -->

<!-- begin database sequence push_campaign_seq -->
### Push Campaign Sequence

Sequence for push campaigns that are created in the system.

#### Schema

```sql
CREATE SEQUENCE push_campaign_seq;
```
<!-- end -->

<!-- begin database sequence push_campaign_user_seq -->
### Push Campaign User Sequence

Sequence for user assignments to campaigns.

#### Schema

```sql
CREATE SEQUENCE push_campaign_user_seq;
```
<!-- end -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd">

<changeSet id="1" logicalFilePath="powerauth-push-server/1.8.x/20241010-add-tag-1.8.0.xml" author="Lubos Racansky">
<tagDatabase tag="powerauth-push-server-1.8.0"/>
</changeSet>

</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd">

<include file="20240708-column-renaming-keywords.xml" relativeToChangelogFile="true" />
<include file="20241010-add-tag-1.8.0.xml" relativeToChangelogFile="true" />

</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd">

<changeSet id="1" logicalFilePath="powerauth-push-server/1.9.x/20241011-add-tag-1.9.0.xml" author="Lubos Racansky">
<tagDatabase tag="powerauth-push-server-1.9.0"/>
</changeSet>

</databaseChangeLog>
Loading

0 comments on commit 0ff4ec7

Please sign in to comment.