Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Add Microsoft SQL Server support #130

Closed
wants to merge 7 commits into from
Closed

Conversation

RolandTa
Copy link

Add Microsoft SQL Server support based on changes from jgorin86/keycloak and additional feedback from pull-request #114

@Tomschi
Copy link

Tomschi commented Jul 20, 2018

I also need the Microsoft SQL Server support.

@stianst
Copy link
Contributor

stianst commented Aug 22, 2018

Thanks for the PR. I've only had a chance to have a brief look so far and all looks very good. I especially like the fact that you caught the breaking changes I just made and fix it almost instantaneously ;)

I will try to take a proper look next week so we can get this merged.

@sschu
Copy link
Contributor

sschu commented Sep 6, 2018

We are also interested in this as we are essentially doing the same thing in our custom image. As a side note, the current version is 7.0.0, see https://github.com/Microsoft/mssql-jdbc/releases. Not sure its necessary to take this, we are currently on 6.4.0 as well.

@@ -0,0 +1,9 @@
/subsystem=datasources/data-source=KeycloakDS: remove()
/subsystem=datasources/data-source=KeycloakDS: add(jndi-name=java:jboss/datasources/KeycloakDS,enabled=true,use-java-context=true,use-ccm=true, connection-url="jdbc:sqlserver://${env.DB_ADDR:mssql}:${env.DB_PORT:1433};databaseName=${env.DB_DATABASE:keycloak};integratedSecurity=false;user=${env.DB_USER:keycloak};password=${env.DB_PASSWORD:password};${env.JDBC_PARAMS:}", driver-name=sqlserver)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it make sense to also add "sendStringParametersAsUnicode=false"? We are using this and reduced the amount of deadlocks quite substantially on mass data imports, see Hyneks comment on https://issues.jboss.org/browse/KEYCLOAK-3210.

@@ -4,6 +4,7 @@ ENV KEYCLOAK_VERSION 4.3.0.Final
ENV JDBC_POSTGRES_VERSION 42.2.2
ENV JDBC_MYSQL_VERSION 5.1.46
ENV JDBC_MARIADB_VERSION 2.2.3
ENV JDBC_MSSQL_VERSION 6.4.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am not mistaken, downloading the JDBC driver needs to be added to build-keycloak.sh

@stianst
Copy link
Contributor

stianst commented Sep 7, 2018

Please update with latest changes to the image and add sendStringParametersAsUnicode=false. Once that's done I'll test it and merge.

@RolandTa
Copy link
Author

@stianst Pull Request includes now all recent changes and feedback from @sschu regarding mssql jdbc 7.0 / missing driver download and sendStringParamtersAsUnicode=false

@RolandTa RolandTa closed this Sep 11, 2018
@RolandTa RolandTa reopened this Sep 11, 2018
@stianst
Copy link
Contributor

stianst commented Sep 12, 2018

Changes looks good, but can you please rebase and squash into a single commit?

@stianst
Copy link
Contributor

stianst commented Sep 13, 2018

Tried this from steps in README and it doesn't work as the user and password are wrong. The db is also not created. Can someone update the README to include setting DB_USER/DB_PASSWORD and also get it to create the Keycloak database, or at least provide a docker exec command to do that prior to starting Keycloak?

Also, I need this squashed to a single commit, which is awkward to do since it has merge commits in there.

@michaeljmcd
Copy link

@stianst - looking at the SQL Server side of the house, it looks like the reason that the DB_USER/DB_PASSWORD setting and database autocreation aren't present is that the base MS SQL Server Docker image doesn't support them yet:

microsoft/mssql-docker#2

@stianst
Copy link
Contributor

stianst commented Oct 8, 2018

That's fine, we just need to make sure that the README covers those aspects and that the example on how to run it includes the steps needed to get it working. At this point I couldn't even with giving it a bit of a go get it running.

@michaeljmcd
Copy link

michaeljmcd commented Oct 8, 2018

Completely fair point. Attached is a Docker Compose file I used to get it up and running based on some of the POC work I was doing. There is an additional image - mssqlscripts - that will attempt to create the Keycloak database every five seconds until it succeeds (it terminates after success).

docker-compose.yml.txt

(local/keycloak-rolandta is how I tagged my build of this fork when I was testing locally).

@michaeljmcd
Copy link

@RolandTa, @sschu - I've been tinkering with this fork quite a bit for some POC work and I'd be happy to do any outstanding legwork (on a fork of a fork, if need be) to get this PR in a state where it can be merged. From what I gather, the open items are to clarify the examples / documentation and to squash the merge down to a single commit. Is this correct?

@RolandTa
Copy link
Author

@michaeljmcd - I'm glad if you can take over this PR, fell free to fork it if you have to. The open topics are as mentioned by you (clarify examples / documentation) and squash to a single commit. I'm currently on heavy workload, therefore I'm really happy if you can solve those open items and bring this topic further.

@abstractj
Copy link
Contributor

abstractj commented Nov 13, 2018

@RolandTa @michaeljmcd I'm closing this PR for now. But feel free to reopen or open a new one, when you think it's ready to go. Also, please make sure you have a JIRA for this if you reopen.

@abstractj abstractj closed this Nov 13, 2018
abstractj referenced this pull request Aug 14, 2019
image, comparable to the support in place for databases like H2 or
MySQL as per https://issues.jboss.org/browse/KEYCLOAK-9903.

This combines feedback from pull requests jboss-dockerfiles#114, jboss-dockerfiles#130 and is sourced from
RolandTa/keycloak for its basis.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants