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

Fixing DBeaver driver issues on T2+ SREs #1704

Merged
merged 16 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from 11 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
4 changes: 4 additions & 0 deletions .github/scripts/update_dbeaver_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@
output["postgis_geometry"] = postgis
output["postgis_jdbc"] = postgis

remote_page = requests.get("https://repo1.maven.org/maven2/com/github/waffle/waffle-jna/", allow_redirects=True)
root = html.fromstring(remote_page.content)
output["waffle_jna"] = natsorted([v for v in root.xpath("//a[contains(text(), '/')]/@href") if v != "../"])[-1].replace("/", "")
JimMadge marked this conversation as resolved.
Show resolved Hide resolved

with open("deployment/secure_research_desktop/packages/dbeaver-driver-versions.json", "w") as f_out:
f_out.writelines(json.dumps(output, indent=4, sort_keys=True))
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ runcmd:
- if [ "$(which azuredatastudio)" = "" ]; then echo "Could not install Azure Data Studio!"; exit 1; else echo "... successfully installed Azure Data Studio"; fi
# Install drivers from maven
- echo "Installing DBeaver drivers..."
- DBEAVER_DRIVER_DIR="/usr/share/dbeaver/drivers/maven/maven-central"
- DBEAVER_DRIVER_DIR="/usr/share/dbeaver-ce/drivers/maven/maven-central"
# Note that the filenames specified here have to be kept synchronised with the names in the dbeaver_drivers_config.xml file.
# Adding new drivers therefore involves changing both this file and the XML file.
- mkdir -p ${DBEAVER_DRIVER_DIR}/com.microsoft.sqlserver/
Expand All @@ -224,9 +224,9 @@ runcmd:
- wget -nv https://repo1.maven.org/maven2/net/postgis/postgis-jdbc/{{dbeaver.drivers.postgis_jdbc}}/postgis-jdbc-{{dbeaver.drivers.postgis_jdbc}}.pom -P ${DBEAVER_DRIVER_DIR}/net.postgis/
- wget -nv https://repo1.maven.org/maven2/net/postgis/postgis-geometry/{{dbeaver.drivers.postgis_geometry}}/postgis-geometry-{{dbeaver.drivers.postgis_geometry}}.jar -P ${DBEAVER_DRIVER_DIR}/net.postgis/
- wget -nv https://repo1.maven.org/maven2/net/postgis/postgis-geometry/{{dbeaver.drivers.postgis_geometry}}/postgis-geometry-{{dbeaver.drivers.postgis_geometry}}.pom -P ${DBEAVER_DRIVER_DIR}/net.postgis/
- mv /opt/build/dbeaver_drivers_config.xml /usr/share/dbeaver/drivers-config.xml
- echo "-Ddbeaver.drivers.configuration-file=/usr/share/dbeaver/drivers-config.xml" >> /usr/share/dbeaver/dbeaver.ini
- echo "-Djava.security.auth.login.config=/etc/jaas.conf" >> /usr/share/dbeaver/dbeaver.ini
- mv /opt/build/dbeaver_drivers_config.xml /usr/share/dbeaver-ce/drivers-config.xml
- echo "-Ddbeaver.drivers.configuration-file=/usr/share/dbeaver-ce/drivers-config.xml" >> /usr/share/dbeaver-ce/dbeaver.ini
- echo "-Djava.security.auth.login.config=/etc/jaas.conf" >> /usr/share/dbeaver-ce/dbeaver.ini
- ls -alh ${DBEAVER_DRIVER_DIR}/*
- echo "... successfully installed DBeaver drivers";
# Install RStudio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ runcmd:
- if [ "$(which azuredatastudio)" = "" ]; then echo "Could not install Azure Data Studio!"; exit 1; else echo "... successfully installed Azure Data Studio"; fi
# Install drivers from maven
- echo "Installing DBeaver drivers..."
- DBEAVER_DRIVER_DIR="/usr/share/dbeaver/drivers/maven/maven-central"
- DBEAVER_DRIVER_DIR="/usr/share/dbeaver-ce/drivers/maven/maven-central"
# Note that the filenames specified here have to be kept synchronised with the names in the dbeaver_drivers_config.xml file.
# Adding new drivers therefore involves changing both this file and the XML file.
- mkdir -p ${DBEAVER_DRIVER_DIR}/com.microsoft.sqlserver/
Expand All @@ -227,9 +227,12 @@ runcmd:
- wget -nv https://repo1.maven.org/maven2/net/postgis/postgis-jdbc/{{dbeaver.drivers.postgis_jdbc}}/postgis-jdbc-{{dbeaver.drivers.postgis_jdbc}}.pom -P ${DBEAVER_DRIVER_DIR}/net.postgis/
- wget -nv https://repo1.maven.org/maven2/net/postgis/postgis-geometry/{{dbeaver.drivers.postgis_geometry}}/postgis-geometry-{{dbeaver.drivers.postgis_geometry}}.jar -P ${DBEAVER_DRIVER_DIR}/net.postgis/
- wget -nv https://repo1.maven.org/maven2/net/postgis/postgis-geometry/{{dbeaver.drivers.postgis_geometry}}/postgis-geometry-{{dbeaver.drivers.postgis_geometry}}.pom -P ${DBEAVER_DRIVER_DIR}/net.postgis/
- mv /opt/build/dbeaver_drivers_config.xml /usr/share/dbeaver/drivers-config.xml
- echo "-Ddbeaver.drivers.configuration-file=/usr/share/dbeaver/drivers-config.xml" >> /usr/share/dbeaver/dbeaver.ini
- echo "-Djava.security.auth.login.config=/etc/jaas.conf" >> /usr/share/dbeaver/dbeaver.ini
- mkdir -p ${DBEAVER_DRIVER_DIR}/com.github.waffle/
- wget -nv https://repo1.maven.org/maven2/com/github/waffle/waffle-jna/{{dbeaver.drivers.waffle_jna}}/waffle-jna-{{dbeaver.drivers.waffle_jna}}.jar -P ${DBEAVER_DRIVER_DIR}/com.github.waffle/
- wget -nv https://repo1.maven.org/maven2/com/github/waffle/waffle-jna/{{dbeaver.drivers.waffle_jna}}/waffle-jna-{{dbeaver.drivers.waffle_jna}}.pom -P ${DBEAVER_DRIVER_DIR}/com.github.waffle/
craddm marked this conversation as resolved.
Show resolved Hide resolved
- mv /opt/build/dbeaver_drivers_config.xml /usr/share/dbeaver-ce/drivers-config.xml
- echo "-Ddbeaver.drivers.configuration-file=/usr/share/dbeaver-ce/drivers-config.xml" >> /usr/share/dbeaver-ce/dbeaver.ini
- echo "-Djava.security.auth.login.config=/etc/jaas.conf" >> /usr/share/dbeaver-ce/dbeaver.ini
- ls -alh ${DBEAVER_DRIVER_DIR}/*
- echo "... successfully installed DBeaver drivers";
# Install RStudio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ runcmd:
- if [ "$(which azuredatastudio)" = "" ]; then echo "Could not install Azure Data Studio!"; exit 1; else echo "... successfully installed Azure Data Studio"; fi
# Install drivers from maven
- echo "Installing DBeaver drivers..."
- DBEAVER_DRIVER_DIR="/usr/share/dbeaver/drivers/maven/maven-central"
- DBEAVER_DRIVER_DIR="/usr/share/dbeaver-ce/drivers/maven/maven-central"
# Note that the filenames specified here have to be kept synchronised with the names in the dbeaver_drivers_config.xml file.
# Adding new drivers therefore involves changing both this file and the XML file.
- mkdir -p ${DBEAVER_DRIVER_DIR}/com.microsoft.sqlserver/
Expand All @@ -233,9 +233,9 @@ runcmd:
- wget -nv https://repo1.maven.org/maven2/net/postgis/postgis-jdbc/{{dbeaver.drivers.postgis_jdbc}}/postgis-jdbc-{{dbeaver.drivers.postgis_jdbc}}.pom -P ${DBEAVER_DRIVER_DIR}/net.postgis/
- wget -nv https://repo1.maven.org/maven2/net/postgis/postgis-geometry/{{dbeaver.drivers.postgis_geometry}}/postgis-geometry-{{dbeaver.drivers.postgis_geometry}}.jar -P ${DBEAVER_DRIVER_DIR}/net.postgis/
- wget -nv https://repo1.maven.org/maven2/net/postgis/postgis-geometry/{{dbeaver.drivers.postgis_geometry}}/postgis-geometry-{{dbeaver.drivers.postgis_geometry}}.pom -P ${DBEAVER_DRIVER_DIR}/net.postgis/
- mv /opt/build/dbeaver_drivers_config.xml /usr/share/dbeaver/drivers-config.xml
- echo "-Ddbeaver.drivers.configuration-file=/usr/share/dbeaver/drivers-config.xml" >> /usr/share/dbeaver/dbeaver.ini
- echo "-Djava.security.auth.login.config=/etc/jaas.conf" >> /usr/share/dbeaver/dbeaver.ini
- mv /opt/build/dbeaver_drivers_config.xml /usr/share/dbeaver-ce/drivers-config.xml
- echo "-Ddbeaver.drivers.configuration-file=/usr/share/dbeaver-ce/drivers-config.xml" >> /usr/share/dbeaver-ce/dbeaver.ini
- echo "-Djava.security.auth.login.config=/etc/jaas.conf" >> /usr/share/dbeaver-ce/dbeaver.ini
- ls -alh ${DBEAVER_DRIVER_DIR}/*
- echo "... successfully installed DBeaver drivers";
# Install RStudio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@
<provider id="sqlserver">
<driver id="microsoft" category="MS SQL Server" categories="sql" custom="false" embedded="false" name="SQL Server" class="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://{host}[:{port}][;databaseName={database}]" port="1433" description="Microsoft JDBC Driver for SQL Server (MSSQL)">
<library type="jar" path="maven:/com.microsoft.sqlserver:mssql-jdbc:RELEASE" custom="false" version="{{dbeaver.drivers.mssql_jdbc}}">
<file id="com.microsoft.sqlserver:mssql-jdbc" version="{{dbeaver.drivers.mssql_jdbc}}" path="/usr/share/dbeaver/drivers/maven/maven-central/com.microsoft.sqlserver/mssql-jdbc-{{dbeaver.drivers.mssql_jdbc}}.jar"/>
<file id="com.microsoft.sqlserver:mssql-jdbc" version="{{dbeaver.drivers.mssql_jdbc}}" path="/usr/share/dbeaver-ce/drivers/maven/maven-central/com.microsoft.sqlserver/mssql-jdbc-{{dbeaver.drivers.mssql_jdbc}}.jar"/>
</library>
</driver>
</provider>
<provider id="postgresql">
<driver id="postgres-jdbc" categories="sql" custom="false" embedded="false" name="PostgreSQL" class="org.postgresql.Driver" url="jdbc:postgresql://{host}[:{port}]/[{database}]" port="5432" description="PostgreSQL standard driver">
<library type="jar" path="maven:/org.postgresql:postgresql:RELEASE" custom="false" version="{{dbeaver.drivers.postgresl}}">
<file id="org.postgresql:postgresql" version="{{dbeaver.drivers.postgresl}}" path="/usr/share/dbeaver/drivers/maven/maven-central/org.postgresql/postgresql-{{dbeaver.drivers.postgresl}}.jar"/>
<library type="jar" path="maven:/org.postgresql:postgresql:RELEASE" custom="false" version="{{dbeaver.drivers.postgresql}}">
<file id="org.postgresql:postgresql" version="{{dbeaver.drivers.postgresql}}" path="/usr/share/dbeaver-ce/drivers/maven/maven-central/org.postgresql/postgresql-{{dbeaver.drivers.postgresql}}.jar"/>
</library>
<library type="jar" path="maven:/net.postgis:postgis-jdbc:RELEASE" custom="false" version="{{dbeaver.drivers.postgis_jdbc}}">
<file id="net.postgis:postgis-jdbc" version="{{dbeaver.drivers.postgis_jdbc}}" path="/usr/share/dbeaver/drivers/maven/maven-central/net.postgis/postgis-jdbc-{{dbeaver.drivers.postgis_jdbc}}.jar"/>
<file id="net.postgis:postgis-jdbc" version="{{dbeaver.drivers.postgis_jdbc}}" path="/usr/share/dbeaver-ce/drivers/maven/maven-central/net.postgis/postgis-jdbc-{{dbeaver.drivers.postgis_jdbc}}.jar"/>
</library>
<library type="jar" path="maven:/net.postgis:postgis-geometry:RELEASE" custom="false" version="{{dbeaver.drivers.postgis_geometry}}">
<file id="net.postgis:postgis-geometry" version="{{dbeaver.drivers.postgis_geometry}}" path="/usr/share/dbeaver/drivers/maven/maven-central/net.postgis/postgis-geometry-{{dbeaver.drivers.postgis_geometry}}.jar"/>
<file id="net.postgis:postgis-geometry" version="{{dbeaver.drivers.postgis_geometry}}" path="/usr/share/dbeaver-ce/drivers/maven/maven-central/net.postgis/postgis-geometry-{{dbeaver.drivers.postgis_geometry}}.jar"/>
</library>
<library type="jar" path="maven:/com.github.waffle:waffle-jna:RELEASE" custom="false" version="{{dbeaver.drivers.waffle_jna}}">
<file id="com.github.waffle:waffle-jna" version="{{dbeaver.drivers.waffle_jna}}" path="/usr/share/dbeaver-ce/drivers/maven/maven-central/com.github.waffle/waffle-jna-{{dbeaver.drivers.waffle_jna}}.jar"/>
</library>
</driver>
</provider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"pgjdbc": "1.1.6",
"postgis_geometry": "2023.1.0",
"postgis_jdbc": "2023.1.0",
"postgresql": "42.7.1"
"postgresql": "42.7.1",
"waffle_jna": "3.3.0"
}
24 changes: 24 additions & 0 deletions docs/source/roles/researcher/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,18 @@ Our example user Ada Lovelace, working in the `sandbox` SRE on the `projects.tur
Be sure to select `Kerberos authentication` so that your username and password will be passed through to the database
```

````{note}
After clicking finish, you may be prompted to download missing driver files.
Drivers have already been provided on the SRD for Microsoft SQL databases.
Clicking `Download` will make DBeaver use these pre-downloaded drivers without requiring internet access.
Thus, even on SRDs with no external internet access (Tier 2 or above), click `Download`.
Note that the prompt may appear multiple times.
```{image} user_guide/db_dbeaver_mssql_download.png
:alt: DBeaver driver download for Microsoft SQL
:align: center
```
````

#### PostgreSQL

- Select `PostgreSQL` as the database type
Expand All @@ -1028,6 +1040,18 @@ If you are prompted for `Username` or `Password` when connecting, you can leave
```
````

````{note}
After clicking finish, you may be prompted to download missing driver files.
Drivers have already been provided on the SRD for PostgreSQL databases.
Clicking `Download` will make DBeaver use these pre-downloaded drivers without requiring internet access.
Thus, even on SRDs with no external internet access (Tier 2 or above), click `Download`.
Note that the prompt may appear multiple times.
```{image} user_guide/db_dbeaver_pstgrs_download.png
:alt: DBeaver driver download for Microsoft SQL
:align: center
```
````

### {{snake}} Connecting using Python

Database connections can be made using `pyodbc` or `psycopg2` depending on which database flavour is being used.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion environment_configs/sre_bluet1guac_core_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"outboundInternetAccess": "default",
"computeVmImage": {
"type": "Ubuntu",
"version": "20.04.2023082900"
"version": "20.04.2024011200"
},
"remoteDesktopProvider": "ApacheGuacamole",
"dataAdminIpAddresses": ["193.60.220.253"],
Expand Down
2 changes: 1 addition & 1 deletion environment_configs/sre_bluet2guac_core_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"outboundInternetAccess": "default",
"computeVmImage": {
"type": "Ubuntu",
"version": "20.04.2023082900"
"version": "20.04.2024011200"
},
"remoteDesktopProvider": "ApacheGuacamole",
"dataAdminIpAddresses": ["193.60.220.253"],
Expand Down
2 changes: 1 addition & 1 deletion environment_configs/sre_bluet3guac_core_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"outboundInternetAccess": "default",
"computeVmImage": {
"type": "Ubuntu",
"version": "20.04.2023082900"
"version": "20.04.2024011200"
},
"remoteDesktopProvider": "ApacheGuacamole",
"dataAdminIpAddresses": ["193.60.220.240"],
Expand Down
2 changes: 1 addition & 1 deletion environment_configs/sre_greent1guac_core_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"outboundInternetAccess": "default",
"computeVmImage": {
"type": "Ubuntu",
"version": "20.04.2023082900"
"version": "20.04.2024011200"
},
"remoteDesktopProvider": "ApacheGuacamole",
"dataAdminIpAddresses": ["193.60.220.253"],
Expand Down
2 changes: 1 addition & 1 deletion environment_configs/sre_greent2guac_core_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"outboundInternetAccess": "default",
"computeVmImage": {
"type": "Ubuntu",
"version": "20.04.2023082900"
"version": "20.04.2024011200"
},
"remoteDesktopProvider": "ApacheGuacamole",
"dataAdminIpAddresses": ["193.60.220.253"],
Expand Down
2 changes: 1 addition & 1 deletion environment_configs/sre_greent3guac_core_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"outboundInternetAccess": "default",
"computeVmImage": {
"type": "Ubuntu",
"version": "20.04.2023082900"
"version": "20.04.2024011200"
},
"remoteDesktopProvider": "ApacheGuacamole",
"dataAdminIpAddresses": ["193.60.220.240"],
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/sre_bluet1guac_full_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@
"rg": "RG_SHM_BLUE_SRE_T1GUAC_COMPUTE",
"vmImage": {
"type": "Ubuntu",
"version": "20.04.2023082900"
"version": "20.04.2024011200"
},
"vmSizeDefault": "Standard_D2s_v3"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/sre_bluet3guac_full_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@
"rg": "RG_SHM_BLUE_SRE_T3GUAC_COMPUTE",
"vmImage": {
"type": "Ubuntu",
"version": "20.04.2023082900"
"version": "20.04.2024011200"
},
"vmSizeDefault": "Standard_D2s_v3"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/sre_greent2guac_full_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,7 @@
"rg": "RG_SHM_GREEN_SRE_T2GUAC_COMPUTE",
"vmImage": {
"type": "Ubuntu",
"version": "20.04.2023082900"
"version": "20.04.2024011200"
},
"vmSizeDefault": "Standard_D2s_v3"
},
Expand Down
Loading