I intend to use the Gitlab CI for testing my Django APIs. I'm facing an issue with contacting the webserver that is being brought up in the before_script
part. For this, find my .gitlab-ci.yml
file config below:
image: <xyz>
services:
- mongo:3.2
before_script:
- pip install -r $CI_PROJECT_DIR/requirements.txt
- cd $CI_PROJECT_DIR/ && nohup python manage.py runserver 0.0.0.0:8000 &
- ps -ef | grep python
test:
script:
- curl -k http://0.0.0.0:8000
The webserver is getting created properly.
$ ps -ef | grep python
root 1119 6 0 11:43 ? 00:00:00 grep python
root 1120 1117 0 11:43 ? 00:00:00 python manage.py runserver 0.0.0.0:8000
But here, I am not able to contact my webserver. I had even tried curl on xyz:8000
as well as http://localhost:8000
but none of them worked.
The output of the curl command is as follows:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
I cannot use network host
mode as I'm linking services [mongo
] to my runner.
Any help/leads, please?