I'm using a docker image of keycloak and trying to connect to SQL Server.
I have the database "keycloak" created in the database and here's my DockerFile
FROM quay.io/keycloak/keycloak:18.0.0
ENV KEYCLOAK_ADMIN=admin
ENV KEYCLOAK_ADMIN_PASSWORD=admin
ENTRYPOINT ["/opt/keycloak/bin/kc.sh", "start", "--hostname-strict=false", "--auto-build", "--proxy=edge", "--db=mssql", "--db-url-host=***", "--db-username=***", "--db-password=***"]
When I build and run this, the tables get automatically created in the 'keycloak' database. However, after waiting for keycloak to run, it crashes in the cmd and I get errors like
Violation of UNIQUE KEY constraint 'UK_CLI_SCOPE'. Cannot insert duplicate key in object 'dbo.CLIENT_SCOPE'
I fixed this error but I still get more endless errors and it never seemed to work. Last error I got was
Cannot start server in developlment/production mode
Any idea why this is happening? Am I missing anything in the docker file? Any idea if keycloak actually works with SQL Server?
Thanks!
Related
I am using docker containers bitnami/postgresql-repmgr:13.3.0-debian-10-r22 in order to enable automatic failover for PostgreSql (I have 2 containers on 2 servers, one is the primary, the other a standby).
Our application (using springboot) is using this connection string for the Postgres replication:
postgres.host=xx.xx.x.140
postgres.port=1054
postgres.cluster=[xx.xx.x.140:5433 (http://xx.xx.x.140:5433)],[xx.xx.x.97:5433(http://xx.xx.x.97:5433)]
In case the Primary (140) fails, and repmgr will make 97 the primary, the application will try to connect to 140, will fail, and so will try the next string in the connection string, and will connect successfully to the new primary 97.
However, when I start the failed primary as standby, the application can connect to it, and does so, but returns errors on "read only".
I was thinking of using pgbouncer to overcome this problem, but I am not sure how and if it can be integrated into the repmgr container.
Anyone tried this combination?
Thanks
I am trying very simply to download MS SQL Server to my Mac using Docker.
As I was following a video, I reached a road block because my password was too short and Docker exits the program. (I received the error below). Can you please advise on how to change my password using the terminal or elsewhere?
ERROR: Unable to set system administrator password: Password validation failed. The password does not meet SQL Server password policy requirements because it is too short.
The container only accepts SQL auth and you've locked yourself out by making SQL auth impossible for the only SQL auth account that exists. Kind of a catch-22 because you can't log in to make your password long enough so that you can log in. I wish docker recognized this when you first fire up the run command instead of when it is too late, but this is where we are.
While it may be possible to hack into mssql-conf or the mssql-server service to change the password, honestly, the easiest thing for you to do is to start over with a new container. The nice thing about containers is that this is exactly what they're designed for. Run this:
docker ps
This will list the containers you have created; the one in question might be named something like a5de64..., so then just do:
docker stop a5
docker rm a5
Then create a new container with a password that is both long enough and strong enough:
docker run ... -e SA_PASSWORD=d0_n0t_be_l#zy_h3r3 ... mcr.microsoft...
I'm using EF Core in a small test application and I'm trying to create the database in SQL Server 2014 Express. Initially I used Update-Database script to create it and I didn't have any issues but when I tried to do this at runtime with dbContext.Database.EnsureCreated(), it no longer worked. I have checked the credentials for the SQL user multiple times and I'm sure that both approaches use the same. If I use the Update-Database script first, then all the queries work successfully in runtime using the same credentials.
Any idea what I might be missing here?
I need to test a web application.So I copied the database file and connected to the dulicate databse on different sql server.. The application is running fine when I connected to the live database but when I connected to the duplicate database on my server.. it is throwing entity command execution exception. I changed the connection string details in the webapp( source,username, pwd) and also connected in vs. Did I miss anything(in connecting to database file) ? I searched a lot.. but couldn't figure out.. what was it I am doing wrong which throws exception ? I made it run once, but it didn't work again after please throw some light on how could I approach it...?
I am trying to deploy a Asp.NET MVC 4 app to a third-party host, and encountered some problems while following this tutorial.
The tutorial created 2 New SQL Server Database, and set the Remote connection string of DefaultConnection to one SQLExpress database and that of SchoolContext to another. However, I want to have only one database, so I only created one New SQL Server Database, and used the same connection string for DefaultConnection AND MyAppContext. Would this cause problem?
Right now my app won't publish with the following error. not sure if it stems from this. MyAppUsr comes from a Grant script, Grant.sql, that I developed from this tutorial.
Error 3 Web deployment task failed. (An error occurred during execution of the database script. The error occurred between the following lines of the script: "8" and "11". The verbose log might have more information about the error. The command started with the following:
"CREATE USER [MyAppUsr] "
The login already has an account under a different user name. http://go.microsoft.com/fwlink/?LinkId=178587 Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_SQL_EXECUTION_FAILURE.) 0 0 MvcCP
MyAppContext uses LocalDb instead of SQLExpress. The deployment in the tutorial uses SQLExpress. Can I just create a new SQLExpress database and have MyAppContext (LocalDb) "points to" the SQLExpress database?
You must have run the script at least once prior, correct? Because what it is saying is that the user [MyAppUsr] already exists. You will need to drop the user first, then rerun it. ie:
DROP USER [MyAppUsr]
You can embed that into your script, better yet, put a conditional check if exists...