OWASP/crAPI

Install crapi for the first time(ERROR: for crapi-web Container "28eac0bf7569" is unhealthy.)

michaellcader opened this issue · 20 comments

Describe the bug

$: sudo docker-compose -f docker-compose.yml --compatibility up -d
mongodb is up-to-date
mailhog is up-to-date
api.crapi.io is up-to-date
postgresdb is up-to-date
crapi-identity is up-to-date
crapi-community is up-to-date
Starting crapi-workshop ... done

ERROR: for crapi-web  Container "28eac0bf7569" is unhealthy.
ERROR: Encountered errors while bringing up the project.

Runtime Environment

$: uname -a

Linux wg-virtual-machine 5.19.0-41-generic #42~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 18 17:40:00 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
$: sudo docker version

Client: Docker Engine - Community
 Version:           24.0.2
 API version:       1.43
 Go version:        go1.20.4
 Git commit:        cb74dfc
 Built:             Thu May 25 21:51:00 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          24.0.2
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.4
  Git commit:       659604f
  Built:            Thu May 25 21:51:00 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.21
  GitCommit:        3dce8eb055cbb6872793272b4f20ed16117344f8
 runc:
  Version:          1.1.7
  GitCommit:        v1.1.7-0-g860f061
 docker-init:
  Version:          0.19.0
sudo docker-compose version

docker-compose version 1.29.2, build unknown
docker-py version: 5.0.3
CPython version: 3.10.6

Can you please provide container logs and compose file used.

Loading default JWKS file.
Picked up JAVA_TOOL_OPTIONS: -Xmx128m

. ____ _ __ _ _
/\ / ' __ _ () __ __ _ \ \ \
( ( )_
_ | '_ | '| | ' / ` | \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
' |
| .__|| ||| |_, | / / / /
=========|
|==============|/=////
:: Spring Boot :: (v2.6.1)

2023-05-30 04:16:46.784 INFO 8 --- [ main] com.crapi.CRAPIBootApplication : Starting CRAPIBootApplication using Java 11.0.15 on 2362df02c372 with PID 8 (/app/identity-service-1.0-SNAPSHOT.jar started by root in /)
2023-05-30 04:16:46.787 INFO 8 --- [ main] com.crapi.CRAPIBootApplication : No active profile set, falling back to default profiles: default
2023-05-30 04:16:48.311 INFO 8 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2023-05-30 04:16:48.416 INFO 8 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 99 ms. Found 8 JPA repository interfaces.
2023-05-30 04:16:49.400 INFO 8 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2023-05-30 04:16:49.407 INFO 8 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2023-05-30 04:16:49.407 INFO 8 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.55]
2023-05-30 04:16:49.500 INFO 8 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2023-05-30 04:16:49.500 INFO 8 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2583 ms
2023-05-30 04:16:49.596 WARN 8 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2023-05-30 04:16:49.798 INFO 8 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2023-05-30 04:16:49.910 INFO 8 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.1.Final
2023-05-30 04:16:50.190 INFO 8 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2023-05-30 04:16:50.306 INFO 8 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2023-05-30 04:16:50.508 INFO 8 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2023-05-30 04:16:50.572 INFO 8 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
2023-05-30 04:16:52.226 INFO 8 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2023-05-30 04:16:52.272 INFO 8 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2023-05-30 04:16:54.701 DEBUG 8 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : 28 mappings in 'requestMappingHandlerMapping'
2023-05-30 04:16:54.892 DEBUG 8 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Patterns [/webjars/, /] in 'resourceHandlerMapping'
2023-05-30 04:16:54.903 INFO 8 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@b73433, org.springframework.security.web.context.SecurityContextPersistenceFilter@31db34da, org.springframework.security.web.header.HeaderWriterFilter@2da16263, org.springframework.web.filter.CorsFilter@1bf14704, org.springframework.security.web.authentication.logout.LogoutFilter@2a097d77, com.crapi.config.JwtAuthTokenFilter@2c7a8af2, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@5edacf20, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@1220ef43, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@5a545b0f, org.springframework.security.web.session.SessionManagementFilter@311ff287, org.springframework.security.web.access.ExceptionTranslationFilter@235d659c, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@5b88b8e]
2023-05-30 04:16:55.006 DEBUG 8 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : ControllerAdvice beans: 0 @ModelAttribute, 0 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice
2023-05-30 04:16:55.121 DEBUG 8 --- [ main] .m.m.a.ExceptionHandlerExceptionResolver : ControllerAdvice beans: 1 @ExceptionHandler, 1 ResponseBodyAdvice
2023-05-30 04:16:55.484 INFO 8 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2023-05-30 04:16:55.491 INFO 8 --- [ main] com.crapi.CRAPIBootApplication : Started CRAPIBootApplication in 9.612 seconds (JVM running for 10.289)

^C
root@ubuntu-linux-22-04-desktop:~# docker ps

samething happens to me if the mongodb is healthy the crapi community is unhealthy and vice versa
I tired everything
this is so boring and time consuming

K1N0SA commented

image

mine doesn't even returns an error code, just says "crAPI container is unhealthy"
steps i've taken

  1. clear any reminisce of crAPI
  2. purged and reinstalled docker-compose
  3. downloaded the yml file
  4. ran it still the same issue
  5. setup a new instance of ubuntu and built it from scratch with same results

one thing i noticed is that amongst all, the "crAPI-identity" takes the longest to run

hopefully this helps.

Can you run docker logs crapi-identity and provide the output

just after that you run sudo docker-compose restart and it will work

K1N0SA commented

docker logs crapi-identity

sure, here you go;
crapi_log.txt

K1N0SA commented

just after that you run sudo docker-compose restart and it will work

tried that and it did not work. :(

delete crAPI and installed again
use sudo to run the commands
I faced same issues and that is how I fixed
sudo docker-compose start => crapi-community or crapi-identity error
I kill the execution and then I run sudo docker-compose restart
it works for me

K1N0SA commented

delete crAPI and installed again use sudo to run the commands I faced same issues and that is how I fixed sudo docker-compose start => crapi-community or crapi-identity error I kill the execution and then I run sudo docker-compose restart it works for me

tyvm for that, i'll give that a try, btw are you on Twitter or LinkedIn ?

KiDxS commented

just after that you run sudo docker-compose restart and it will work

In my case, crapi-web was the one being unhealthy.

What I did was the following:

  1. docker-compose restart
  2. docker-compose up

it doesnot work for me. I have the same issue.

Hi all,
Try with these commands, it's worked for me

VERSION=develop docker-compose -f docker-compose.yml pull
and then
VERSION=develop docker-compose -f docker-compose.yml --compatibility up -d

install the latest version of docker-compose and move it to /usr/local/bin/. If you still get the error "crapi-identity is unhealthy" type "dokcer-compose restart" if it doesn't work uninstall and repeat. It just worked for me