From fd815d42fdb62e0053219d9d26ba41728a30ff14 Mon Sep 17 00:00:00 2001 From: stevensJourney Date: Thu, 12 Dec 2024 08:52:10 +0200 Subject: [PATCH 01/18] test config --- config/powersync.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config/powersync.yaml b/config/powersync.yaml index aeec4f7..6372b79 100644 --- a/config/powersync.yaml +++ b/config/powersync.yaml @@ -66,8 +66,10 @@ replication: # Connection settings for sync bucket storage storage: - type: mongodb - uri: !env PS_MONGO_URI + type: postgresql + uri: !env PS_STORAGE_SOURCE_URI + sslmode: disable # 'verify-full' (default) or 'verify-ca' or 'disable' + # Use these if authentication is required. The user should have `readWrite` and `dbAdmin` roles # username: my-mongo-user # password: my-password From 5407ececa1d3d7ff5b7b49a27f444b9c412dbbf3 Mon Sep 17 00:00:00 2001 From: stevensJourney Date: Thu, 19 Dec 2024 16:12:47 +0200 Subject: [PATCH 02/18] postgres bucket storage demo --- README.md | 4 ++ config/powersync.yaml | 5 +- demos/nodejs-postgres-bucket-storage/.env | 30 ++++++++ .../nodejs-postgres-bucket-storage/README.md | 29 ++++++++ .../config/powersync.yaml | 68 +++++++++++++++++++ .../config/sync_rules.yaml | 13 ++++ .../docker-compose.yaml | 51 ++++++++++++++ demos/supabase/config/powersync.yaml | 5 +- 8 files changed, 200 insertions(+), 5 deletions(-) create mode 100644 demos/nodejs-postgres-bucket-storage/.env create mode 100644 demos/nodejs-postgres-bucket-storage/README.md create mode 100644 demos/nodejs-postgres-bucket-storage/config/powersync.yaml create mode 100644 demos/nodejs-postgres-bucket-storage/config/sync_rules.yaml create mode 100644 demos/nodejs-postgres-bucket-storage/docker-compose.yaml diff --git a/README.md b/README.md index e711d15..ee1af3b 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,10 @@ This repository contains basic demonstrations in the `demos` folder. - See the README for instructions. +- [Node.js (Postgres + Postgres Bucket Storage)](./demos/nodejs-postgres-bucket-storage/README.md) + + - This can be started from the repo root with `docker compose -f demos/nodejs-postgres-bucket-storage/docker-compose.yaml up` + # Config The configuration can be modified to match other project topologies. diff --git a/config/powersync.yaml b/config/powersync.yaml index 6372b79..0c931ab 100644 --- a/config/powersync.yaml +++ b/config/powersync.yaml @@ -66,9 +66,8 @@ replication: # Connection settings for sync bucket storage storage: - type: postgresql - uri: !env PS_STORAGE_SOURCE_URI - sslmode: disable # 'verify-full' (default) or 'verify-ca' or 'disable' + type: mongodb + uri: !env PS_MONGO_URI # Use these if authentication is required. The user should have `readWrite` and `dbAdmin` roles # username: my-mongo-user diff --git a/demos/nodejs-postgres-bucket-storage/.env b/demos/nodejs-postgres-bucket-storage/.env new file mode 100644 index 0000000..02cd0b1 --- /dev/null +++ b/demos/nodejs-postgres-bucket-storage/.env @@ -0,0 +1,30 @@ +# ==================== Postgres credentials ================================ +PG_DATABASE_NAME=postgres +PG_DATABASE_PORT=5432 +PG_DATABASE_USER=postgres +PG_DATABASE_PASSWORD=postgres +PS_DATA_SOURCE_URI=postgres://${PG_DATABASE_USER}:${PG_DATABASE_PASSWORD}@pg-db:${PG_DATABASE_PORT}/${PG_DATABASE_NAME} + + +PG_STORAGE_DATABASE_NAME=postgres +PG_STORAGE_DATABASE_PORT=5431 +PG_STORAGE_DATABASE_USER=postgres +PG_STORAGE_DATABASE_PASSWORD=postgres +PS_STORAGE_SOURCE_URI=postgres://${PG_STORAGE_DATABASE_USER}:${PG_STORAGE_DATABASE_PASSWORD}@pg-db:${PG_STORAGE_DATABASE_PORT}/${PG_STORAGE_DATABASE_NAME} + +# ==================== Demo config ========================================= +DEMO_BACKEND_PORT=6060 +DEMO_BACKEND_DATABASE_TYPE=postgres +DEMO_BACKEND_DATABASE_URI=postgres://${PG_DATABASE_USER}:${PG_DATABASE_PASSWORD}@pg-db:${PG_DATABASE_PORT}/${PG_DATABASE_NAME} +# The front-end demo application is accessible at this port on the host machine +DEMO_CLIENT_PORT=3039 +PS_JWKS_URL=http://demo-backend:${DEMO_BACKEND_PORT}/api/auth/keys + +# These can be generated by following the instructions in the `key-generator` folder +# A temporary key will be used if these are not specified +DEMO_JWKS_PUBLIC_KEY= +DEMO_JWKS_PRIVATE_KEY= + +# ==================== PowerSync variables ==================== +# The PowerSync API is accessible via this port +PS_PORT=8080 diff --git a/demos/nodejs-postgres-bucket-storage/README.md b/demos/nodejs-postgres-bucket-storage/README.md new file mode 100644 index 0000000..af0a90c --- /dev/null +++ b/demos/nodejs-postgres-bucket-storage/README.md @@ -0,0 +1,29 @@ +# JavaScript PowerSync + Postgres Bucket Storage + +This is a demo for using Postgres as the sync bucket storage driver with PowerSync. This feature is only available for customers on [Team and Enterprise](https://www.powersync.com/pricing) plans. + +Separate Postgres servers are required for the bucket storage and replication data source. + +## Running + +The `.env` file contains default configuration for the services. Reference this to connect to any services locally. + +Ensure you have authenticated with our Docker Image repository. Please reach out to support for an access token. + +```bash +docker login container-registry@journeyapps.com -u user +``` + +This demo can be started by running the following in this demo directory + +```bash +docker compose up +``` + +or in the root directory run + +```bash +docker compose -f demos/nodejs-postgres-bucket-storage/docker-compose.yaml up +``` + +The frontend can be accessed at `http://localhost:3039` in a browser. diff --git a/demos/nodejs-postgres-bucket-storage/config/powersync.yaml b/demos/nodejs-postgres-bucket-storage/config/powersync.yaml new file mode 100644 index 0000000..5dab815 --- /dev/null +++ b/demos/nodejs-postgres-bucket-storage/config/powersync.yaml @@ -0,0 +1,68 @@ +# yaml-language-server: $schema=../schema/schema.json + +# Note that this example uses YAML custom tags for environment variable substitution. +# Using `!env [variable name]` will substitute the value of the environment variable named +# [variable name]. +# +# Only environment variables with names starting with `PS_` can be substituted. +# +# e.g. With the environment variable `export PS_MONGO_URI=mongodb://localhost:27017` +# and YAML code: +# uri: !env PS_MONGO_URI +# The YAML will resolve to: +# uri: mongodb://localhost:27017 +# +# If using VS Code see the `.vscode/settings.json` definitions which define custom tags. + +# migrations: +# # Migrations run automatically by default. +# # Setting this to true will skip automatic migrations. +# # Migrations can be triggered externally by altering the container `command`. +# disable_auto_migration: true + +# Settings for telemetry reporting +# See https://docs.powersync.com/self-hosting/telemetry +telemetry: + # Opt out of reporting anonymized usage metrics to PowerSync telemetry service + disable_telemetry_sharing: false + +# Settings for source database replication +replication: + # Specify database connection details + # Note only 1 connection is currently supported + # Multiple connection support is on the roadmap + connections: + - type: postgresql + # The PowerSync server container can access the Postgres DB via the DB's service name. + # In this case the hostname is pg-db + + uri: !env PS_DATA_SOURCE_URI + # SSL settings + sslmode: disable # 'verify-full' (default) or 'verify-ca' or 'disable' + +# Connection settings for sync bucket storage +storage: + type: postgresql + # This accepts the same parameters as a postgres data source connection + uri: !env PS_STORAGE_SOURCE_URI + sslmode: disable # 'verify-full' (default) or 'verify-ca' or 'disable' + +# The port which the PowerSync API server will listen on +port: !env PS_PORT + +# Specify sync rules +sync_rules: + path: sync_rules.yaml + +# Client (application end user) authentication settings +client_auth: + # JWKS URIs can be specified here + jwks_uri: !env PS_JWKS_URL + + # JWKS audience + audience: ["powersync-dev", "powersync"] + +api: + tokens: + # These tokens are used for local admin API route authentication + - use_a_better_token_in_production diff --git a/demos/nodejs-postgres-bucket-storage/config/sync_rules.yaml b/demos/nodejs-postgres-bucket-storage/config/sync_rules.yaml new file mode 100644 index 0000000..44e8a3a --- /dev/null +++ b/demos/nodejs-postgres-bucket-storage/config/sync_rules.yaml @@ -0,0 +1,13 @@ +# yaml-language-server: $schema=https://unpkg.com/@powersync/service-sync-rules@latest/schema/sync_rules.json +# +# See Documentation for more information: +# https://docs.powersync.com/usage/sync-rules +# +# Note that changes to this file are not watched. +# The service needs to be restarted for changes to take effect. + +bucket_definitions: + global: + data: + - SELECT * FROM lists + - SELECT * FROM todos diff --git a/demos/nodejs-postgres-bucket-storage/docker-compose.yaml b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml new file mode 100644 index 0000000..a3da0a9 --- /dev/null +++ b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml @@ -0,0 +1,51 @@ +# Include syntax requires Docker compose > 2.20.3 +# https://docs.docker.com/compose/release-notes/#2203 +include: + # Demo NodeJS backend server and front-end web client + - path: ../nodejs/ps-nodejs-demo.yaml + +services: + # Extend PowerSync with Mongo and Postgres healthchecks + powersync: + extends: + file: ../../services/powersync.yaml + service: powersync + depends_on: + pg-db: + condition: service_healthy + pg-storage: + condition: service_healthy + # Postgres bucket storage is only available for customers on [Team and Enterprise](https://www.powersync.com/pricing) plans. + image: container-registry.journeyapps.com/powersync-service:next + volumes: + - ./config:/config + + pg-db: + extends: + file: ../../services/postgres.yaml + service: pg-db + volumes: + - ../nodejs/init-scripts:/docker-entrypoint-initdb.d + + pg-storage: + image: postgres:latest + restart: always + environment: + - POSTGRES_USER=${PG_STORAGE_DATABASE_USER} + - POSTGRES_DB=${PG_STORAGE_DATABASE_NAME} + - POSTGRES_PASSWORD=${PG_STORAGE_DATABASE_PASSWORD} + - PGPORT=${PG_STORAGE_DATABASE_PORT} + volumes: + - pg_storage_data:/var/lib/postgresql/data + ports: + - "${PG_STORAGE_DATABASE_PORT}:${PG_STORAGE_DATABASE_PORT}" + command: ["postgres", "-c", "wal_level=logical"] + healthcheck: + test: ["CMD-SHELL", "pg_isready -U ${PG_STORAGE_DATABASE_USER} -d ${PG_STORAGE_DATABASE_NAME}"] + interval: 5s + timeout: 5s + retries: 5 + +volumes: + pg_storage_data: + pg_data: diff --git a/demos/supabase/config/powersync.yaml b/demos/supabase/config/powersync.yaml index 06f64b4..986fc6a 100644 --- a/demos/supabase/config/powersync.yaml +++ b/demos/supabase/config/powersync.yaml @@ -16,8 +16,9 @@ replication: # Connection settings for sync bucket storage storage: - type: mongodb - uri: !env PS_MONGO_URI + type: postgresql + uri: !env PS_STORAGE_SOURCE_URI + sslmode: disable # 'verify-full' (default) or 'verify-ca' or 'disable' # The port which the PowerSync API server will listen on port: !env PS_PORT From 1e471809161ae49315aba53b36eab7b0fbe420b8 Mon Sep 17 00:00:00 2001 From: stevensJourney Date: Thu, 19 Dec 2024 16:14:17 +0200 Subject: [PATCH 03/18] readme update --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1de2b34..370bd1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # PowerSync Self Hosted Example +## 2024-12-19 + +- Added demo for using Postgres as the bucket storage. + ## 2024-11-27 - Updated `journeyapps/powersync-service:latest` image specifier which will target `>v.1.0.0` of the Docker image. This version of the Docker image contains support for MongoDB (alpha), MySQL (alpha) and the new modular architecture. From e8838636788425c88e0fd748549fad5f1cba3ffc Mon Sep 17 00:00:00 2001 From: stevensJourney Date: Thu, 19 Dec 2024 18:49:40 +0200 Subject: [PATCH 04/18] update environment --- demos/nodejs-postgres-bucket-storage/.env | 2 +- demos/nodejs-postgres-bucket-storage/docker-compose.yaml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/demos/nodejs-postgres-bucket-storage/.env b/demos/nodejs-postgres-bucket-storage/.env index 02cd0b1..854be01 100644 --- a/demos/nodejs-postgres-bucket-storage/.env +++ b/demos/nodejs-postgres-bucket-storage/.env @@ -10,7 +10,7 @@ PG_STORAGE_DATABASE_NAME=postgres PG_STORAGE_DATABASE_PORT=5431 PG_STORAGE_DATABASE_USER=postgres PG_STORAGE_DATABASE_PASSWORD=postgres -PS_STORAGE_SOURCE_URI=postgres://${PG_STORAGE_DATABASE_USER}:${PG_STORAGE_DATABASE_PASSWORD}@pg-db:${PG_STORAGE_DATABASE_PORT}/${PG_STORAGE_DATABASE_NAME} +PS_STORAGE_SOURCE_URI=postgres://${PG_STORAGE_DATABASE_USER}:${PG_STORAGE_DATABASE_PASSWORD}@pg-storage:${PG_STORAGE_DATABASE_PORT}/${PG_STORAGE_DATABASE_NAME} # ==================== Demo config ========================================= DEMO_BACKEND_PORT=6060 diff --git a/demos/nodejs-postgres-bucket-storage/docker-compose.yaml b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml index a3da0a9..69c925b 100644 --- a/demos/nodejs-postgres-bucket-storage/docker-compose.yaml +++ b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml @@ -19,6 +19,8 @@ services: image: container-registry.journeyapps.com/powersync-service:next volumes: - ./config:/config + environment: + PS_STORAGE_SOURCE_URI: ${PS_STORAGE_SOURCE_URI} pg-db: extends: From 4c29fb79144e5a96934a9d711c9d5188bd1a2572 Mon Sep 17 00:00:00 2001 From: stevensJourney Date: Thu, 19 Dec 2024 20:06:05 +0200 Subject: [PATCH 05/18] update image --- demos/nodejs-postgres-bucket-storage/docker-compose.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/demos/nodejs-postgres-bucket-storage/docker-compose.yaml b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml index 69c925b..21765c3 100644 --- a/demos/nodejs-postgres-bucket-storage/docker-compose.yaml +++ b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml @@ -16,7 +16,8 @@ services: pg-storage: condition: service_healthy # Postgres bucket storage is only available for customers on [Team and Enterprise](https://www.powersync.com/pricing) plans. - image: container-registry.journeyapps.com/powersync-service:next + # TODO deploy on production registry + image: container-registry.staging.journeyapps.com/powersync-service:1.3.3-postgres-bucket-storage.staging.1 volumes: - ./config:/config environment: From a80836757b71baa12ba824de5dd89becdd643106 Mon Sep 17 00:00:00 2001 From: stevensJourney Date: Thu, 19 Dec 2024 20:31:03 +0200 Subject: [PATCH 06/18] use prod image --- demos/nodejs-postgres-bucket-storage/docker-compose.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/demos/nodejs-postgres-bucket-storage/docker-compose.yaml b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml index 21765c3..c786f69 100644 --- a/demos/nodejs-postgres-bucket-storage/docker-compose.yaml +++ b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml @@ -16,8 +16,7 @@ services: pg-storage: condition: service_healthy # Postgres bucket storage is only available for customers on [Team and Enterprise](https://www.powersync.com/pricing) plans. - # TODO deploy on production registry - image: container-registry.staging.journeyapps.com/powersync-service:1.3.3-postgres-bucket-storage.staging.1 + image: container-registry.journeyapps.com/powersync-service:postgres-bucket-storage volumes: - ./config:/config environment: From bf55090b2119156dc420a6ca04b236052f44f383 Mon Sep 17 00:00:00 2001 From: Kobie Botha Date: Thu, 19 Dec 2024 15:02:57 -0700 Subject: [PATCH 07/18] fix container URL also add a comment about the user --- demos/nodejs-custom-checkpoints/README.md | 3 ++- demos/nodejs-postgres-bucket-storage/README.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/demos/nodejs-custom-checkpoints/README.md b/demos/nodejs-custom-checkpoints/README.md index c5d904a..dd36cfc 100644 --- a/demos/nodejs-custom-checkpoints/README.md +++ b/demos/nodejs-custom-checkpoints/README.md @@ -11,7 +11,8 @@ The `.env` file contains default configuration for the services. Reference this Ensure you have authenticated with our Docker Image repository. Please reach out to support for an access token. ```bash -docker login container-registry@journeyapps.com -u user +# the value for user doesn't matter +docker login container-registry.journeyapps.com -u user ``` This demo can be started by running the following in this demo directory diff --git a/demos/nodejs-postgres-bucket-storage/README.md b/demos/nodejs-postgres-bucket-storage/README.md index af0a90c..a0d9c2e 100644 --- a/demos/nodejs-postgres-bucket-storage/README.md +++ b/demos/nodejs-postgres-bucket-storage/README.md @@ -11,7 +11,8 @@ The `.env` file contains default configuration for the services. Reference this Ensure you have authenticated with our Docker Image repository. Please reach out to support for an access token. ```bash -docker login container-registry@journeyapps.com -u user +# the value for user doesn't matter +docker login container-registry.journeyapps.com -u user ``` This demo can be started by running the following in this demo directory From 2eb6b7cd0fc8b2f865be5fc13c1f981c9fd293dd Mon Sep 17 00:00:00 2001 From: stevensJourney Date: Wed, 8 Jan 2025 09:27:12 +0200 Subject: [PATCH 08/18] added batch limits config --- .../config/powersync.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/demos/nodejs-postgres-bucket-storage/config/powersync.yaml b/demos/nodejs-postgres-bucket-storage/config/powersync.yaml index 5dab815..90ca03d 100644 --- a/demos/nodejs-postgres-bucket-storage/config/powersync.yaml +++ b/demos/nodejs-postgres-bucket-storage/config/powersync.yaml @@ -46,6 +46,17 @@ storage: # This accepts the same parameters as a postgres data source connection uri: !env PS_STORAGE_SOURCE_URI sslmode: disable # 'verify-full' (default) or 'verify-ca' or 'disable' + batch_limits: + # Maximum estimated size of operations in a single batch. + # Defaults to 5 megabytes. + max_estimated_size: 50000000 + # Maximum number of records present in a single batch. + # Defaults to 2000 records. + # Increasing this limit can improve replication times for large volumes of data. + max_record_count: 200000 + # Maximum size of size of current_data documents we lookup at a time. + # Defaults to 50 megabytes. + max_current_data_batch_size: 50000000 # The port which the PowerSync API server will listen on port: !env PS_PORT From f66898fda08d86532a4ff15cace45914d7875643 Mon Sep 17 00:00:00 2001 From: stevensJourney Date: Fri, 10 Jan 2025 15:16:23 +0200 Subject: [PATCH 09/18] update demos --- CHANGELOG.md | 2 +- demos/nodejs-postgres-bucket-storage/README.md | 7 +++++++ .../config/powersync.yaml | 11 ----------- .../docker-compose.yaml | 3 --- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 370bd1d..a1c6071 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # PowerSync Self Hosted Example -## 2024-12-19 +## 2025-01-10 - Added demo for using Postgres as the bucket storage. diff --git a/demos/nodejs-postgres-bucket-storage/README.md b/demos/nodejs-postgres-bucket-storage/README.md index a0d9c2e..b78b980 100644 --- a/demos/nodejs-postgres-bucket-storage/README.md +++ b/demos/nodejs-postgres-bucket-storage/README.md @@ -28,3 +28,10 @@ docker compose -f demos/nodejs-postgres-bucket-storage/docker-compose.yaml up ``` The frontend can be accessed at `http://localhost:3039` in a browser. + +The Postgres databases can be accessed at the following URIs + +Application data: `postgres://postgres:postgres@localhost:5432/postgres` + +bucket storage: `postgres://postgres:postgres@localhost:5431/postgres` +Bucket storage tables are located in the `powersync` schema. diff --git a/demos/nodejs-postgres-bucket-storage/config/powersync.yaml b/demos/nodejs-postgres-bucket-storage/config/powersync.yaml index 90ca03d..5dab815 100644 --- a/demos/nodejs-postgres-bucket-storage/config/powersync.yaml +++ b/demos/nodejs-postgres-bucket-storage/config/powersync.yaml @@ -46,17 +46,6 @@ storage: # This accepts the same parameters as a postgres data source connection uri: !env PS_STORAGE_SOURCE_URI sslmode: disable # 'verify-full' (default) or 'verify-ca' or 'disable' - batch_limits: - # Maximum estimated size of operations in a single batch. - # Defaults to 5 megabytes. - max_estimated_size: 50000000 - # Maximum number of records present in a single batch. - # Defaults to 2000 records. - # Increasing this limit can improve replication times for large volumes of data. - max_record_count: 200000 - # Maximum size of size of current_data documents we lookup at a time. - # Defaults to 50 megabytes. - max_current_data_batch_size: 50000000 # The port which the PowerSync API server will listen on port: !env PS_PORT diff --git a/demos/nodejs-postgres-bucket-storage/docker-compose.yaml b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml index c786f69..3f518b2 100644 --- a/demos/nodejs-postgres-bucket-storage/docker-compose.yaml +++ b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml @@ -15,8 +15,6 @@ services: condition: service_healthy pg-storage: condition: service_healthy - # Postgres bucket storage is only available for customers on [Team and Enterprise](https://www.powersync.com/pricing) plans. - image: container-registry.journeyapps.com/powersync-service:postgres-bucket-storage volumes: - ./config:/config environment: @@ -41,7 +39,6 @@ services: - pg_storage_data:/var/lib/postgresql/data ports: - "${PG_STORAGE_DATABASE_PORT}:${PG_STORAGE_DATABASE_PORT}" - command: ["postgres", "-c", "wal_level=logical"] healthcheck: test: ["CMD-SHELL", "pg_isready -U ${PG_STORAGE_DATABASE_USER} -d ${PG_STORAGE_DATABASE_NAME}"] interval: 5s From 3fa02b08e90025601a3e2137a75184e38a7301e4 Mon Sep 17 00:00:00 2001 From: stevensJourney Date: Fri, 10 Jan 2025 15:51:42 +0200 Subject: [PATCH 10/18] update readme --- demos/nodejs-postgres-bucket-storage/README.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/demos/nodejs-postgres-bucket-storage/README.md b/demos/nodejs-postgres-bucket-storage/README.md index b78b980..9b25edb 100644 --- a/demos/nodejs-postgres-bucket-storage/README.md +++ b/demos/nodejs-postgres-bucket-storage/README.md @@ -1,6 +1,6 @@ # JavaScript PowerSync + Postgres Bucket Storage -This is a demo for using Postgres as the sync bucket storage driver with PowerSync. This feature is only available for customers on [Team and Enterprise](https://www.powersync.com/pricing) plans. +This is a demo for using Postgres as the sync bucket storage driver with PowerSync. Separate Postgres servers are required for the bucket storage and replication data source. @@ -8,13 +8,6 @@ Separate Postgres servers are required for the bucket storage and replication da The `.env` file contains default configuration for the services. Reference this to connect to any services locally. -Ensure you have authenticated with our Docker Image repository. Please reach out to support for an access token. - -```bash -# the value for user doesn't matter -docker login container-registry.journeyapps.com -u user -``` - This demo can be started by running the following in this demo directory ```bash From f7508dfdbebdc83a91236aae04d1ba50f571ab7d Mon Sep 17 00:00:00 2001 From: stevensJourney Date: Fri, 10 Jan 2025 16:52:58 +0200 Subject: [PATCH 11/18] development image --- demos/nodejs-postgres-bucket-storage/docker-compose.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/demos/nodejs-postgres-bucket-storage/docker-compose.yaml b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml index 3f518b2..5500698 100644 --- a/demos/nodejs-postgres-bucket-storage/docker-compose.yaml +++ b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml @@ -19,7 +19,9 @@ services: - ./config:/config environment: PS_STORAGE_SOURCE_URI: ${PS_STORAGE_SOURCE_URI} - + image: + # This is not yet available in the latest release + journeyapps/powersync-service:0.0.0-dev-20250110144411 pg-db: extends: file: ../../services/postgres.yaml From 02f93ffe6c6a87d4e03feaee702d0675620f31ac Mon Sep 17 00:00:00 2001 From: stevensJourney Date: Mon, 13 Jan 2025 10:19:57 +0200 Subject: [PATCH 12/18] update image --- demos/nodejs-postgres-bucket-storage/docker-compose.yaml | 3 --- services/powersync.yaml | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/demos/nodejs-postgres-bucket-storage/docker-compose.yaml b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml index 5500698..5218fdc 100644 --- a/demos/nodejs-postgres-bucket-storage/docker-compose.yaml +++ b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml @@ -19,9 +19,6 @@ services: - ./config:/config environment: PS_STORAGE_SOURCE_URI: ${PS_STORAGE_SOURCE_URI} - image: - # This is not yet available in the latest release - journeyapps/powersync-service:0.0.0-dev-20250110144411 pg-db: extends: file: ../../services/postgres.yaml diff --git a/services/powersync.yaml b/services/powersync.yaml index 762597d..35beccf 100644 --- a/services/powersync.yaml +++ b/services/powersync.yaml @@ -1,7 +1,9 @@ services: powersync: restart: unless-stopped - image: journeyapps/powersync-service:latest + image: + # Postgres bucker storage is not yet available in the latest release + journeyapps/powersync-service:0.0.0-dev-20250113080324 # The unified service runs an API server and replication worker in the same container. # These services can be executed in different containers by using individual entry commands e.g. # Start only the API server with From 1d863fdd5bcea7b2f6036dd228a27fcda60a2b01 Mon Sep 17 00:00:00 2001 From: stevensJourney Date: Mon, 13 Jan 2025 11:06:15 +0200 Subject: [PATCH 13/18] use latest image --- demos/nodejs-postgres-bucket-storage/config/sync_rules.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/demos/nodejs-postgres-bucket-storage/config/sync_rules.yaml b/demos/nodejs-postgres-bucket-storage/config/sync_rules.yaml index 44e8a3a..5befc84 100644 --- a/demos/nodejs-postgres-bucket-storage/config/sync_rules.yaml +++ b/demos/nodejs-postgres-bucket-storage/config/sync_rules.yaml @@ -7,7 +7,10 @@ # The service needs to be restarted for changes to take effect. bucket_definitions: + lists: + parameters: select id from lists; + data: + - select * from todos where list_id = bucket.id; global: data: - SELECT * FROM lists - - SELECT * FROM todos From 99b106306ed550e33e037b84090a15ac4440f364 Mon Sep 17 00:00:00 2001 From: stevensJourney Date: Mon, 13 Jan 2025 11:11:33 +0200 Subject: [PATCH 14/18] revert test --- demos/nodejs-postgres-bucket-storage/config/sync_rules.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/demos/nodejs-postgres-bucket-storage/config/sync_rules.yaml b/demos/nodejs-postgres-bucket-storage/config/sync_rules.yaml index 5befc84..44e8a3a 100644 --- a/demos/nodejs-postgres-bucket-storage/config/sync_rules.yaml +++ b/demos/nodejs-postgres-bucket-storage/config/sync_rules.yaml @@ -7,10 +7,7 @@ # The service needs to be restarted for changes to take effect. bucket_definitions: - lists: - parameters: select id from lists; - data: - - select * from todos where list_id = bucket.id; global: data: - SELECT * FROM lists + - SELECT * FROM todos From 8946a8ec6e49a63d95313a4a4977c7e4d2d223e2 Mon Sep 17 00:00:00 2001 From: stevensJourney <51082125+stevensJourney@users.noreply.github.com> Date: Mon, 13 Jan 2025 11:25:00 +0200 Subject: [PATCH 15/18] Update services/powersync.yaml Co-authored-by: benitav --- services/powersync.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/powersync.yaml b/services/powersync.yaml index 35beccf..febded1 100644 --- a/services/powersync.yaml +++ b/services/powersync.yaml @@ -2,7 +2,7 @@ services: powersync: restart: unless-stopped image: - # Postgres bucker storage is not yet available in the latest release + # Postgres bucket storage is not yet available in the latest release journeyapps/powersync-service:0.0.0-dev-20250113080324 # The unified service runs an API server and replication worker in the same container. # These services can be executed in different containers by using individual entry commands e.g. From 57a08d2d5a30ee1fc44eb7a7d57bdb8da86aa242 Mon Sep 17 00:00:00 2001 From: stevensJourney <51082125+stevensJourney@users.noreply.github.com> Date: Mon, 13 Jan 2025 13:26:15 +0200 Subject: [PATCH 16/18] Update README.md Co-authored-by: benitav --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ee1af3b..5f89283 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ This repository contains basic demonstrations in the `demos` folder. - See the README for instructions. -- [Node.js (Postgres + Postgres Bucket Storage)](./demos/nodejs-postgres-bucket-storage/README.md) +- [Node.js (Postgres + Postgres Sync Bucket Storage)](./demos/nodejs-postgres-bucket-storage/README.md) - This can be started from the repo root with `docker compose -f demos/nodejs-postgres-bucket-storage/docker-compose.yaml up` From 07b9efd9c82ea6c2d6b3321b353ad4dd2eb4a180 Mon Sep 17 00:00:00 2001 From: stevensJourney Date: Wed, 15 Jan 2025 09:43:43 +0200 Subject: [PATCH 17/18] use latest image --- services/powersync.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/powersync.yaml b/services/powersync.yaml index 35beccf..6f0356b 100644 --- a/services/powersync.yaml +++ b/services/powersync.yaml @@ -3,7 +3,7 @@ services: restart: unless-stopped image: # Postgres bucker storage is not yet available in the latest release - journeyapps/powersync-service:0.0.0-dev-20250113080324 + journeyapps/powersync-service:0.0.0-dev-20250114143744 # The unified service runs an API server and replication worker in the same container. # These services can be executed in different containers by using individual entry commands e.g. # Start only the API server with From 2a4f6941ec655b31f105448979b82a64e80a84b6 Mon Sep 17 00:00:00 2001 From: stevensJourney Date: Wed, 15 Jan 2025 16:12:19 +0200 Subject: [PATCH 18/18] update image --- services/powersync.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/services/powersync.yaml b/services/powersync.yaml index d3e78f7..762597d 100644 --- a/services/powersync.yaml +++ b/services/powersync.yaml @@ -1,9 +1,7 @@ services: powersync: restart: unless-stopped - image: - # Postgres bucket storage is not yet available in the latest release - journeyapps/powersync-service:0.0.0-dev-20250114143744 + image: journeyapps/powersync-service:latest # The unified service runs an API server and replication worker in the same container. # These services can be executed in different containers by using individual entry commands e.g. # Start only the API server with