Closed laurent-perrin closed 1 year ago
@laurent-perrin thank you for reporting - we are going to fix this issue.
@laurent-perrin Hi!
The problem is in your administrator's username. admin
is used as one of default teams, and user and team names cannot overlap. Please try to change CB_ADMIN_NAME
value
It's been a while since the last update here. I hope this solution worked for you. Please let me know if you have any futher questions.
I am using Cloudbeaver version 23.3.4 on a Linux Ubuntu version 22.04.3 and facing the same issue. I have tried adding environment variables in the docker compose file directly as the following shows:
`environment:
`volumes:
# - ./cbeaver.conf:/opt/cloudbeaver/conf/cloudbeaver.conf
- ./cbeaver_config.conf:/opt/cloudbeaver/workspace/.data/.cloudbeaver.runtime.conf
- ./cbeaver_data.conf:/opt/cloudbeaver/conf/initial-data.conf
- ./cbeaver_data_sources.json:/opt/cloudbeaver/workspace/GlobalConfiguration/.dbeaver/data-sources.json`
I tried following the documentation by creating a volume for the .cloudbeaver.auto.conf
and placing it in the same directory as cloudbeaver.conf
, tried using environment variables in the shape of adminName: ${CB_ADMIN_NAME}
and tried as a last resort doing ${CB_ADMIN_NAME:cbadmin}
.
Is there a bug where cloudbeaver isn't allowing the usage of environment variables in the config files? I want to use them to save my database credentials as well if that is possible.
Hi @JMarji3! To skip easy-config and configure admin credentials you should specify all 4 variables (all of them are required)
CB_SERVER_NAME
CB_SERVER_URL
CB_ADMIN_NAME
CB_ADMIN_PASSWORD
And you can preconfigure connections in data-sources.json
. It looks like that
"postgres-jdbc": {
"provider": "postgresql",
"driver": "postgres-jdbc",
"name": "PostgreSQL@localhost",
"save-password": true,
"configuration": {
"host": "localhost",
"port": "5432",
"database": "postgres",
"url": "jdbc:postgresql://localhost:5432/postgres",
"configurationType": "MANUAL",
"type": "dev",
"auth-model": "native",
"auth-properties": {
"userPassword": "!Passw0rd",
"userName": "db_username"
}
}
}
}
But, please, take in mind that we do not recommend to store credentials as plain text. We have added a feature: after saving the connection settings for the first time via UI (Save button), credentials will be removed from the configuration file. They will be encrypted, you will still be able to use them.
@EvgeniaBzzz I need to specify all the variables in the environment, then in the initial-data.config
specify adminName:${CB_ADMIN_NAME}
(and do it for the rest of the variables) and it should work?
Also, I want to avoid adding the database credentials as plain text in the json file, but when I recreate the container, I have to re-enter the username and password, I have even resorted to trying to copy the file with the encryptions as another volume, but that didn't work as well (I want to deploy cloudbeaver to kubernetes and therefor testing what happens when the pod or container is destroyed and how can we avoid all manual configurations). Is it possible to also replace these credentials with variables or is it not supported?
Edit: I am using a clickhouse database.
Edit 2: After testing again, I noticed that the variables CB_SERVER_NAME
and CB_SERVER_URL
work, but the admin variables don't (in the login page I have to enter the username as ${CB_ADMIN_NAME} and the password ${CB_ADMIN_PASSWORD} to be able to login).
And you can preconfigure connections in
data-sources.json
. It looks like that
Hi, @EvgeniaBzzz. I didn't get your answer. You said we have to set these environment variables, and then you add their values in data-sources.json
? It is confusing to me.
What I would like to do is the same as @JMarji3, to use env vars to set my database credentials, and make reference to them as in the documentation:
{
server: {
serverPort: ${cb.port},
serverHost: "${cb.host}",
serverName: "CloudBeaver Server",
rootURI: "${cb.prefix}",
serviceURI: "/api/",
expireSessionAfterPeriod: ${cb.expire-time},
}
}
But I could not find a way to reference them as variables. If the documented substitution works, what should be their values? ${cb.port}
seems to follow some different naming convention than serverPort
, for instance.
@JMarji3 @everton137 I realized what the misunderstanding was.
CB_SERVER_NAME=...
CB_SERVER_URL=...
CB_ADMIN_NAME=...
CB_ADMIN_PASSWORD=...
All 4 variables are required.
Internal database credentials could be set in .cloudbeaver.conf. Here you can use env variables.
data-sources.json
contains existing connections info, you do not need to specify your database credentials there.
Keep in mind that .cloudbeaver.runtime.conf has higher priority than .cloudbeaver.auto.conf
and .cloudbeaver.conf
. So you should also change runtime conf in appropriate way.
I hope everything is clear now.
@EvgeniaBzzz The environment variables worked in the cloudbeaver.conf
file, now I am trying to add the internal database credentials as well by changing driver to clickhouse and url to the necessary one as well as adding user and password (as stated in the documentation under server.database
). Unfortunately that did not work for me, I even tried to make sure that the .cloudbeaver.runtime.conf
was similar to cloudbeaver.conf
in server.database
.
Can you provide an example on how to integrate the internal database credentials to the files?
Should I add the same changes made to cloudbeaver.conf
to match .cloudbeaver.runtime.conf
or are only specific changes needed to be similar in both files?
If I change the values of the credentials (user and password) to environment variables, will it be required to hard code these values to .cloudbeaver.runtime.conf
since it doesn't accept environment variables?
Here is an example. You can add this to runtime or to root config.
database: {
driver: "${CLOUDBEAVER_DB_DRIVER:postgres-jdbc}",
url: "${CLOUDBEAVER_DB_URL:jdbc:postgresql://postgres:5432/cloudbeaver}",
user: "${CLOUDBEAVER_DB_USER:postgres}",
password: "${CLOUDBEAVER_DB_PASSWORD:postgres}"
},
Only similar variables should have equal values. You don't need to add extra parameters to runtime.
You can use env variables in .cloudbeaver.runtime.conf
Please, describe your question in details. I'm trying to use the environment variables described in documentation to configure admin and server name with docker.
I run this command with an empty directory for the docker volume:
docker run --name cloudbeaver --rm -ti -p 9080:8978 -e CB_SERVER_NAME=test -e CB_ADMIN_NAME=admin -e CB_ADMIN_PASSWORD=admin -v /tmp/testcloudbeaver:/opt/cloudbeaver/workspace dbeaver/cloudbeaver
But when I connect to the webui, I got the setup phase and admin username and password seem to not be set. Did I miss something when I start my docker container ?