Keycloack standalone works fine on terminal but on ip:8080 i get This site can’t be reached

Ubuntu VM 16.04 (real server not localhost).

Steps to reproduce :
wget keycloak .
Unzip on /opt
sudo ./standalone.sh
Go to ip:8080

Logs:

I tried docker installation and it works fine .
I tried standalone on my local ubuntu machine (my laptop) and it works fine.
I tried running it with this command sudo ./standalone.sh -Djboss.socket.binding.port-offset=100 so i can get a new port still doesnt work.
Why would this not work ? :frowning:

Hi there, it should be because if you launch the process like that it will only listen on the 127.0.0.1 interface, you should try launching it with -b=0.0.0.0 and -bmanagement=0.0.0.0 too, that way the process will listen on all interfaces and you should be able to access it using your ip. Let me know if this works

Best regards

Hello thanks for the quick reply .
Now i am suddenly getting .
15:46:59,013 FATAL [org.keycloak.services] (ServerService Thread Pool – 56) Error during startup: java.lang.RuntimeException: Failed to connect to database
Full logs : 15:53:18,406 FATAL [org.keycloak.services] (ServerService Thread Pool -- 62) Err - Pastebin.com

As said this is a fresh ubuntu 16.04 i just downloaded keycloak and runned standalone.sh , it should play right of the box but it’s not , any help would be appreciated.

@ Marius

I haven’t seen that error with the default datasource but looking at the stack trace the cause seems to be "org.h2.jdbc.JdbcSQLException: IO Exception: “java.net.UnknownHostException: ca: ca: Name or service not known”, can you try adding the hostname into /etc/hosts and seeing what happens next

just add the ip address of the server e.g 42.435.234.2 on the last line?
Yea it’s weird it’s doing it now, it wasn’t doing it yesterday but i did clean install ubuntu again today.

No, not the ip address but the server’s hostname, try simply running this command
printf “127.0.0.1 $(hostname)” >> etc/hosts

printf “127.0.0.1 $(hostname)” >> etc/hosts
-bash: etc/hosts: No such file or directory

I forgot a ‘/’ my bad, it’s
printf “127.0.0.1 $(hostname)” >> /etc/hosts

unfortunately i am getting permissions denied even if i have sudo privs.
but on hosts i can see 2 lines with
127.0.0.1 localhost
127.0.0.1 prob our hostname.

It’s weird everything worked just fine until i did a clean install of ubuntu again today . Now i regret that.

If i do sudo hostname i get an answer though
should i add that answer
127.0.0.1 hostname_answer ?

this is how etc/hosts
image
It worked , i will run the command u said now , finger crossed.

@ Marius this seems to be working just fine . What i did for people reading this in the future is add what sudo hostname said in etc/hosts
so sudo hostname
it the answer was for example “x” then i added on etc/hosts
127.0.0.1 x
That’s it.
I had to create an admin from the terminal but now when i try to log in i get
" We are sorry…

HTTPS required"

How can i disable SSL this is a test environment i don’t need it . Do you know ?

Like on my localhost (laptop) it runs fine without SSL.

Try disabling the ssl, in the “master” realm, over login tab. Change ‘Require SSL’ property to none

The thing is as soon as i press administration console i get the error so i cant go to master realm.

Maybe this can be achieved via the terminal ? do u know …
Thanks for the help btw i truly appreciate it.

Console error :
16:41:15,362 WARN [org.keycloak.events] (default task-2) type=LOGIN_ERROR, realmId=master, clientId=null, userId=null, ipAddress=…1, error=ssl_required

I found this but no idea where all the default thing are to replace the values or if it’s even a workable solution

java -cp .jar org.h2.tools.Shell -url “jdbc:h2:file:” -user -password -sql “update REALM set ssl_required=‘NONE’ where id = ‘master’”

Oh, I see, you could try doing it from the cli on the server like this

./kcadm.sh config credentials --server http://localhost:8080/auth --realm master --user admin
./kcadm.sh update realms/master -s sslRequired=NONE

or you could try to tunnel from your local machine into the server on port 8080 or whatever port you have it running on and then access the web console from your local machine, the tunnel syntax is

sudo ssh -N -L 8080:localhost:8080 username@serverip

this will forward your local 8080 port to the port 8080 on the server and you can simply open a browser on your machine and type localhost:8080/auth and then you should be able to access it

G.O.A.T

:heart: :heart: :heart: :heart: :heart:

For people reading this what i did is the second option
sudo ssh -N -L 8080:localhost:8080 username@serverip
Where username = the username u ssh into your virtual matchine
serverip = the ip of your virtual machine

e,g if you ssh root@43500
username=root
ip=43500
Went into localhost:8080 log in with the user/pass i created earlier via the script and disable ssl.

bind 0.0.0.0 :grinning:

1 Like