diff --git a/modules/ROOT/assets/attachments/configuration-properties-legacy.yaml b/modules/ROOT/assets/attachments/configuration-properties-legacy.yaml index 57c4bbcf3..c4582ae6f 100644 --- a/modules/ROOT/assets/attachments/configuration-properties-legacy.yaml +++ b/modules/ROOT/assets/attachments/configuration-properties-legacy.yaml @@ -722,16 +722,10 @@ properties: "session_cookie_name": "CustomName1", "server": "http://localhost:8091", "bucket": "bucket-1", - "users": { - "user_1": {"password":"1234"} - }, "db2": { "session_cookie_name": "CustomName2", "server": "http://localhost:8091", - "bucket": "bucket-2", - "users": { - "adam_2": {"password":"5678"} - } + "bucket": "bucket-2" } } } diff --git a/modules/ROOT/assets/attachments/rest-api-admin-database.yaml b/modules/ROOT/assets/attachments/rest-api-admin-database.yaml index 32ddc57cf..f068b7b94 100644 --- a/modules/ROOT/assets/attachments/rest-api-admin-database.yaml +++ b/modules/ROOT/assets/attachments/rest-api-admin-database.yaml @@ -1144,20 +1144,34 @@ definitions: sync: $ref: '#/definitions/sync_function_model' - - users: +# + # users: + # type: object + # title: user_configuration_model + # description: |+ + # Defines the user(s) for this Sync Gateway database + # $ref: "#/definitions/user_configuration_model" + + # roles: + # type: object + # title: role_configuration_model + # description: |+ + # Defines the role(s) for this Sync Gateway database + # $ref: "#/definitions/role_configuration_model" + + guest: type: object - title: user_configuration_model description: |+ - Defines the user(s) for this Sync Gateway database - $ref: "#/definitions/user_configuration_model" + Defines whether a GUEST user is available and able to interacted, unauthenticated, with the Public REST API + properties: + disabled: + type: boolean + default: true + description: |+ + Set `disabled` = `false` to allow GUEST - roles: - type: object - title: role_configuration_model - description: |+ - Defines the role(s) for this Sync Gateway database - $ref: "#/definitions/role_configuration_model" + For example: + ```curl -X PUT username:password@localhost:4985/db/_config -H "Content-Type: application/json" --data-binary '{"guest": {"disabled":false}}``` revs_limit: type: integer @@ -1240,11 +1254,8 @@ definitions: { "databases": { "db": { - "server": "http://localhost:8091", "bucket": "default", - "password": "password", "import_docs": true, - "enable_shared_bucket_access": true, "import_filter": ` function(doc) { if (doc.type != "mobile") { @@ -1782,23 +1793,23 @@ definitions: The default is `7776000` seconds (90 days). default: 7776000 - enable_shared_bucket_access: - type: boolean - description: |+ - **Deprecated at 3.0** + # enable_shared_bucket_access: + # type: boolean + # description: |+ + # **Deprecated at 3.0** - use the `enable_shared_bucket_access` property to define whether to use extended attributes to store sync metadata; this is required to enable mobile-to-server data sync (_mobile convergence_). + # use the `enable_shared_bucket_access` property to define whether to use extended attributes to store sync metadata; this is required to enable mobile-to-server data sync (_mobile convergence_). - You can learn more about this functionality in [Syncing with Couchbase Server](sync-with-couchbase-server.html) + # You can learn more about this functionality in [Syncing with Couchbase Server](sync-with-couchbase-server.html) - This property works in conjunction with the ```import_docs``` property, which determines whether a node participates in import processing. + # This property works in conjunction with the ```import_docs``` property, which determines whether a node participates in import processing. - Set `enable_shared_bucket_access` to `true` on all nodes participating in such a configuration. + # Set `enable_shared_bucket_access` to `true` on all nodes participating in such a configuration. - On start-up, Sync Gateway will generate the mobile-specific metadata for all the pre-existing documents in the Couchbase Server bucket. From then on, documents can be inserted on the Server directly (with N1QL or SDKs) or through the Sync Gateway REST API. + # On start-up, Sync Gateway will generate the mobile-specific metadata for all the pre-existing documents in the Couchbase Server bucket. From then on, documents can be inserted on the Server directly (with N1QL or SDKs) or through the Sync Gateway REST API. - Change initiates a database restart - default: 'false' + # Change initiates a database restart + # default: 'false' session_cookie_secure: type: boolean @@ -1823,23 +1834,13 @@ definitions: ```json { - "interface":":4984", - "log":["*"], "databases": { "db1": { "session_cookie_name": "CustomName1", - "server": "http://localhost:8091", "bucket": "bucket-1", - "users": { - "user_1": {"password":"1234"} - }, - "db2": { + "db2": { "session_cookie_name": "CustomName2", - "server": "http://localhost:8091", "bucket": "bucket-2", - "users": { - "adam_2": {"password":"5678"} - } } } } @@ -1943,18 +1944,10 @@ definitions: ```json { - "logging": { - "console": { - "log_keys": ["*"] - } - }, "databases": { "db": { - "server": "http://localhost:8091", "bucket": "default", - "users": { "GUEST": { "disabled": false, "admin_channels": ["*"] } }, - "allow_conflicts": false, - "revs_limit": 20, + # ... any other config required ... "delta_sync": { "enabled": true, "rev_max_age_seconds": 86400 @@ -1968,9 +1961,9 @@ definitions: -- Use of Delta Sync incurs additional bucket storage requirements which can be tuned with the [`rev_max_age_seconds`](#databases-this_db-delta_sync-rev_max_age_seconds) property. - -- Delta Sync is automatically enabled for peer-to-peer sync between Couchbase Lite clients. + -- Delta Sync is automatically enabled for peer-to-peer sync (where available) between Couchbase Lite clients. - -- Delta sync is disabled for Couchbase Lite database replicas. + -- Delta sync is disabled for Couchbase Lite database replicas (where available). -- Push replications do not use Delta Sync when pushing to a pre-2.8 target. diff --git a/modules/ROOT/assets/attachments/rest-api-admin.yaml b/modules/ROOT/assets/attachments/rest-api-admin.yaml index 161abced7..2079436a0 100644 --- a/modules/ROOT/assets/attachments/rest-api-admin.yaml +++ b/modules/ROOT/assets/attachments/rest-api-admin.yaml @@ -15,7 +15,6 @@ consumes: - application/json produces: - application/json - paths: /: get: @@ -297,9 +296,8 @@ paths: ``` { - "server":"http://localhost:8091",
- "bucket": "todo_app",
- "users": {"john": {"password": "pass", "admin_channels": ["*"]}} + "name": "todo_db" + "bucket": "todo_app" } ``` @@ -315,7 +313,6 @@ paths: delete: tags: - - 'Database Configuration' - 'Database Management' summary: Delete database description: Delete database @@ -2673,6 +2670,20 @@ definitions: # Defines the role(s) for this Sync Gateway database # $ref: "#/definitions/role_configuration_model" + guest: + type: object + description: |+ + Defines whether a GUEST user is available and able to interacted, unauthenticated, with the Public REST API + properties: + disabled: + type: boolean + default: true + description: |+ + Set `disabled` = `false` to allow GUEST + + For example: + ```curl -X PUT username:password@localhost:4985/db/_config -H "Content-Type: application/json" --data-binary '{"guest": {"disabled":false}}``` + revs_limit: type: integer description: |+ @@ -2746,7 +2757,7 @@ definitions: import_filter: type: string description: |+ - The `import_filter` property holds a Javascript function that cpntrols whether a document written to the Couchbase Server bucket should be made available to Couchbase Mobile clients (that is, it should be imported). + The `import_filter` property holds a Javascript function that controls whether a document written to the Couchbase Server bucket should be made available to Couchbase Mobile clients (that is, it should be imported). This JavaScript filter function is provisioned using the Admin Rest API Endpoint ```put {db}/_config/import_filter```. Add function as plain javascript in the request body, with the ```content-Type: application/javascript``` header. @@ -2757,20 +2768,15 @@ definitions: { "databases": { "db": { - "server": "http://localhost:8091", - "bucket": "default", - "password": "password", - "import_docs": true, - "enable_shared_bucket_access": true, - "import_filter": ` - function(doc) { - if (doc.type != "mobile") { - return false - } - return true - } - `, - } + "import_filter": ` + function(doc) { + if (doc.type != "mobile") { + return false + } + return true + } + `, + } } } ``` @@ -3340,23 +3346,14 @@ definitions: ```json { - "interface":":4984", - "log":["*"], "databases": { "db1": { "session_cookie_name": "CustomName1", - "server": "http://localhost:8091", - "bucket": "bucket-1", - "users": { - "user_1": {"password":"1234"} + "bucket": "bucket-1" }, "db2": { "session_cookie_name": "CustomName2", - "server": "http://localhost:8091", - "bucket": "bucket-2", - "users": { - "adam_2": {"password":"5678"} - } + "bucket": "bucket-2" } } } @@ -3460,18 +3457,8 @@ definitions: ```json { - "logging": { - "console": { - "log_keys": ["*"] - } - }, "databases": { "db": { - "server": "http://localhost:8091", - "bucket": "default", - "users": { "GUEST": { "disabled": false, "admin_channels": ["*"] } }, - "allow_conflicts": false, - "revs_limit": 20, "delta_sync": { "enabled": true, "rev_max_age_seconds": 86400 @@ -4092,13 +4079,6 @@ definitions: description: Role name - - - - - - - ActiveTaskResponseBody: type: object properties: diff --git a/modules/ROOT/assets/attachments/sg-database.yaml b/modules/ROOT/assets/attachments/sg-database.yaml index d76506931..38047f4b6 100644 --- a/modules/ROOT/assets/attachments/sg-database.yaml +++ b/modules/ROOT/assets/attachments/sg-database.yaml @@ -39,113 +39,21 @@ properties: default: |+ `function(doc, oldDoc) {channel(doc.channels);}` - # users: - # type: object - # title: "User Configuration Model" - # description: |+ - # Definition of a Sync Gateway user - - # Change initiates database restart - - # required: - # - name - # properties: - # name: - # type: string - # description: |+ - # The user name (the same name used in the URL path). - - # The valid characters for a user name are alphanumeric ASCII characters and the underscore character. - - # The name property is required in a POST request. - - # You don’t need to include it in a PUT request because the user name is specified in the URL. - # password: - # type: string - # description: |+ - # Password of the user. - - # Mandatory, unless `allow_empty_password=true`. - - # admin_channels: - # type: array - # description: |+ - # The channels that the user is able to access. - # items: - # type: string - # description: |+ - # Channel name - - # admin_roles: - # type: array - # description: |+ - # An array of the roles this user is associated with. - # items: - # type: string - # description: Role name - - # all_channels: - # type: array - # description: |+ - # Shows the channels the user can access, as granted by the sync function. - - # This is a read-only property. - # Changes to it are ignored. - # readOnly: true - # items: - # type: string - # description: Channel name - # email: - # type: string - # description: |+ - # Email address of the user. - # disabled: - # type: boolean - # description: |+ - # This property is usually not included. - - # If the value is `true`, access for the account is disabled and the user will not be able to login. - # roles: - # type: array - # readOnly: true - # description: |+ - # Shows the roles this user is associated with by the Sync function. - - # This is a read-only property. - # Changes to it are ignored. - - # items: - # type: string - # description: Role name - - - # roles: - # title: "Role Configuration Model" - # type: object - # description: |+ - # Use the `role` property to define a Sync Gateway role - # required: - # - name - # properties: - # name: - # type: string - # description: |+ - # Name of the role - # admin_channels: - # type: array - # description: |+ - # Array of channel names the role allows access to - # items: - # type: string - # all_channels: - # type: array - # readOnly: true - # description: |+ - # Lists all the channels the role has access to including any assigned by the `sync` function. - - # This is a derived property and changes to it are ignored. - # items: - # type: string + + guest: + type: object + description: |+ + Defines whether a GUEST user is available and able to interacted, unauthenticated, with the Public REST API + properties: + disabled: + type: boolean + default: true + description: |+ + Set `disabled` = `false` to allow GUEST + + For example: + ```curl -X PUT username:password@localhost:4985/db/_config -H "Content-Type: application/json" --data-binary '{"guest": {"disabled":false}}``` + revs_limit: type: integer @@ -231,11 +139,8 @@ properties: { "databases": { "db": { - "server": "http://localhost:8091", "bucket": "default", - "password": "password", "import_docs": true, - "enable_xattrs": true, "import_filter": ` function(doc) { if (doc.type != "mobile") { @@ -813,27 +718,18 @@ properties: ```json { - "interface":":4984", - "log":["*"], "databases": { "db1": { "session_cookie_name": "CustomName1", - "server": "http://localhost:8091", - "bucket": "bucket-1", - "users": { - "user_1": {"password":"1234"} + "bucket": "bucket-1" }, "db2": { "session_cookie_name": "CustomName2", - "server": "http://localhost:8091", - "bucket": "bucket-2", - "users": { - "adam_2": {"password":"5678"} - } + "bucket": "bucket-2" } - } } } + ``` With this configuration, the `Set-Cookie` response header of the POST `:4984/{db}/_session` endpoint (Public REST API) would then have the form "CustomName1=3cad4b95524179bf144fe0d92b8f09877bb86bf5;path=/db1/". @@ -940,11 +836,6 @@ properties: }, "databases": { "db": { - "server": "http://localhost:8091", - "bucket": "default", - "users": { "GUEST": { "disabled": false, "admin_channels": ["*"] } }, - "allow_conflicts": false, - "revs_limit": 20, "delta_sync": { "enabled": true, "rev_max_age_seconds": 86400 diff --git a/modules/ROOT/examples/configuration/sync-gateway-config.json b/modules/ROOT/examples/configuration/sync-gateway-config.json index 9248790fc..177c518dc 100644 --- a/modules/ROOT/examples/configuration/sync-gateway-config.json +++ b/modules/ROOT/examples/configuration/sync-gateway-config.json @@ -4,7 +4,7 @@ // ... additional configuration data as required ... "databases": { "getting-started-db": { - "server": "http://localhost:8091", + "name": "dbname", "bucket": "getting-started-bucket", "username": "sync_gateway", // <.> "password": "password", // <.> @@ -57,23 +57,16 @@ // ... may be preceded by additional configuration data as required by the user ... "databases": { "getting-started-db": { - "server": "http://localhost:8091", "bucket": "getting-started-bucket", - "username": "sync_gateway", // <1> - "password": "password", // <2> - "enable_shared_bucket_access": true, // <3> "import_docs": true, - "num_index_replicas": 0, // <4> + "num_index_replicas": 0, // <.> "import_filter": ` - function(doc) { // <5> + function(doc) { // <.> if (doc.type != "mobile") { return false } return true }`, - "users": { - "GUEST": { "disabled": false, "admin_channels": ["*"] } - }, "sync": `function (doc, oldDoc) { if (doc.sdk) { channel(doc.sdk); @@ -92,17 +85,10 @@ // ... may be preceded by additional configuration data as required by the user ... "databases": { "getting-started-db": { - "server": "http://localhost:8091", "bucket": "getting-started-bucket", - "username": "sync_gateway", // <1> - "password": "password", // <2> - "enable_shared_bucket_access": true, // <3> "import_docs": true, - "num_index_replicas": 0, // <4> - "users": { - "GUEST": { "disabled": false, "admin_channels": ["*"] }, - }, - "sync": `function (doc, oldDoc) { //<5> + "num_index_replicas": 0, // <.> + "sync": `function (doc, oldDoc) { //<.> if (doc.sdk) { channel(doc.sdk); } diff --git a/modules/ROOT/examples/examples-library.adoc b/modules/ROOT/examples/examples-library.adoc index 3367a9309..e86333764 100644 --- a/modules/ROOT/examples/examples-library.adoc +++ b/modules/ROOT/examples/examples-library.adoc @@ -658,11 +658,9 @@ You will set the value of the xattr using the SDK API when the document is creat [source,json] ---- { - "interface":":4984", - "log":["*"], "databases": { "default": { - "server": "http://localhost:8091", + "name": "dbname", "bucket": "default", "oidc": { "providers": { diff --git a/modules/ROOT/pages/_partials/concepts/cc-delta-sync.adoc b/modules/ROOT/pages/_partials/concepts/cc-delta-sync.adoc index 4c14fbb64..2b12db213 100644 --- a/modules/ROOT/pages/_partials/concepts/cc-delta-sync.adoc +++ b/modules/ROOT/pages/_partials/concepts/cc-delta-sync.adoc @@ -22,16 +22,10 @@ NOTE: Push replications do not use Delta Sync when pushing to a pre-2.8 target. [source, console] ---- { - "logging": { - "console": { - "log_keys": ["*"] - } - }, "databases": { "db": { - "server": "http://localhost:8091", + "name": "dbname", "bucket": "default", - "users": { "GUEST": { "disabled": false, "admin_channels": ["*"] } }, "allow_conflicts": false, "revs_limit": 20, "delta_sync": { diff --git a/modules/ROOT/pages/_partials/concepts/sync-function.adoc b/modules/ROOT/pages/_partials/concepts/sync-function.adoc index a8c811aae..18ad9f329 100644 --- a/modules/ROOT/pages/_partials/concepts/sync-function.adoc +++ b/modules/ROOT/pages/_partials/concepts/sync-function.adoc @@ -164,16 +164,10 @@ Here we embed our Sync Function in our Sync Gateway configuration file. // ... may be preceded by additional configuration data as required by the user ... "databases": { "getting-started-db": { - "server": "http://localhost:8091", + "name": "getting-started-db", "bucket": "getting-started-bucket", - "username": "sync_gateway", - "password": "password", - "enable_shared_bucket_access": true, "import_docs": true, "num_index_replicas": 0, - "users": { - "GUEST": { "disabled": false, "admin_channels": ["*"] }, - }, "sync": `/* sync function code */` // <.> } } diff --git a/modules/ROOT/pages/_partials/configuration/definitions/database_configuration_model.adoc b/modules/ROOT/pages/_partials/configuration/definitions/database_configuration_model.adoc index 757675fbf..b7986e2af 100644 --- a/modules/ROOT/pages/_partials/configuration/definitions/database_configuration_model.adoc +++ b/modules/ROOT/pages/_partials/configuration/definitions/database_configuration_model.adoc @@ -89,11 +89,8 @@ This JavaScript filter function takes the document body as parameter and is expe { "databases": { "db": { - "server": "http://localhost:8091", "bucket": "default", - "password": "password", "import_docs": true, - "enable_shared_bucket_access": true, "import_filter": ` function(doc) { if (doc.type != "mobile") { @@ -191,25 +188,15 @@ Use this property, to set different cookie names for each database specified in [source,json] ---- { - "interface":":4984", - "log":["*"], "databases": { "db1": { - "session_cookie_name": "CustomName1", - "server": "http://localhost:8091", - "bucket": "bucket-1", - "users": { - "user_1": {"password":"1234"} + "session_cookie_name": "CustomName1" }, - "db2": { - "session_cookie_name": "CustomName2", - "server": "http://localhost:8091", - "bucket": "bucket-2", - "users": { - "adam_2": {"password":"5678"} - } + + "db2": { + "session_cookie_name": "CustomName2" + } - } } } @@ -706,16 +693,10 @@ The following configuration example enables delta sync. [source,json] ---- { - "logging": { - "console": { - "log_keys": ["*"] - } - }, "databases": { "db": { - "server": "http://localhost:8091", + "name": "dbname", "bucket": "default", - "users": { "GUEST": { "disabled": false, "admin_channels": ["*"] } }, "allow_conflicts": false, "revs_limit": 20, "delta_sync": { diff --git a/modules/ROOT/pages/authentication-certs.adoc b/modules/ROOT/pages/authentication-certs.adoc index b21ec2fd4..6ace21144 100644 --- a/modules/ROOT/pages/authentication-certs.adoc +++ b/modules/ROOT/pages/authentication-certs.adoc @@ -99,14 +99,10 @@ Then just add the `"SSLCert"` and `"SSLKey"` properties to your Sync Gateway con [source,javascript] ---- { + "SSLCert": "cert.pem", "SSLKey": "privkey.pem", - "databases": { - "todo": { - "server": "http://localhost:8091", - "users": {"GUEST": {"disabled": false, "admin_channels": ["*"]}} - } - } + } ---- diff --git a/modules/ROOT/pages/delta-sync.adoc b/modules/ROOT/pages/delta-sync.adoc index cd898180c..a808dcba6 100644 --- a/modules/ROOT/pages/delta-sync.adoc +++ b/modules/ROOT/pages/delta-sync.adoc @@ -40,16 +40,10 @@ You can enable delta-sync on a per-database basic in your Sync Gateway configura ---- // ... other configuration properties as appropriate { - "logging": { - "console": { - "log_keys": ["*"] - } - }, "databases": { "db": { - "server": "http://localhost:8091", + "name": "dbname", "bucket": "default", - "users": { "GUEST": { "disabled": false, "admin_channels": ["*"] } }, "allow_conflicts": false, "revs_limit": 20, "delta_sync": { diff --git a/modules/ROOT/pages/rest-api-client-app.adoc b/modules/ROOT/pages/rest-api-client-app.adoc index 42db08aca..110d96884 100644 --- a/modules/ROOT/pages/rest-api-client-app.adoc +++ b/modules/ROOT/pages/rest-api-client-app.adoc @@ -61,8 +61,8 @@ Follow the steps below to get Sync Gateway up and running. }, "databases": { "todo": { - "server": "http://localhost:8091", - "users": { "GUEST": {"disabled": false, "admin_channels": ["*"] } } + "name": "dbname", + "bucket": "dbname_bucket" } } } diff --git a/modules/ROOT/pages/sync-with-couchbase-server.adoc b/modules/ROOT/pages/sync-with-couchbase-server.adoc index f57f10855..1b14a6ddc 100644 --- a/modules/ROOT/pages/sync-with-couchbase-server.adoc +++ b/modules/ROOT/pages/sync-with-couchbase-server.adoc @@ -109,18 +109,13 @@ You can enable it without bringing down the entire Sync Gateway cluster -- see { "databases": { "db": { + "name": "dbname", "bucket": "my-bucket", - "username": "my-user", - "password": "my-password", - "server": "http://localhost:8091", - "enable_shared_bucket_access": true, // <.> - "import_docs": true <.> + "import_docs": true // <.> } } } ---- -<.> The `enable_shared_bucket_access` property is used to enable bucket-sharing. -It must be `_true_` on all nodes participating in such a configuration. <.> The `import_docs` property is used to specify that a Sync Gateway node participates (exclusively) in {xref-sgw-pg-import-process}. The mechanism by which Sync Gateway incorporates changes to data buckets it shares with Couchbase Server -- see: <>. ====