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

Keycloak Not Working; 404 #8

Open
aashish108 opened this issue Sep 16, 2020 · 24 comments
Open

Keycloak Not Working; 404 #8

aashish108 opened this issue Sep 16, 2020 · 24 comments

Comments

@aashish108
Copy link

aashish108 commented Sep 16, 2020

Hi there! Been trying to get this docker app working. Instructions are easy to follow but http://localhost/keycloak does not load, it just shows a 404 error.

http://localhost/api works and http://localhost/keeper almost works but its complaining about Uncaught TypeError: window.Keycloak is not a constructor.

What should I do to fix this issue pls?

Docker ps shows this:

            Name                           Command                  State                         Ports
--------------------------------------------------------------------------------------------------------------------------
keeper-docker_elasticsearch_1   /docker-entrypoint.sh elas ...   Up             9200/tcp, 9300/tcp
keeper-docker_keycloak_1        /opt/jboss/docker-entrypoi ...   Up (healthy)   8080/tcp
keeper-docker_mongo_1           docker-entrypoint.sh mongod      Up             27017/tcp
keeper-docker_redis_1           docker-entrypoint.sh redis ...   Up             6379/tcp
keeper-docker_traefik_1         /traefik -c /dev/null --we ...   Up             0.0.0.0:80->80/tcp, 0.0.0.0:8080->8080/tcp

Just in case its useful, heres toe docker logs for keeper, not seeing any issues?

keycloak_1       | 09:41:43,839 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 58) WFLYCLINF0002: Started client-mappings cache from ejb container
keycloak_1       | 09:41:48,954 INFO  [org.keycloak.services] (ServerService Thread Pool -- 56) KC-SERVICES0001: Loading config from standalone.xml or domain.xml
keycloak_1       | 09:41:50,981 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 56) WFLYCLINF0002: Started realmRevisions cache from keycloak container
keycloak_1       | 09:41:51,010 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 56) WFLYCLINF0002: Started userRevisions cache from keycloak container
keycloak_1       | 09:41:51,132 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 56) WFLYCLINF0002: Started authorizationRevisions cache from keycloak container
keycloak_1       | 09:41:51,133 INFO  [org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFactory] (ServerService Thread Pool -- 56) Node name: bae4b5f8993d, Site name: null
keycloak_1       | 09:42:19,568 INFO  [org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider] (ServerService Thread Pool -- 56) Initializing database schema. Using changelog META-INF/jpa-changelog-master.xml
keycloak_1       | 09:42:33,034 INFO  [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 56) HHH000204: Processing PersistenceUnitInfo [
keycloak_1       | 	name: keycloak-default
keycloak_1       | 	...]
keycloak_1       | 09:42:33,474 INFO  [org.hibernate.Version] (ServerService Thread Pool -- 56) HHH000412: Hibernate Core {5.1.10.Final}
keycloak_1       | 09:42:33,484 INFO  [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 56) HHH000206: hibernate.properties not found
keycloak_1       | 09:42:33,497 INFO  [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 56) HHH000021: Bytecode provider name : javassist
keycloak_1       | 09:42:33,926 INFO  [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 56) HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
keycloak_1       | 09:42:34,772 INFO  [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 56) HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
keycloak_1       | 09:42:34,786 WARN  [org.hibernate.dialect.H2Dialect] (ServerService Thread Pool -- 56) HHH000431: Unable to determine H2 database version, certain features may not work
keycloak_1       | 09:42:34,931 INFO  [org.hibernate.envers.boot.internal.EnversServiceImpl] (ServerService Thread Pool -- 56) Envers integration enabled? : true
keycloak_1       | 09:42:37,496 INFO  [org.hibernate.validator.internal.util.Version] (ServerService Thread Pool -- 56) HV000001: Hibernate Validator 5.3.5.Final
keycloak_1       | 09:42:57,598 INFO  [org.hibernate.hql.internal.QueryTranslatorFactoryInitiator] (ServerService Thread Pool -- 56) HHH000397: Using ASTQueryTranslatorFactory
keycloak_1       | 09:43:06,312 INFO  [org.keycloak.services] (ServerService Thread Pool -- 56) KC-SERVICES0050: Initializing master realm
keycloak_1       | 09:43:09,850 INFO  [org.keycloak.services] (ServerService Thread Pool -- 56) KC-SERVICES0006: Importing users from '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json'
keycloak_1       | 09:43:10,844 INFO  [org.keycloak.services] (ServerService Thread Pool -- 56) KC-SERVICES0009: Added user 'admin' to realm 'master'
keycloak_1       | 09:43:10,931 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 56) RESTEASY002225: Deploying javax.ws.rs.core.Application: class org.keycloak.services.resources.KeycloakApplication
keycloak_1       | 09:43:10,933 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 56) RESTEASY002200: Adding class resource org.keycloak.services.resources.ThemeResource from Application class org.keycloak.services.resources.KeycloakApplication
keycloak_1       | 09:43:10,934 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 56) RESTEASY002205: Adding provider class org.keycloak.services.filters.KeycloakTransactionCommitter from Application class org.keycloak.services.resources.KeycloakApplication
keycloak_1       | 09:43:10,934 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 56) RESTEASY002200: Adding class resource org.keycloak.services.resources.JsResource from Application class org.keycloak.services.resources.KeycloakApplication
keycloak_1       | 09:43:10,936 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 56) RESTEASY002205: Adding provider class org.keycloak.services.error.KeycloakErrorHandler from Application class org.keycloak.services.resources.KeycloakApplication
keycloak_1       | 09:43:10,936 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 56) RESTEASY002220: Adding singleton resource org.keycloak.services.resources.ServerVersionResource from Application class org.keycloak.services.resources.KeycloakApplication
keycloak_1       | 09:43:10,936 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 56) RESTEASY002220: Adding singleton resource org.keycloak.services.resources.RealmsResource from Application class org.keycloak.services.resources.KeycloakApplication
keycloak_1       | 09:43:10,937 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 56) RESTEASY002220: Adding singleton resource org.keycloak.services.resources.admin.AdminRoot from Application class org.keycloak.services.resources.KeycloakApplication
keycloak_1       | 09:43:10,937 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 56) RESTEASY002210: Adding provider singleton org.keycloak.services.util.ObjectMapperResolver from Application class org.keycloak.services.resources.KeycloakApplication
keycloak_1       | 09:43:10,938 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 56) RESTEASY002220: Adding singleton resource org.keycloak.services.resources.RobotsResource from Application class org.keycloak.services.resources.KeycloakApplication
keycloak_1       | 09:43:10,938 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 56) RESTEASY002220: Adding singleton resource org.keycloak.services.resources.WelcomeResource from Application class org.keycloak.services.resources.KeycloakApplication
keycloak_1       | 09:43:11,118 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 56) WFLYUT0021: Registered web context: '/auth' for server 'default-server'
keycloak_1       | 09:43:11,168 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 45) WFLYSRV0010: Deployed "keycloak-server.war" (runtime-name : "keycloak-server.war")
keycloak_1       | 09:43:11,311 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
keycloak_1       | 09:43:11,386 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
keycloak_1       | 09:43:11,387 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
keycloak_1       | 09:43:11,388 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: Keycloak 3.4.3.Final (WildFly Core 3.0.8.Final) started in 111569ms - Started 545 of 881 services (604 services are lazy, passive or on-demand)
keycloak_1       | 09:58:05,317 INFO  [org.jboss.as.server] (Thread-2) WFLYSRV0220: Server shutdown has been requested via an OS signal
keycloak_1       | *** JBossAS process (81) received TERM signal ***
keycloak_1       | 09:58:12,132 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 56) WFLYUT0022: Unregistered web context: '/auth' from server 'default-server'
keycloak_1       | 09:58:12,159 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) WFLYJCA0010: Unbound data source [java:jboss/datasources/KeycloakDS]
keycloak_1       | 09:58:12,378 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0008: Undertow HTTPS listener https suspending
keycloak_1       | 09:58:12,624 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0007: Undertow HTTPS listener https stopped, was bound to 0.0.0.0:8443
keycloak_1       | 09:58:13,197 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) WFLYJCA0010: Unbound data source [java:jboss/datasources/ExampleDS]
keycloak_1       | Added 'admin' to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json', restart server to load user
keycloak_1       | [KEYCLOAK DOCKER IMAGE] Using the embedded H2 database
keycloak_1       | =========================================================================
keycloak_1       |
keycloak_1       |   JBoss Bootstrap Environment
keycloak_1       |
keycloak_1       |   JBOSS_HOME: /opt/jboss/keycloak
keycloak_1       |
keycloak_1       |   JAVA: /usr/lib/jvm/java/bin/java
keycloak_1       |
keycloak_1       |   JAVA_OPTS:  -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true
keycloak_1       |
keycloak_1       | =========================================================================
keycloak_1       |
keycloak_1       | 09:59:42,745 INFO  [org.jboss.modules] (main) JBoss Modules version 1.6.1.Final
keycloak_1       | 09:59:59,293 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.7.SP1
keycloak_1       | 10:00:01,594 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: Keycloak 3.4.3.Final (WildFly Core 3.0.8.Final) starting
keycloak_1       | 10:00:02,472 INFO  [org.jboss.vfs] (MSC service thread 1-1) VFS000002: Failed to clean existing content for temp file provider of type temp. Enable DEBUG level log to find what caused this
keycloak_1       | 10:00:20,632 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/core-service=management/management-interface=http-interface' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
keycloak_1       | 10:00:20,984 INFO  [org.wildfly.security] (ServerService Thread Pool -- 15) ELY00001: WildFly Elytron version 1.1.6.Final

Many thanks!

@ncarlier
Copy link
Member

Hello,
i'm sorry there is a typo in the README: it's not http://localhost/keycloak but http://localhost/auth

You can check active paths and containers thanks to Traefik dashboard: http://localhost:8080

@aashish108
Copy link
Author

Hi @ncarlier , thanks for that; auth/api/traefik now all work. /keeper does not work though, error is (console):

Uncaught TypeError: window.Keycloak is not a constructor
    at Object.<anonymous> (AuthProvider.js:1)
    at t (bootstrap c442e7a17fc08d4912ae:19)
    at Object.<anonymous> (auth.js:2)
    at t (bootstrap c442e7a17fc08d4912ae:19)
    at Object.<anonymous> (index.js:1)
    at t (bootstrap c442e7a17fc08d4912ae:19)
    at Object.<anonymous> (reducers.js:3)
    at t (bootstrap c442e7a17fc08d4912ae:19)
    at Object.<anonymous> (createStore.js:4)
    at t (bootstrap c442e7a17fc08d4912ae:19)

Not sure what I am to do now though?

Many thanks!

@ncarlier
Copy link
Member

This means that the keycloak.js script is not loaded. Can you check errors ans HTTP request with your browser web console (F12)?

@aashish108
Copy link
Author

OK I fixed that issue (Chrome was blocking it due to a security cert issue), thanks @ncarlier! I am now getting another issue:

Request URL: https://login.nunux.org/auth/realms/nunux-keeper/protocol/openid-connect/auth?client_id=nunux-keeper-app&redirect_uri=http%3A%2F%2Flocalhost%2Fkeeper%2Fdocuments&state=3725a7ca-d013-466b-917b-3b5815cccbfa&response_mode=fragment&response_type=code&scope=openid&nonce=26e63942-12d3-461f-bb6b-146d75b0f087
Request Method: GET
Status Code: 400 
Remote Address: 51.15.224.79:443
Referrer Policy: no-referrer-when-downgrade

Where the page now says:

We are sorry...
Invalid parameter: redirect_uri

What to do now? :)

Many thanks,

@aashish108
Copy link
Author

aashish108 commented Sep 16, 2020

So, when going to localhost/keeper, it takes me to https://login.nunux.org/. Is that expected?

@ncarlier
Copy link
Member

login.nunux.org should not be used. It's the hosted URL. The http://localhost/keeper/keycloak.json is maybe incorrect. Did the configuration phase go well during the deployment? if not you can try to reconfigure keaycloak using: make config-keycloak build-webapp or undeploy and redeploy the project.

@aashish108
Copy link
Author

Thanks @ncarlier fixed now, not sure what was going on.

Not sure if I should create another issue but trying to use the keep this bookmarklet and a popup comes saying please login in, so i click that and it takes me from the BBC news site to http://www.bbc.co.uk/auth/realms/keeper-demo/protocol/openid-connect/auth?client_id=keeper-app&redirect_uri=http://localhost/keeper?redirect=https%3A%2F%2Fwww.bbc.co.uk%2Fnews&state=a8244df0-a031-4466-8852-6d332264746c&response_mode=fragment&response_type=code&scope=openid&nonce=30009a29-8cd2-4a26-9a43-61d52cccbedc

Is there something I am to do here?

Thanks!

@ncarlier
Copy link
Member

I think this is because the base URL is not set for the login URL.
Can you try to add REACT_APP_LOGIN_ROOT=http://localhost to https://github.com/nunux-keeper/keeper-docker/blob/master/etc/keeper-web-app.env and rebuild and redeploy the webapp (make deploy) ?

@aashish108
Copy link
Author

That seems to do the trick @ncarlier! Unfortunately I am getting another error when I try to keep something via the bookmarklet:

VM559 main.04a40ac9.js:2 POST http://localhost/api/v2/documents 500 (Internal Server Error)
(anonymous) @ VM559 main.04a40ac9.js:2
Promise.then (async)
value @ VM559 main.04a40ac9.js:2
value @ VM559 main.04a40ac9.js:6
(anonymous) @ VM559 main.04a40ac9.js:2
(anonymous) @ VM559 main.04a40ac9.js:24
(anonymous) @ VM559 main.04a40ac9.js:24
value @ VM559 main.04a40ac9.js:15
value @ VM559 main.04a40ac9.js:15
value @ VM559 main.04a40ac9.js:15
postMessage (async)
(anonymous) @ bookmarklet.js:49
content.js:1 {"type":"get_background_image","requestDate":"2020-09-17T14:09:28.213Z"}
VM559 main.04a40ac9.js:15 Unable to parse received event data SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at t.value (index.jsx:64)

I believe I have followed everything now!

Thanks

@ncarlier
Copy link
Member

"Unexpected token u in JSON" ... "u" certainly like "undefined".
Can you open the network tab of the web console and show me the HTTP request for the http://localhost/api/v2/documents POST?

@aashish108
Copy link
Author

Ah I see this in the response:

{"error":"connect ECONNREFUSED 127.0.0.1:80"}

Sounds like I should change the port? I did that but I get other issues lol :O

@ncarlier
Copy link
Member

I think the payload sent to http://localhost/api/v2/documents isn't correct. Can you show the full http request?

@aashish108
Copy link
Author

Here it is!

Request payload:

{"title":"Settings: Bookmarklet","origin":"http://localhost/keeper/settings/bookmarklet"}

Request headers:

Accept: application/json
Accept-Encoding: gzip, deflate, br
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJuejFkWHplUFB1bXdWdUFPOG4wRGNMeENjVlFRTXBiN1ZFUmFyVkkzWEhvIn0.eyJqdGkiOiJhMGU2NzkzYi04MjgzLTRjOTMtOWRhOC0wYTA3OTVmYmQxZjgiLCJleHAiOjE2MDA0MjkyMzQsIm5iZiI6MCwiaWF0IjoxNjAwNDI4OTM0LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0L2F1dGgvcmVhbG1zL2tlZXBlci1kZW1vIiwiYXVkIjoia2VlcGVyLWFwcCIsInN1YiI6IjI5ZDQxNDU4LTllNTktNDNlOC1iODUxLTNhZmVhZjBlNzkzOSIsInR5cCI6IkJlYXJlciIsImF6cCI6ImtlZXBlci1hcHAiLCJub25jZSI6IjM2ODdkYjRiLTE3MDAtNDIwZS04YjY5LTJmMjNhOGNhMjAxYyIsImF1dGhfdGltZSI6MTYwMDQyODkwOSwic2Vzc2lvbl9zdGF0ZSI6IjI2MTJiMGJhLTBmMjAtNDVmOS1hOWQ1LTFmN2Q2MTI5NmE3YiIsImFjciI6IjAiLCJhbGxvd2VkLW9yaWdpbnMiOlsiaHR0cDovL2xvY2FsaG9zdCJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsiYWRtaW4iLCJ1bWFfYXV0aG9yaXphdGlvbiJdfSwicmVzb3VyY2VfYWNjZXNzIjp7ImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInByZWZlcnJlZF91c2VybmFtZSI6ImtlZXBlciJ9.GtszP9PFWUhzWm4ZKIK-l_7MKOhNvk02z0mlC-WqKq7pq6qNFHpZ_pYUhQvKlhd4IhrqRZMA8_zfwUTxyAH6P5994_yCDchpOkXYvDKpsoGBeSQWCQaEuV7M1CsRzNtnpTlJKzL8s6lp7_phS6v4rOhgRh5PWirjv98X4SZJswPVKK3NLm7H3iZSQht8gC0KPogircn1pTLRzNwerY_gj78TW_Jv0gLkzcs8cPrjT6Ec6_HACkb6pk2FfwlD2E81C_LGFihxqA6rxBV3F0AlRSxrFuV3l-TijSiswtlQXqKI7B4w9Agyh6o5L62wcu3to49zrgW6nt2YvClJBQZDDQ
Cache-Control: no-cache
Connection: keep-alive
Content-Length: 89
Content-Type: application/json
Cookie: access_token=eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJxWERyakVVTjZqdmM5WXlqb1NWUV95TGJrOF81OTR6X2hObFdBOTB5SVRvIn0.eyJqdGkiOiIwNGQ3Y2ZhZi02ZDA0LTRkODItYjA1ZS1mYjM5MmE0NDE5MTIiLCJleHAiOjE2MDAzNTcwNDAsIm5iZiI6MCwiaWF0IjoxNjAwMzU2NzQwLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0L2F1dGgvcmVhbG1zL2tlZXBlci1kZW1vIiwiYXVkIjoia2VlcGVyLWFwcCIsInN1YiI6Ijk0OGY2MTk1LWIyZmMtNDkwNS1hYzVjLWQ4MzM2MDk5MjdmNSIsInR5cCI6IkJlYXJlciIsImF6cCI6ImtlZXBlci1hcHAiLCJub25jZSI6IjE5ZWFlMzMzLTVkMDUtNGZkOS04NjNjLTMyMGM2MjI3ZmM1ZiIsImF1dGhfdGltZSI6MTYwMDM1NTg0Nywic2Vzc2lvbl9zdGF0ZSI6IjU1ZDVlYjZiLTMyZGYtNDE1Ni05NDkwLTlmYzU2M2EwMGU1YyIsImFjciI6IjAiLCJhbGxvd2VkLW9yaWdpbnMiOlsiaHR0cDovL2xvY2FsaG9zdCJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsiYWRtaW4iLCJ1bWFfYXV0aG9yaXphdGlvbiJdfSwicmVzb3VyY2VfYWNjZXNzIjp7ImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInByZWZlcnJlZF91c2VybmFtZSI6ImtlZXBlciJ9.ckHhEgFs0nIEA8VYzvwatOovNrYltwj8GeuEwzE2vosKQTwhS56FLBVLES6ihS8QZejL0DmBGkHV9cjnQtyiafBwDwvZkscsjBUfQHXxer94dknOywZ3kX3UgayQynj8BfUi4jD3Mju-t2SGAK7HUviTN5dRxMjPOWjTUYBHuLazcUA8ltq-TFfXTX6b16ZhQKf4p4nnKo-PqwzgVXaeO-vkZHQar_eOwMbTJKg1rQ1Rk-UAtNyFZQz1ct0jr6c-tsSH4KRqBGVKAsuWDEvb-6ClO5vEGjh1Q8j9Re4plE3qymR3gEQbjGMCzxzYr1h4ZC9x387XDTtBcB43WUfBRA; _ga=GA1.1.2001216844.1581526371; _pxvid=38875f37-4dbd-11ea-9962-0242ac12000b; _dy_soct=1003595.1005104.1583936358*1011332.1019298.1583936358*1001485.1001871.1583936358; cb-enabled=enabled; cb-shown=true; AMCV_62C33A485B0EB69A0A495D19%40AdobeOrg=1075005958%7CMCIDTS%7C18333%7CMCMID%7C90985977501298504087654869729143684062%7CMCOPTOUT-1583943564s%7CNONE%7CvVersion%7C4.4.1%7CMCAAMLH-1584541164%7C6%7CMCAAMB-1584541164%7Cj8Odv6LonN4r3an7LhD3WZrU1bUpAkFkkiY1ncBR96t2PTI
DNT: 1
Host: localhost
Origin: http://localhost
Pragma: no-cache
Referer: http://localhost/keeper/bookmarklet?url=http%3A%2F%2Flocalhost%2Fkeeper%2Fsettings%2Fbookmarklet&title=Settings%3A%20Bookmarklet
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36

General:

Request URL: http://localhost/api/v2/documents
Request Method: POST
Status Code: 404 Not Found
Remote Address: [::1]:80
Referrer Policy: no-referrer-when-downgrade

@ncarlier
Copy link
Member

The following payload isn't correct:

{"title":"Settings: Bookmarklet","origin":"http://localhost/keeper/settings/bookmarklet"}

It seems that you click on the bookmarklet while you are on the Keeper settings page. So you ask Keeper to save a localhost URL which is obviously unable to do.

Regarding the BBC URL, it means that the Keycloak base URL is not correct. Can you show the http://localhost/keeper/keycloak.json content?

@aashish108
Copy link
Author

aashish108 commented Sep 21, 2020

This is it @ncarlier:

{
realm: "keeper-demo",
auth-server-url: "/auth",
ssl-required: "external",
resource: "keeper-app",
public-client: true,
confidential-port: 0
}

Cheers!

@ncarlier
Copy link
Member

auth-server-url is incorrect. It should be http://localhost/auth and not /auth. It's why you get http://www.bbc.co.uk/auth/.... This should be configured during the configuration of the deploy phase (precisely by this script: https://github.com/nunux-keeper/keeper-docker/blob/master/dockerfiles/keycloak/setup.sh#L152). Is your PUBLIC_BASEURL env variable well defined inside the .env file (https://github.com/nunux-keeper/keeper-docker/blob/master/.env#L6)?

@ncarlier
Copy link
Member

Saying this, I wonder if the env variable is properly propagated. Can you add PUBLIC_BASEURL=http://localhost to the "./etc/keycloak.env" file, drop keycloak container (docker stop ... and docker docker rm ...) and retry the make deploy ?

@aashish108
Copy link
Author

I tried that @ncarlier but now when clicking keep this, the popup just says login first, clicking seems to go to keeper then back to BBC site. Checking Keeper, nothing is saved. Checking the console, I see this:

AbstractApi.js:101 GET http://localhost/api/v2/documents?from=0&size=20&order=desc 404 (Not Found)
  | (anonymous) | @ | AbstractApi.js:101
-- | -- | -- | --
  | Promise.then (async) |   |  
  | value | @ | AbstractApi.js:101
  | value | @ | document.js:12
  | (anonymous) | @ | documents.js:49
  | (anonymous) | @ | index.js:11
  | (anonymous) | @ | bindActionCreators.js:7
  | value | @ | index.jsx:165
  | r.handleClick | @ | DropdownItem.js:84
  | r | @ | ReactErrorUtils.js:24
  | i | @ | EventPluginUtils.js:83
  | u | @ | EventPluginUtils.js:103
  | p | @ | EventPluginHub.js:41
  | m | @ | EventPluginHub.js:52
  | n | @ | forEachAccumulated.js:22
  | processEventQueue | @ | EventPluginHub.js:252
  | r | @ | ReactEventEmitterMixin.js:15
  | handleTopLevel | @ | ReactEventEmitterMixin.js:25
  | a | @ | ReactEventListener.js:70
  | perform | @ | Transaction.js:141
  | batchedUpdates | @ | ReactDefaultBatchingStrategy.js:60
  | a | @ | ReactUpdates.js:95
  | dispatchEvent | @ | ReactEventListener.js:145

I think I must be doing something wrong!

Thanks!

@ncarlier
Copy link
Member

The cinematic is correct: If you are not logged in, your are redirected to Keycloak and finally redirected to BBC site. Then you have to click again on the bookmarklet! You should be logged, and click on the button should save the page.

Regarding the 404 error it's means that the API is not available. Can you check traefik status (localhost:8080) and test the API url directly in your browser: http://localhost/api/

@aashish108
Copy link
Author

@ncarlier http://localhost/api/ returns a 404 and is not present in Traefik!

I only added PUBLIC_BASEURL=http://localhost to keycloak.env and REACT_APP_LOGIN_ROOT=http://localhost to keeper-web-app.env. No other changes were done.

Heres a screenshot. Thanks!

Screenshot 2020-09-22 at 16 04 47

@ncarlier
Copy link
Member

The API is not started. Can you check docker logs of the keeper-core-api container?

@aashish108
Copy link
Author

I run make deploy and, after its loaded, this is what docker -ps shows:

CONTAINER ID        IMAGE                                                                 COMMAND                  CREATED             STATUS                          PORTS                                        NAMES
900a6e9569f2        ncarlier/keeper-keycloak-config:latest                                "/bin/bash -c /opt/j…"   3 minutes ago       Exited (1) About a minute ago                                                keeper-docker_keycloak-config_run_64f06073aaf0
df24f7dbb603        ncarlier/keeper-web-app:latest                                        "/usr/local/bin/npm …"   8 minutes ago       Exited (0) 3 minutes ago                                                     keeper-docker_build-webapp_run_7552c5f3b5e3
88300eadf89d        elasticsearch:5                                                       "/docker-entrypoint.…"   8 minutes ago       Up 8 minutes                    9200/tcp, 9300/tcp                           keeper-docker_elasticsearch_1
d6053d8c7c57        jboss/keycloak:3.4.3.Final                                            "/opt/jboss/docker-e…"   8 minutes ago       Up 8 minutes (healthy)          8080/tcp                                     keeper-docker_keycloak_1
84264a25c6da        traefik:1.7                                                           "/traefik -c /dev/nu…"   8 minutes ago       Up 8 minutes                    0.0.0.0:80->80/tcp, 0.0.0.0:8080->8080/tcp   keeper-docker_traefik_1
30976434913b        redis:4                                                               "docker-entrypoint.s…"   8 minutes ago       Up 8 minutes                    6379/tcp                                     keeper-docker_redis_1
c5eb5f57d9f0        mongo:3                                                               "docker-entrypoint.s…"   8 minutes ago       Up 8 minutes                    27017/tcp                                    keeper-docker_mongo_1
de80f5494bb8        wallabag/wallabag                                                     "/entrypoint.sh wall…"   7 months ago        Exited (0) 7 months ago                                                      wallabag-dockerized_wallabag_1
a7b3dc402a3a        linuxserver/mariadb                                                   "/init"                  7 months ago        Exited (0) 7 months ago                                                      wallabag-dockerized_wallabagDB_1
f670d2bae64c        linuxserver/mariadb                                                   "/init"                  7 months ago        Exited (0) 7 months ago                                                      wallabag-dockerized_wallabag-db_1
66d265f512cb        mariadb                                                               "docker-entrypoint.s…"   7 months ago        Exited (0) 7 months ago                                                      wallabag-dockerized_db_1
f6414b671e2a        redis:alpine                                                          "docker-entrypoint.s…"   7 months ago        Exited (0) 7 months ago                                                      wallabag-dockerized_redis_1
de0def305356        redis:alpine                                                          "docker-entrypoint.s…"   7 months ago        Exited (0) 7 months ago                                                      wallabag-dockerized_wallabag-redis_1
deb0f95af5fc        docker.pkg.github.com/aashish108/seafile-docker-pi/seafile:6.3.4-pi   "/sbin/my_init -- /s…"   7 months ago        Exited (2) 7 months ago                                                      my-cloud-infrastructure_seafile_1
bea9004616d9        tomsquest/docker-radicale                                             "docker-entrypoint.s…"   7 months ago        Exited (0) 7 months ago                                                      radicale

This is also what make deploy shows:

Setup Nunux Keeper...
#########################################
# Nunux Keeper custom configuration
#########################################

# Public base URL
PUBLIC_BASEURL=http://localhost

# Host exposed port
PORT=80

# Reverse proxy exposed port
RPROXY_PORT=8080
Creating network "keeper-docker_default" with the default driver
Creating keeper-docker_redis_1         ... done
Creating keeper-docker_mongo_1         ... done
Creating keeper-docker_elasticsearch_1 ... done
Creating keeper-docker_keycloak_1      ... done
Creating keeper-docker_traefik_1       ... done
Building Web App...
Creating keeper-docker_build-webapp_run ... done

> keeper@1.0.0 build /usr/src/app
> react-scripts build

Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  210.57 KB  build/static/js/main.04a40ac9.js
  98.83 KB   build/static/css/main.40dfb918.css

The project was built assuming it is hosted at /keeper/.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.

Waiting for keycloak up and ready ("healthy")...
Configuring keycloak...
Starting keeper-docker_keycloak_1 ... done
Creating keeper-docker_keycloak-config_run ... done
Logging into http://keycloak:8080/auth as user admin of realm master
Resource not found for url: http://keycloak:8080/auth/admin/realms/keeper-demo
Realm 'keeper-demo' created.
Realm 'keeper-demo' configured.
Client '3612bfa6-2adc-444c-8c9b-085a95ad1de3' created.
Created new role with id 'user'
Created new role with id 'admin'
Roles created.
Users created.
HTTP error - 401 Unauthorized
Error: Unable to create 'Admin' group
make[2]: *** [config-keycloak] Error 1
make[1]: *** [config] Error 2
make: *** [deploy] Error 2

I have not seen any keeper api on docker?

Thanks!

@ncarlier
Copy link
Member

Keycloak configuration failed when creating the Admin group. I don't understand why.
Therefore the deployment stop here: https://github.com/nunux-keeper/keeper-docker/blob/master/Makefile#L31
Having said that, ddmin group is not mandatory for using the solution.
You can continue the deployment by running again "make deploy".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants