Gluu Server with Couchbase#
Overview#
Gluu Server 4.0 and onward supports Couchbase Enterprise Edition (EE) as a database backend. Couchbase can be used as an alternative to LDAP, or in addition to LDAP using "hybrid" mode (as documented below).
Attention
Couchbase Community Edition (CE) is not supported. Please use Couchbase Enterprise Edition (EE) for all deployments.
Installation#
There are three supported deployment strategies:
-
Local Couchbase installation for community edition Gluu, where both Gluu and Couchbase reside on the same server. OK for basic testing.
-
Remote VM Couchbase installation for community edition Gluu, where Couchbase is on its own dedicated servers. Recommended for performance testing. Required for production.
-
Kubernetes Couchbase installation, where Couchbase is installed on a kubernetes cluster in its own namespace. Recommended for performance testing. Required for production.
Pre-requirements#
- A production-grade clustered deployment of Couchbase requires at least three dedicated nodes.
Local installation#
To install a Gluu Server with a local instance of Couchbase:
- Prepare a VM with 16GB of RAM, 4 CPU cores, and 40 GB of disk space.
- Install the Gluu Server 4.0 packages, don't run
setup.py
yet. - Start the
gluu-server
service and log in to the Gluu Server chroot - Download your preferred Couchbase package and save it inside your Gluu Server chroot to
/opt/dist/couchbase
. - Run
setup.py
to configure the Gluu Server. -
When prompted to choose a backend, select Option 2 for Couchbase:
Install (1) Gluu OpenDj (2) Couchbase (3) Hybrid [1|2|3]
Remote installation#
To leverage a remote Couchbase cluster, follow these instructions.
Install and configure Couchbase#
- Install Couchbase. Read the docs
Attention
A production-grade clustered deployment of Couchbase requires at least three dedicated nodes.
- Modify firewalls according to Couchbase requirements. Read the docs
-
Configure your Couchbase deployment. Here are couple of screenshots attached from our test setup.
Install and configure Gluu on VM#
- Install Gluu Server 4.0, but do not run
setup.py
yet. -
After package installation, run these commands:
```tab="Ubuntu 18, RHEL 7, Debian 9, or CentOS 7" /sbin/gluu-serverd enable
/sbin/gluu-serverd start
/sbin/gluu-serverd login
cd /install/community-edition-setup/
python setup.py --remote-couchbase
```tab="Ubuntu 16" service gluu-server start service gluu-server login cd /install/community-edition-setup/ ./setup.py --remote-couchbase
-
The setup script will add some Couchbase-specific fields to the normal setup script prompts:
- Couchbase hosts: Enter the IP address or hostname for your Couchbase nodes. One is required. Three is recommended. Separate entries with commas, e.g.
node1.example.com,node2.example.com,node3.example.com
- Couchbase Admin user: The Admin username to log in to Couchbase
- Couchbase Admin password: The password to log in to Couchbase - this is also set to be the oxTrust admin password
- Use hybrid backends: If you'd like to leverage a "hybrid" backend with Couchbase and OpenDJ, select
yes
- Couchbase hosts: Enter the IP address or hostname for your Couchbase nodes. One is required. Three is recommended. Separate entries with commas, e.g.
Kubernetes Installation#
Attention
Only installation of Couchbase on AWS EKS cluster installation is currently supported with Gluu.
Requirments#
- A minimum of 3 m5.xlarge nodes on an EKS cluster.
Install and configure Couchbase and Gluu#
-
Get the source code:
tab="Ubuntu 18, RHEL 7, Debian 9, or CentOS 7" wget -q https://github.com/GluuFederation/enterprise-edition/archive/4.0.0.zip unzip 4.0.0.zip cd enterprise-edition-4.0.0/examples/kubernetes
-
Install couchbase enterprise kubernetes , choose the kuberentes tab , linux distribution and place the tar.gz file inside the same directory as the
enterprise-edition-4.0.0/examples/kubernetes/create.sh
. -
Please modify the file
enterprise-edition-4.0.0/examples/kubernetes/couchbase/couchbase-cluster.yaml
to fit your instituional needs. Currently the file is setup with an example setup of a total of 6 nodes as seen inspec.servers
. Each set of services is replicating in two different zones. According to your setup these zones might be different and hence should be changed. Do not change the labels of these services such ascouchbase_services: index
the setup requires these labels to track the status of the couchbase setup.Do not change the buckets as they are required for Gluu setup. More information on the properties of this file is found here.
Attention
Please note the enterprise-edition-4.0.0/examples/kubernetes/couchbase/couchbase-cluster.yaml
file must include at least three defined spec.servers
with the labels couchbase_services: index
, couchbase_services: data
and couchbase_services: analytics
If you wish to get started fast just change the values of spec.servers.name
and spec.servers.serverGroups
inside couchbase/couchbase-cluster.yaml
to the zones of your EKS nodes and continue.
-
Run
bash create.sh
and follow the prompts to install couchbase soley with Gluu. -
The
enterprise-edition-4.0.0/examples/kubernetes/couchbase/couchbase-cluster.yaml
file has a property calledexposedFeatureServiceType
set in our file toNodePort
. This can be changed to deploy aLoadbalancer
but requires adns
value to be added toenterprise-edition-4.0.0/examples/kubernetes/couchbase/couchbase-cluster.yaml
. -
To access the couchbase ui please follow these instructions.
Hybrid backend#
If both Couchbase and OpenDJ are goingto be installed, during setup you can choose Option 2 to support a "hybrid" backend database infrastructure for your Gluu Server:
tab="Ubuntu 18, RHEL 7, Debian 9, or CentOS 7"
|-----------------------------------------------------------------|
| Persistence layer |
|-----------------------------------------------------------------|
| [0] WrenDS [default] |
| [1] Couchbase [Testing Phase] |
| [2] Hybrid(WrenDS + Couchbase)[Testing Phase] |
|-----------------------------------------------------------------|
### Test
- Test WebUI login
- A successful Couchbase bucket will look like this:
![image](./img/CB_remote_successful_bucket.PNG)
- Check if all Gluu Server bits are running properly or not ( identity/oxauth/idp/httpd etc. )
- Check logs for any error.
## Hybrid backend
If both Couchbase and OpenDJ are installed (either locally or remote), during setup you can choose Option 3 to support a "hybrid" backend database infrastructure for your Gluu Server:
Both OpenDJ and Couchbase will be used for storing data. Default data is persisted in OpenDJ, e.g. system configurations, attributes, clients, metrics, etc., while all other data will be stored in Couchbase.
## Data Structure
### Buckets
By default, the following buckets will be created. If using a hybrid backend, buckets that are unused because their data is stored in LDAP will not be created.
#### gluu
This is the default bucket for the Gluu Server, the following documents will be imported to this bucket:
- Gluu base settings, oxAuth, oxTrust and configurations for other services
- scopes
- scripts
- SCIM/SAML/Passport/RADIUS related documents
- clients
- metric (statistic) documents will be inserted to this bucket
#### gluu_cache
This bucket is used to cache data for easier lookup, rather than searching the database again. The data is accessed with key/value.
This bucket is only used with the NATIVE_PERSISTANCE cache type.
Here is a sample entry:
#### gluu_site
If you use Cache Refresh, data from the remote database will be imported to this bucket.
#### gluu_token
This bucket is used to store tokens issued for the RP. The following is an example:
#### gluu_user
Users and groups will go to this bucket. By default, the `admin` user and `admin` group are created at setup.
### Indexes
Indexes are created according to this JSON: [index.json](https://github.com/GluuFederation/community-edition-setup/blob/master/static/couchbase/index.json)
`setup.py` creates two types of indexes in buckets:
#### Indexes for attributes
Gluu services use attributes to find the intended documents, so `setup.py` creates indexes for certain attributes. For example, for the **gluu_user** bucket, the following index is created for the **inum** attribute:
The index name is formed by joining the bucket name and attribute name with an underscore. (e.g. `gluu_user_inum`).
#### Static Indexes
For faster retrieval of documents, `setup.py` also creates static indexes if necessary. For example, we have this entry in the **gluu** bucket:
For this entry the following index is created:
The index name is "<bucket_name>_st_#
" where #
is a consecutive number.
SCIM Considerations#
Please be aware of the following behaviors that developers should account for when executing SCIM searches with Couchbase as the DB:
-
Non-deterministic order of results: When
sortBy
is not specified, a query can return a different permutation of valid results each time the search is executed. -
Search filters should not contain backslash characters in comparison values: This is a Couchbase issue. N1QL queries with backslashes can lead to unexpected results or even runtime errors. An example is the filter
name.familyName co "\"
. -
Case sensitivity: In LDAP, searching and sorting is case sensitive by default. In Couchbase, the behavior is case sensitive with the exception of equality/inequality filters like
userName eq "JhonHoney"
oruserType ne "Employee"
. Remember that case only matters for attributes of type string. This applies for both core and custom attributes. -
Operators (
le
,lt
,gt
,ge
,co
,ew
,sw
,eq
) are not applicable for attributes with more than one value. When used, no results will be returned. For example, users with more than one telephone number will not be returned when usingphoneNumbers.value sw "555"
, even if one or more of their phones start with "555".
License#
Couchbase Enterprise Edition is commercially licensed software. Gluu's code to integrate Couchbase EE as a backend for the Gluu Server is made available under the Apache License 2.0.