Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playground: Add CloudBeaver #115

Merged
merged 2 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ Playground

`docker exec -it kyuubi /opt/spark/bin/spark-shell`

4. Connect using DataGrip or DBeaver
4. Play with CloudBeaver

Open `http://localhost:8978` in browser, and login w/ admin authentication `kyuubi`/`kyuubi`.

5. Connect using DataGrip or DBeaver

Add a new Hive or Spark SQL or Kyuubi datasource with

Expand Down
19 changes: 19 additions & 0 deletions docker/compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,22 @@ services:
- metastore
- minio
- zookeeper

cloudbeaver:
image: pan3793/cloudbeaver:20220522
environment:
CB_LOCAL_HOST_ADDR: 0.0.0.0
CB_SERVER_NAME: Kyuubi Playground
CB_ADMIN_NAME: kyuubi
CB_ADMIN_PASSWORD: kyuubi
container_name: cloudbeaver
hostname: cloudbeaver
ports:
- 8978:8978
volumes:
- ./image/cloudbeaver-conf/cloudbeaver.conf:/opt/cloudbeaver/conf/cloudbeaver.conf
- ./image/cloudbeaver-conf/initial-data.conf:/opt/cloudbeaver/conf/initial-data.conf
- ./image/cloudbeaver-conf/initial-data-sources.conf:/opt/cloudbeaver/conf/initial-data-sources.conf
- ./image/cloudbeaver-conf/product.conf:/opt/cloudbeaver/conf/product.conf
depends_on:
- postgres
19 changes: 19 additions & 0 deletions docker/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,22 @@ services:
- metastore
- minio
- zookeeper

cloudbeaver:
image: pan3793/cloudbeaver:20220522
environment:
CB_LOCAL_HOST_ADDR: 0.0.0.0
CB_SERVER_NAME: Kyuubi Playground
CB_ADMIN_NAME: kyuubi
CB_ADMIN_PASSWORD: kyuubi
container_name: cloudbeaver
hostname: cloudbeaver
ports:
- 8978:8978
volumes:
- ./image/cloudbeaver-conf/cloudbeaver.conf:/opt/cloudbeaver/conf/cloudbeaver.conf
- ./image/cloudbeaver-conf/initial-data.conf:/opt/cloudbeaver/conf/initial-data.conf
- ./image/cloudbeaver-conf/initial-data-sources.conf:/opt/cloudbeaver/conf/initial-data-sources.conf
- ./image/cloudbeaver-conf/product.conf:/opt/cloudbeaver/conf/product.conf
depends_on:
- postgres
53 changes: 53 additions & 0 deletions docker/image/cloudbeaver-conf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
## Generate Admin Password MD5
```
CB_ADMIN_PASSWORD_MD5=`echo -n "$CB_ADMIN_PASSWORD" | md5sum | tr 'a-z' 'A-Z'`
CB_ADMIN_PASSWORD_MD5=${PASSWORD_MD5:0:32}
```

## Authenticate as Admin
```
curl 'http://0.0.0.0:8978/api/gql' \
-X POST \
-H 'content-type: application/json' \
--cookie-jar /tmp/cookie.txt \
--data '{
"query": "
query authLogin($provider: ID!, $credentials: Object!, $linkUser: Boolean) {
authToken: authLogin(
provider: $provider
credentials: $credentials
linkUser: $linkUser
) {
authProvider
}
}
",
"variables": {
"provider": "local",
"credentials": {
"user": "kyuubi",
"password": "4E212BBF8F138808DB96B969716D1580"
},
"linkUser": true
}
}'
```

## Expose Connection to Anonymous
```
curl 'http://0.0.0.0:8978/api/gql' \
-X POST \
-H 'content-type: application/json' \
--cookie /tmp/cookie.txt \
--data '{
"query": "
query setConnectionAccess($connectionId: ID!, $subjects: [ID!]!) {
setConnectionSubjectAccess(connectionId: $connectionId, subjects: $subjects)
}
",
"variables": {
"connectionId": "kyuubi_hive-180f13452e0-749c09a3cdb63869",
"subjects": ["user"]
}
}'
```
82 changes: 82 additions & 0 deletions docker/image/cloudbeaver-conf/cloudbeaver.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{
server: {
serverPort: 8978,

workspaceLocation: "workspace",
contentRoot: "web",
driversLocation: "drivers",

rootURI: "/",
serviceURI: "/api/",

productConfiguration: "conf/product.conf",

expireSessionAfterPeriod: 1800000,

develMode: false,

enableSecurityManager: false,

database: {
driver="h2_embedded",
url: "jdbc:h2:${workspace}/.data/cb.h2.dat",

createDatabase: true,

initialDataConfiguration: "conf/initial-data.conf",

pool: {
minIdleConnections: 1,
maxIdleConnections: 2,
maxConnections: 10,
validationQuery: "SELECT 1"
}
}

},
app: {
anonymousAccessEnabled: true,
anonymousUserRole: "user",
supportsCustomConnections: false,

publicCredentialsSaveEnabled: true,
adminCredentialsSaveEnabled: true,

resourceQuotas: {
dataExportFileSizeLimit: 10000000,
resourceManagerFileSizeLimit: 500000,
sqlMaxRunningQueries: 100,
sqlResultSetRowsLimit: 100000,
sqlResultSetMemoryLimit: 2000000,
sqlTextPreviewMaxLength: 4096,
sqlBinaryPreviewMaxLength: 261120
},

enabledAuthProviders: [
"local"
],

disabledDrivers: [
"sqlite:sqlite_jdbc",
"h2:h2_embedded",
"clickhouse:yandex_clickhouse",
"oracle:oracle_thin",
"db2:db2",
"generic:trino_jdbc",
"jaybird:jaybird",
"generic:derby_server",
"db2_i:db2_iseries"
]
}
}
29 changes: 29 additions & 0 deletions docker/image/cloudbeaver-conf/initial-data-sources.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{
"connections": {
"kyuubi_hive-180f13452e0-749c09a3cdb63869": {
"provider": "generic",
"driver": "kyuubi_hive",
"name": "Kyuubi on Spark",
"save-password": false,
"show-system-objects": true,
"read-only": false,
"configuration": {
"host": "kyuubi",
"port": "10009",
"url": "jdbc:hive2://kyuubi:10009",
"auth-model": "native"
}
}
}
}
27 changes: 27 additions & 0 deletions docker/image/cloudbeaver-conf/initial-data.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{
roles: [
{
roleId: "admin",
name: "Admin",
description: "Administrative access. Has all permissions.",
permissions: [ "public", "admin" ]
},
{
roleId: "user",
name: "User",
description: "Standard user",
permissions: [ "public" ]
}
]
}
39 changes: 39 additions & 0 deletions docker/image/cloudbeaver-conf/product.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{
core: {
user: {
defaultTheme: "light",
defaultLanguage: "en"
},
app: {
logViewer: {
refreshTimeout: 3000,
logBatchSize: 1000,
maxLogRecords: 2000,
maxFailedRequests: 3
}
},
authentication: {
primaryAuthProvider: 'local'
}
},
core_events: {
notificationsPool: 5
},
plugin_data_spreadsheet_new: {
hidden: false
},
plugin_data_export: {
disabled: false
}
}