OWASP/crAPI

crapi-web Container "f6e54027f4ea" is unhealthy

mo718 opened this issue · 24 comments

mo718 commented

Hello, I run crAPI in the Ubuntu18.04, but when I run the command "docker-compose -f docker-compose.yml --compatibility up -d", it report the error: "ERROR: for crapi-web Container "f6e54027f4ea" is unhealthy. "
the logs is:
Can't open /.keys/jwks.json for reading, No such file or directory
139965617173696:error:02001002:system library:fopen:No such file or directory:../crypto/bio/bss_file.c:69:fopen('/.keys/jwks.json','rb')
139965617173696:error:2006D080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:76:
Can't open /.keys/jwks.json for reading, No such file or directory
139712569619648:error:02001002:system library:fopen:No such file or directory:../crypto/bio/bss_file.c:69:fopen('/.keys/jwks.json','rb')
139712569619648:error:2006D080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:76:
Can't open /.keys/jwks.json for reading, No such file or directory
140523683042496:error:02001002:system library:fopen:No such file or directory:../crypto/bio/bss_file.c:69:fopen('/.keys/jwks.json','rb')
140523683042496:error:2006D080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:76:
Can't open /.keys/jwks.json for reading, No such file or directory
139945362683072:error:02001002:system library:fopen:No such file or directory:../crypto/bio/bss_file.c:69:fopen('/.keys/jwks.json','rb')
139945362683072:error:2006D080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:76:

VERSION=develop docker-compose -f docker-compose.yml --compatibility up -d
Seems like you are using compose file from develop and using main images.

i meet the same question

i meet the same question too

i meet the same question too

Can you do a
docker-compose -f docker-compose.yml pull
and then
docker-compose -f docker-compose.yml --compatibility up -d
Locally present images might be outdated.

I tried,but error

root@debian:~/crAPI#  docker-compose -f docker-compose.yml pull
Pulling postgresdb      ... done
Pulling mongodb         ... done
Pulling crapi-identity  ... done
Pulling crapi-community ... done
Pulling crapi-workshop  ... done
Pulling crapi-web       ... done
Pulling mailhog         ... done
root@debian:~/crAPI# docker-compose -f docker-compose.yml --compatibility up -d
Creating mailhog    ... done
Creating postgresdb ... done
Creating mongodb    ... done
Creating crapi-identity ... done

ERROR: for crapi-community  Container "8a9386e0f199" is unhealthy.
ERROR: Encountered errors while bringing up the project.

view logs

cat 8a9386e0f19940d6537e198abb5fd1a9c57412a4e5237d45a1d129a6ed689c9f-json.log 

{"log":"Can't open /.keys/jwks.json for reading, No such file or directory\n","stream":"stderr","time":"2022-11-18T06:38:08.278419904Z"}
{"log":"139625568449728:error:02001002:system library:fopen:No such file or directory:../crypto/bio/bss_file.c:69:fopen('/.keys/jwks.json','rb')\n","stream":"stderr","time":"2022-11-18T06:38:08.278454329Z"}
{"log":"139625568449728:error:2006D080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:76:\n","stream":"stderr","time":"2022-11-18T06:38:08.278458445Z"}

The fix has been merged. Can you verify with
VERSION=develop docker-compose -f docker-compose.yml pull
and then
VERSION=develop docker-compose -f docker-compose.yml --compatibility up -d
Locally present images might be outdated.

The fix has been merged. Can you verify with VERSION=develop docker-compose -f docker-compose.yml pull and then VERSION=develop docker-compose -f docker-compose.yml --compatibility up -d Locally present images might be outdated.

worked for me.

Please reopen if issue still persists.

mo718 commented

I tried,but error

root@zero-virtual-machine:/home/zero/Downloads# docker-compose -f docker-compose.yml --compatibility up -d
Creating network "downloads_default" with the default driver
Creating mongodb    ... done
Creating mailhog    ... done
Creating postgresdb ... done
Creating crapi-identity ... done
Creating crapi-community ... done
Creating crapi-workshop  ... done

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

view logs

Creating test database for alias 'default'...
Creating test database for alias 'mongodb'...
root         ERROR    /workshop/api/mechanic/signup - {'name': 'MechRaju', 'email': 'mechraju@crapi.com', 'mechanic_code': 'TRAC_MEC_3', 'number': '9123456708'} - 400 -{'password': [ErrorDetail(string='This field is required.', code='required')]}
django.request WARNING  Bad Request: /workshop/api/mechanic/signup
.django.request WARNING  Bad Request: /workshop/api/mechanic/signup
.django.request WARNING  Bad Request: /workshop/api/mechanic/signup
.django.request WARNING  Unauthorized: /workshop/api/mechanic/
django.request WARNING  Unauthorized: /workshop/api/mechanic/
.django.request WARNING  Unauthorized: /workshop/api/mechanic/
..root         ERROR    /workshop/api/merchant/contact_mechanic - {'mechanic_api': 'https://www.google.com', 'number_of_repeats': 5, 'mechanic_code': 'TRAC_MEC_3', 'vin': '9NFXO86WBWA082766', 'problem_details': 'My Car is not working'} - 400 -{'repeat_request_if_failed': [ErrorDetail(string='This field is required.', code='required')]}
django.request WARNING  Bad Request: /workshop/api/merchant/contact_mechanic
.root         INFO     Repeat count: 0
root         INFO     Repeat count: 1
root         INFO     Repeat count: 2
root         INFO     Repeat count: 3
root         INFO     Repeat count: 4
root         INFO     Repeat count: 5
django.request WARNING  Bad Request: /workshop/api/merchant/contact_mechanic
Fdjango.request ERROR    Service Unavailable: /workshop/api/merchant/contact_mechanic
..root         INFO     Repeat count: 0
root         INFO     Repeat count: 1
root         INFO     Repeat count: 2
root         INFO     Repeat count: 3
root         INFO     Repeat count: 4
root         INFO     Repeat count: 5
django.request WARNING  Not Found: /workshop/api/merchant/contact_mechanic
.django.request WARNING  Bad Request: /workshop/api/shop/apply_coupon
ProductTest  INFO     {'message': 'TRAC100 Coupon code is already claimed by you!! Please try with another coupon code'}
.root         ERROR    /workshop/api/shop/apply_coupon - {'coupon_code': 'TRAC105', 'amount': 75} - 400 -Coupon matching query does not exist.
django.request WARNING  Bad Request: /workshop/api/shop/apply_coupon
ProductTest  INFO     {'message': 'Coupon not found'}
.django.request WARNING  Bad Request: /workshop/api/shop/apply_coupon
ProductTest  INFO     {'message': '9123456708 Coupon code is already claimed by you!! Please try with another coupon code'}
.ProductTest  INFO     {'credit': 175.0, 'message': 'Coupon successfully applied!'}
.
======================================================================
FAIL: test_contact_mechanic (app.crapi.merchant.tests.MerchantTestCase)
gives all correct field for contact mechanic
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/app/crapi/merchant/tests.py", line 134, in test_contact_mechanic
    self.assertEqual(res.status_code, 200)
AssertionError: 400 != 200

----------------------------------------------------------------------
Ran 15 tests in 180.022s

FAILED (failures=1)
Destroying test database for alias 'default'...
Destroying test database for alias 'mongodb'...
This version of djongo does not support "NULL, NOT NULL column validation check" fully. Visit https://www.patreon.com/nesdis
This version of djongo does not support "schema validation using CONSTRAINT" fully. Visit https://www.patreon.com/nesdis
This version of djongo does not support "schema validation using KEY" fully. Visit https://www.patreon.com/nesdis
This version of djongo does not support "schema validation using REFERENCES" fully. Visit https://www.patreon.com/nesdis
This version of djongo does not support "COLUMN DROP NOT NULL " fully. Visit https://www.patreon.com/nesdis
This version of djongo does not support "DROP CASCADE" fully. Visit https://www.patreon.com/nesdis
System check identified no issues (0 silenced).

i meet the same question as mo718

Have you pulled the latest images?
docker-compose -f docker-compose.yml pull

I use a new virtual machine

root@debian:~/crAPI#  docker-compose -f docker-compose.yml pull
Pulling postgresdb      ... done
Pulling mongodb         ... done
Pulling crapi-identity  ... done
Pulling crapi-community ... done
Pulling crapi-workshop  ... done
Pulling crapi-web       ... done
Pulling mailhog         ... done
root@debian:~/crAPI# docker-compose -f docker-compose.yml --compatibility up -d
Creating network "crapi_default" with the default driver
Creating volume "crapi_mongodb-data" with default driver
Creating volume "crapi_postgresql-data" with default driver
Creating postgresdb ... done
Creating mongodb    ... done
Creating mailhog    ... done
Creating crapi-identity ... done
Creating crapi-community ... done
Creating crapi-workshop  ... done

ERROR: for crapi-web  Container "738568d422ba" is unhealthy.
ERROR: Encountered errors while bringing up the project.
root@debian:~/crAPI# cat /var/lib/docker/containers/738568d422bacdba337a435f71d8ce0a20820a61d6c82d0a2dea8ad1fc41a948/738568d422bacdba337a435f71d8ce0a20820a61d6c82d0a2dea8ad1fc41a948-json.log 
{"log":"Creating test database for alias 'default'...\n","stream":"stderr","time":"2022-11-21T06:21:52.309322475Z"}
{"log":"Creating test database for alias 'mongodb'...\n","stream":"stderr","time":"2022-11-21T06:21:52.309354362Z"}
{"log":"root         ERROR    /workshop/api/mechanic/signup - {'name': 'MechRaju', 'email': 'mechraju@crapi.com', 'mechanic_code': 'TRAC_MEC_3', 'number': '9123456708'} - 400 -{'password': [ErrorDetail(string='This field is required.', code='required')]}\n","stream":"stderr","time":"2022-11-21T06:21:52.309357876Z"}
{"log":"django.request WARNING  Bad Request: /workshop/api/mechanic/signup\n","stream":"stderr","time":"2022-11-21T06:21:52.312446042Z"}
{"log":".django.request WARNING  Bad Request: /workshop/api/mechanic/signup\n","stream":"stderr","time":"2022-11-21T06:21:53.019614966Z"}
{"log":".django.request WARNING  Bad Request: /workshop/api/mechanic/signup\n","stream":"stderr","time":"2022-11-21T06:21:53.72662136Z"}
{"log":".django.request WARNING  Unauthorized: /workshop/api/mechanic/\n","stream":"stderr","time":"2022-11-21T06:21:53.729934315Z"}
{"log":"django.request WARNING  Unauthorized: /workshop/api/mechanic/\n","stream":"stderr","time":"2022-11-21T06:21:53.731806456Z"}
{"log":".django.request WARNING  Unauthorized: /workshop/api/mechanic/\n","stream":"stderr","time":"2022-11-21T06:21:54.509955185Z"}
{"log":"..root         ERROR    /workshop/api/merchant/contact_mechanic - {'mechanic_api': 'https://www.google.com', 'number_of_repeats': 5, 'mechanic_code': 'TRAC_MEC_3', 'vin': '9NFXO86WBWA082766', 'problem_details': 'My Car is not working'} - 400 -{'repeat_request_if_failed': [ErrorDetail(string='This field is required.', code='required')]}\n","stream":"stderr","time":"2022-11-21T06:21:57.340724982Z"}
{"log":"django.request WARNING  Bad Request: /workshop/api/merchant/contact_mechanic\n","stream":"stderr","time":"2022-11-21T06:21:57.341745321Z"}
{"log":".root         INFO     Repeat count: 0\n","stream":"stderr","time":"2022-11-21T06:21:58.815162271Z"}
{"log":"root         INFO     Repeat count: 1\n","stream":"stderr","time":"2022-11-21T06:24:08.071006299Z"}
{"log":"root         INFO     Repeat count: 2\n","stream":"stderr","time":"2022-11-21T06:26:19.143936828Z"}

@baicaiyihao Sadly I have been unable to reproduce it. It could be a port conflict with another service. Could you dump logs from all the containers and provide them to us? Might help us narrow it down easily.

@piyushroshan yeah,I upload it to my repository. filename: containers.zip
https://github.com/baicaiyihao/crAPI_errorlogs

Step 1: run docker-compose stop

  • Stops running containers without removing them.

Step 2: run docker-compose down

  • Stops containers and removes containers, networks, volumes, and images created by up.

Step 3: run docker-compose -f docker-compose.yml --compatibility up -d

This issue is still persisting for me.

[~/labs/crAPI/deploy/docker] $ sudo docker-compose stop                                                       
Stopping crapi-community ... done
Stopping postgresdb      ... done
Stopping mongodb         ... done
Stopping mailhog         ... done
                                                                                                                                                                             
[~/labs/crAPI/deploy/docker] $ sudo docker-compose down                                                      
Removing crapi-community ... done
Removing crapi-identity  ... done
Removing postgresdb      ... done
Removing mongodb         ... done
Removing mailhog         ... done
Removing network docker_default
                                                                                                                                                                             
[~/labs/crAPI/deploy/docker] $ sudo VERSION=develop docker-compose -f docker-compose.yml pull                 
Pulling postgresdb      ... done
Pulling mongodb         ... done
Pulling crapi-identity  ... done
Pulling crapi-community ... done
Pulling crapi-workshop  ... done
Pulling crapi-web       ... done
Pulling mailhog         ... done
                                                                                                                                                                             
[~/labs/crAPI/deploy/docker] $ sudo VERSION=develop docker-compose -f docker-compose.yml --compatibility up -d
Creating network "docker_default" with the default driver
Creating mongodb    ... done
Creating postgresdb ... done
Creating mailhog    ... done
Creating crapi-identity ... done

ERROR: for crapi-community  Container "bd1d0a47515f" is unhealthy.
ERROR: Encountered errors while bringing up the project.

same for me as well

┌──(root㉿kali)-[~/…/crapi/crAPI/deploy/docker]
└─# docker-compose up
/usr/lib/python3/dist-packages/paramiko/transport.py:219: CryptographyDeprecationWarning: Blowfish has been deprecated
"class": algorithms.Blowfish,
mongodb is up-to-date
postgresdb is up-to-date
Recreating api.mypremiumdealership.com ... done
Recreating mailhog ... done
Recreating crapi-identity ... done

ERROR: for crapi-community Container "ae03dd34b5a6" is unhealthy.

ERROR: for crapi-workshop Container "ae03dd34b5a6" is unhealthy.
ERROR: Encountered errors while bringing up the project.

p4d0rn commented

This works for me.
Step1. comment the depends_on and healthcheck for crapi-web Container.
Step2. docker-compose -f docker-compose.yml --compatibility up -d
Step3. docker-compose restart

thanks @p4d0rn , that works

Thanks @p4d0rn works for me too..

I hope the problem will be solved permanently.
Or is it just wrong to use git clone to pull the current project?

docker-compose -f docker-compose.yml --compatibility up -d

worked for me too

refer to the link below:
https://medium.com/@fantomeofgames74/how-to-setup-crapi-in-ubuntu-server-and-make-it-network-accessible-5175bbf8ac8e
working for me

This works for me. Step1. comment the depends_on and healthcheck for crapi-web Container. Step2. docker-compose -f docker-compose.yml --compatibility up -d Step3. docker-compose restart

it works for me, thanks