Gitlab CI - Start Nginx for E2E testing










0















Summary: I just want to run a nginx reverse proxy inside gitlab-ci, which maps to containers that I start using docker-compose up, so that I can run E2E tests on my application automatically.



So, I have an application that has 3 services: 1 DB, 1 Node API, and 1 Nginx server, which is serving angular static files.



In production, these services sit behind a nginx reverse proxy.



I want to be able to run E2E tests using an environment very similar to production.
So I have created a base image to run my Continuous Integration tests, which looks like this:



FROM alpine:latest

# Use edge packages
RUN sed -i -e 's/v[[:digit:]].[[:digit:]]/edge/g' /etc/apk/repositories
RUN apk upgrade --update-cache --available

RUN apk update
RUN apk add npm
RUN apk add docker
RUN apk add py-pip
RUN pip install --upgrade pip
RUN pip install docker-compose
RUN apk add openrc --no-cache
RUN rc-update add docker boot
RUN npm install -g @angular/cli
RUN npm install -g protractor

# chromium dependencies
RUN apk add openjdk8-jre-base
RUN apk add nss
RUN apk add chromium-chromedriver
RUN apk add chromium
RUN apk upgrade --no-cache --available
ENV CHROME_BIN /usr/bin/chromium-browser
# netcat to test for docker-compose up
RUN apk add netcat-openbsd
# add netstat to get listening ports
RUN apk add net-tools

## Install nginx to run as reverse proxy
RUN apk add nginx
RUN rc-update add nginx boot
# Add nginx conf
COPY ./proxy.crt /etc/nginx/proxy.crt
COPY ./proxy.key /etc/nginx/proxy.key
COPY ./nginx.conf /etc/nginx/nginx.conf


My gitlab-ci.yml:



image: registry.gitlab.com/ldso18-19/t2g2/base_ci:1.0
services:
- docker:dind

stages:
- build
- test
- release
- deploy

variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
WEB_TEST_IMAGE: registry.gitlab.com/ldso18-19/t2g2/web:$CI_COMMIT_REF_SLUG
API_TEST_IMAGE: registry.gitlab.com/ldso18-19/t2g2/api:$CI_COMMIT_REF_SLUG
DB_TEST_IMAGE: registry.gitlab.com/ldso18-19/t2g2/db:$CI_COMMIT_REF_SLUG
WEB_RELEASE_IMAGE: registry.gitlab.com/ldso18-19/t2g2/web:latest
API_RELEASE_IMAGE: registry.gitlab.com/ldso18-19/t2g2/api:latest
DB_RELEASE_IMAGE: registry.gitlab.com/ldso18-19/t2g2/db:latest

before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com

web_integration_tests:
stage: test
script:
- rc-status
- nginx -t
- /etc/init.d/nginx start
- netstat -l
- docker-compose pull
- docker-compose up -d
- cd web/e2e
- sleep 10
- netstat -l
- protractor prod-conf.js


My nginx.conf file:



user nginx;
worker_processes 1;
pid /var/run/nginx.pid;

events

http
include /etc/nginx/mime.types;
# enable reverse proxy
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_ssl_session_reuse off;

server

server_name localhost;
listen 443 ssl;
listen [::]:443 ssl ipv6only=on; # managed by Certbot
ssl_certificate /etc/nginx/proxy.crt; # managed by Certbot
ssl_certificate_key /etc/nginx/proxy.key; # managed by Certbot
ssl_session_cache shared:le_nginx_SSL:1m;
ssl_session_timeout 1440m;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;

ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS";


# Reverse Proxying (ineeve)
location /
proxy_pass https://docker:4200;


location /api/
proxy_pass https://docker:8443/;



daemon off;


My docker-compose file:



version: '3.7'

services:
web:
image: registry.gitlab.com/project_name/web:42-ci
ports:
- 4200:4200
depends_on:
- api
db:
image: registry.gitlab.com/project_name/db:42-ci
ports:
- 5433:5432
volumes:
- postgres:/var/lib/postgresql/data
api:
image: registry.gitlab.com/project_name/api:42-ci
depends_on:
- db
ports:
- 8443:8443
volumes:
postgres:


The problem: when gitlab-ci runs I get the following error:



$ rc-status
Service `hwdrivers' needs non existent service `dev'
* Caching service dependencies ... [ ok ]
Runlevel: sysinit
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
Dynamic Runlevel: manual
$ nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ /etc/init.d/nginx start
* You are attempting to run an openrc service on a
* system which openrc did not boot.
* You may be inside a chroot or you may have used
* another initialization system to boot this system.
* In this situation, you will get unpredictable results!
* If you really want to do this, issue the following command:
* touch /run/openrc/softlevel
* ERROR: networking failed to start
* ERROR: cannot start nginx as networking would not start


Any help would be much appreciated because I have spent almost 10h trying different configurations.










share|improve this question






















  • Same thing here. I don't think the issue comes from your nginx conf. The issue might be the one with openrc not started at boot. I looked at the docker hub official nginx image and they start it this way CMD ["nginx", "-g", "daemon off;"] . Sounds Alpine completely rely on some kind of orchestrator to manage service availability. I commented this same issue about it github.com/gliderlabs/docker-alpine/issues/437. The op didn't have any answer on this issue...

    – stockersky
    Nov 13 '18 at 19:21












  • the issue appears to me that it's not so easy to start nginx on raw gitlabci? why not run the nginx inside the container as well?

    – Uku Loskit
    Nov 13 '18 at 23:35











  • @UkuLoskit, that's what I'm trying right now. I decided to put the reverse proxy in a container, and it seems to be working

    – Renato Campos
    Nov 14 '18 at 9:09















0















Summary: I just want to run a nginx reverse proxy inside gitlab-ci, which maps to containers that I start using docker-compose up, so that I can run E2E tests on my application automatically.



So, I have an application that has 3 services: 1 DB, 1 Node API, and 1 Nginx server, which is serving angular static files.



In production, these services sit behind a nginx reverse proxy.



I want to be able to run E2E tests using an environment very similar to production.
So I have created a base image to run my Continuous Integration tests, which looks like this:



FROM alpine:latest

# Use edge packages
RUN sed -i -e 's/v[[:digit:]].[[:digit:]]/edge/g' /etc/apk/repositories
RUN apk upgrade --update-cache --available

RUN apk update
RUN apk add npm
RUN apk add docker
RUN apk add py-pip
RUN pip install --upgrade pip
RUN pip install docker-compose
RUN apk add openrc --no-cache
RUN rc-update add docker boot
RUN npm install -g @angular/cli
RUN npm install -g protractor

# chromium dependencies
RUN apk add openjdk8-jre-base
RUN apk add nss
RUN apk add chromium-chromedriver
RUN apk add chromium
RUN apk upgrade --no-cache --available
ENV CHROME_BIN /usr/bin/chromium-browser
# netcat to test for docker-compose up
RUN apk add netcat-openbsd
# add netstat to get listening ports
RUN apk add net-tools

## Install nginx to run as reverse proxy
RUN apk add nginx
RUN rc-update add nginx boot
# Add nginx conf
COPY ./proxy.crt /etc/nginx/proxy.crt
COPY ./proxy.key /etc/nginx/proxy.key
COPY ./nginx.conf /etc/nginx/nginx.conf


My gitlab-ci.yml:



image: registry.gitlab.com/ldso18-19/t2g2/base_ci:1.0
services:
- docker:dind

stages:
- build
- test
- release
- deploy

variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
WEB_TEST_IMAGE: registry.gitlab.com/ldso18-19/t2g2/web:$CI_COMMIT_REF_SLUG
API_TEST_IMAGE: registry.gitlab.com/ldso18-19/t2g2/api:$CI_COMMIT_REF_SLUG
DB_TEST_IMAGE: registry.gitlab.com/ldso18-19/t2g2/db:$CI_COMMIT_REF_SLUG
WEB_RELEASE_IMAGE: registry.gitlab.com/ldso18-19/t2g2/web:latest
API_RELEASE_IMAGE: registry.gitlab.com/ldso18-19/t2g2/api:latest
DB_RELEASE_IMAGE: registry.gitlab.com/ldso18-19/t2g2/db:latest

before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com

web_integration_tests:
stage: test
script:
- rc-status
- nginx -t
- /etc/init.d/nginx start
- netstat -l
- docker-compose pull
- docker-compose up -d
- cd web/e2e
- sleep 10
- netstat -l
- protractor prod-conf.js


My nginx.conf file:



user nginx;
worker_processes 1;
pid /var/run/nginx.pid;

events

http
include /etc/nginx/mime.types;
# enable reverse proxy
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_ssl_session_reuse off;

server

server_name localhost;
listen 443 ssl;
listen [::]:443 ssl ipv6only=on; # managed by Certbot
ssl_certificate /etc/nginx/proxy.crt; # managed by Certbot
ssl_certificate_key /etc/nginx/proxy.key; # managed by Certbot
ssl_session_cache shared:le_nginx_SSL:1m;
ssl_session_timeout 1440m;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;

ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS";


# Reverse Proxying (ineeve)
location /
proxy_pass https://docker:4200;


location /api/
proxy_pass https://docker:8443/;



daemon off;


My docker-compose file:



version: '3.7'

services:
web:
image: registry.gitlab.com/project_name/web:42-ci
ports:
- 4200:4200
depends_on:
- api
db:
image: registry.gitlab.com/project_name/db:42-ci
ports:
- 5433:5432
volumes:
- postgres:/var/lib/postgresql/data
api:
image: registry.gitlab.com/project_name/api:42-ci
depends_on:
- db
ports:
- 8443:8443
volumes:
postgres:


The problem: when gitlab-ci runs I get the following error:



$ rc-status
Service `hwdrivers' needs non existent service `dev'
* Caching service dependencies ... [ ok ]
Runlevel: sysinit
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
Dynamic Runlevel: manual
$ nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ /etc/init.d/nginx start
* You are attempting to run an openrc service on a
* system which openrc did not boot.
* You may be inside a chroot or you may have used
* another initialization system to boot this system.
* In this situation, you will get unpredictable results!
* If you really want to do this, issue the following command:
* touch /run/openrc/softlevel
* ERROR: networking failed to start
* ERROR: cannot start nginx as networking would not start


Any help would be much appreciated because I have spent almost 10h trying different configurations.










share|improve this question






















  • Same thing here. I don't think the issue comes from your nginx conf. The issue might be the one with openrc not started at boot. I looked at the docker hub official nginx image and they start it this way CMD ["nginx", "-g", "daemon off;"] . Sounds Alpine completely rely on some kind of orchestrator to manage service availability. I commented this same issue about it github.com/gliderlabs/docker-alpine/issues/437. The op didn't have any answer on this issue...

    – stockersky
    Nov 13 '18 at 19:21












  • the issue appears to me that it's not so easy to start nginx on raw gitlabci? why not run the nginx inside the container as well?

    – Uku Loskit
    Nov 13 '18 at 23:35











  • @UkuLoskit, that's what I'm trying right now. I decided to put the reverse proxy in a container, and it seems to be working

    – Renato Campos
    Nov 14 '18 at 9:09













0












0








0








Summary: I just want to run a nginx reverse proxy inside gitlab-ci, which maps to containers that I start using docker-compose up, so that I can run E2E tests on my application automatically.



So, I have an application that has 3 services: 1 DB, 1 Node API, and 1 Nginx server, which is serving angular static files.



In production, these services sit behind a nginx reverse proxy.



I want to be able to run E2E tests using an environment very similar to production.
So I have created a base image to run my Continuous Integration tests, which looks like this:



FROM alpine:latest

# Use edge packages
RUN sed -i -e 's/v[[:digit:]].[[:digit:]]/edge/g' /etc/apk/repositories
RUN apk upgrade --update-cache --available

RUN apk update
RUN apk add npm
RUN apk add docker
RUN apk add py-pip
RUN pip install --upgrade pip
RUN pip install docker-compose
RUN apk add openrc --no-cache
RUN rc-update add docker boot
RUN npm install -g @angular/cli
RUN npm install -g protractor

# chromium dependencies
RUN apk add openjdk8-jre-base
RUN apk add nss
RUN apk add chromium-chromedriver
RUN apk add chromium
RUN apk upgrade --no-cache --available
ENV CHROME_BIN /usr/bin/chromium-browser
# netcat to test for docker-compose up
RUN apk add netcat-openbsd
# add netstat to get listening ports
RUN apk add net-tools

## Install nginx to run as reverse proxy
RUN apk add nginx
RUN rc-update add nginx boot
# Add nginx conf
COPY ./proxy.crt /etc/nginx/proxy.crt
COPY ./proxy.key /etc/nginx/proxy.key
COPY ./nginx.conf /etc/nginx/nginx.conf


My gitlab-ci.yml:



image: registry.gitlab.com/ldso18-19/t2g2/base_ci:1.0
services:
- docker:dind

stages:
- build
- test
- release
- deploy

variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
WEB_TEST_IMAGE: registry.gitlab.com/ldso18-19/t2g2/web:$CI_COMMIT_REF_SLUG
API_TEST_IMAGE: registry.gitlab.com/ldso18-19/t2g2/api:$CI_COMMIT_REF_SLUG
DB_TEST_IMAGE: registry.gitlab.com/ldso18-19/t2g2/db:$CI_COMMIT_REF_SLUG
WEB_RELEASE_IMAGE: registry.gitlab.com/ldso18-19/t2g2/web:latest
API_RELEASE_IMAGE: registry.gitlab.com/ldso18-19/t2g2/api:latest
DB_RELEASE_IMAGE: registry.gitlab.com/ldso18-19/t2g2/db:latest

before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com

web_integration_tests:
stage: test
script:
- rc-status
- nginx -t
- /etc/init.d/nginx start
- netstat -l
- docker-compose pull
- docker-compose up -d
- cd web/e2e
- sleep 10
- netstat -l
- protractor prod-conf.js


My nginx.conf file:



user nginx;
worker_processes 1;
pid /var/run/nginx.pid;

events

http
include /etc/nginx/mime.types;
# enable reverse proxy
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_ssl_session_reuse off;

server

server_name localhost;
listen 443 ssl;
listen [::]:443 ssl ipv6only=on; # managed by Certbot
ssl_certificate /etc/nginx/proxy.crt; # managed by Certbot
ssl_certificate_key /etc/nginx/proxy.key; # managed by Certbot
ssl_session_cache shared:le_nginx_SSL:1m;
ssl_session_timeout 1440m;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;

ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS";


# Reverse Proxying (ineeve)
location /
proxy_pass https://docker:4200;


location /api/
proxy_pass https://docker:8443/;



daemon off;


My docker-compose file:



version: '3.7'

services:
web:
image: registry.gitlab.com/project_name/web:42-ci
ports:
- 4200:4200
depends_on:
- api
db:
image: registry.gitlab.com/project_name/db:42-ci
ports:
- 5433:5432
volumes:
- postgres:/var/lib/postgresql/data
api:
image: registry.gitlab.com/project_name/api:42-ci
depends_on:
- db
ports:
- 8443:8443
volumes:
postgres:


The problem: when gitlab-ci runs I get the following error:



$ rc-status
Service `hwdrivers' needs non existent service `dev'
* Caching service dependencies ... [ ok ]
Runlevel: sysinit
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
Dynamic Runlevel: manual
$ nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ /etc/init.d/nginx start
* You are attempting to run an openrc service on a
* system which openrc did not boot.
* You may be inside a chroot or you may have used
* another initialization system to boot this system.
* In this situation, you will get unpredictable results!
* If you really want to do this, issue the following command:
* touch /run/openrc/softlevel
* ERROR: networking failed to start
* ERROR: cannot start nginx as networking would not start


Any help would be much appreciated because I have spent almost 10h trying different configurations.










share|improve this question














Summary: I just want to run a nginx reverse proxy inside gitlab-ci, which maps to containers that I start using docker-compose up, so that I can run E2E tests on my application automatically.



So, I have an application that has 3 services: 1 DB, 1 Node API, and 1 Nginx server, which is serving angular static files.



In production, these services sit behind a nginx reverse proxy.



I want to be able to run E2E tests using an environment very similar to production.
So I have created a base image to run my Continuous Integration tests, which looks like this:



FROM alpine:latest

# Use edge packages
RUN sed -i -e 's/v[[:digit:]].[[:digit:]]/edge/g' /etc/apk/repositories
RUN apk upgrade --update-cache --available

RUN apk update
RUN apk add npm
RUN apk add docker
RUN apk add py-pip
RUN pip install --upgrade pip
RUN pip install docker-compose
RUN apk add openrc --no-cache
RUN rc-update add docker boot
RUN npm install -g @angular/cli
RUN npm install -g protractor

# chromium dependencies
RUN apk add openjdk8-jre-base
RUN apk add nss
RUN apk add chromium-chromedriver
RUN apk add chromium
RUN apk upgrade --no-cache --available
ENV CHROME_BIN /usr/bin/chromium-browser
# netcat to test for docker-compose up
RUN apk add netcat-openbsd
# add netstat to get listening ports
RUN apk add net-tools

## Install nginx to run as reverse proxy
RUN apk add nginx
RUN rc-update add nginx boot
# Add nginx conf
COPY ./proxy.crt /etc/nginx/proxy.crt
COPY ./proxy.key /etc/nginx/proxy.key
COPY ./nginx.conf /etc/nginx/nginx.conf


My gitlab-ci.yml:



image: registry.gitlab.com/ldso18-19/t2g2/base_ci:1.0
services:
- docker:dind

stages:
- build
- test
- release
- deploy

variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
WEB_TEST_IMAGE: registry.gitlab.com/ldso18-19/t2g2/web:$CI_COMMIT_REF_SLUG
API_TEST_IMAGE: registry.gitlab.com/ldso18-19/t2g2/api:$CI_COMMIT_REF_SLUG
DB_TEST_IMAGE: registry.gitlab.com/ldso18-19/t2g2/db:$CI_COMMIT_REF_SLUG
WEB_RELEASE_IMAGE: registry.gitlab.com/ldso18-19/t2g2/web:latest
API_RELEASE_IMAGE: registry.gitlab.com/ldso18-19/t2g2/api:latest
DB_RELEASE_IMAGE: registry.gitlab.com/ldso18-19/t2g2/db:latest

before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com

web_integration_tests:
stage: test
script:
- rc-status
- nginx -t
- /etc/init.d/nginx start
- netstat -l
- docker-compose pull
- docker-compose up -d
- cd web/e2e
- sleep 10
- netstat -l
- protractor prod-conf.js


My nginx.conf file:



user nginx;
worker_processes 1;
pid /var/run/nginx.pid;

events

http
include /etc/nginx/mime.types;
# enable reverse proxy
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_ssl_session_reuse off;

server

server_name localhost;
listen 443 ssl;
listen [::]:443 ssl ipv6only=on; # managed by Certbot
ssl_certificate /etc/nginx/proxy.crt; # managed by Certbot
ssl_certificate_key /etc/nginx/proxy.key; # managed by Certbot
ssl_session_cache shared:le_nginx_SSL:1m;
ssl_session_timeout 1440m;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;

ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS";


# Reverse Proxying (ineeve)
location /
proxy_pass https://docker:4200;


location /api/
proxy_pass https://docker:8443/;



daemon off;


My docker-compose file:



version: '3.7'

services:
web:
image: registry.gitlab.com/project_name/web:42-ci
ports:
- 4200:4200
depends_on:
- api
db:
image: registry.gitlab.com/project_name/db:42-ci
ports:
- 5433:5432
volumes:
- postgres:/var/lib/postgresql/data
api:
image: registry.gitlab.com/project_name/api:42-ci
depends_on:
- db
ports:
- 8443:8443
volumes:
postgres:


The problem: when gitlab-ci runs I get the following error:



$ rc-status
Service `hwdrivers' needs non existent service `dev'
* Caching service dependencies ... [ ok ]
Runlevel: sysinit
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
Dynamic Runlevel: manual
$ nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ /etc/init.d/nginx start
* You are attempting to run an openrc service on a
* system which openrc did not boot.
* You may be inside a chroot or you may have used
* another initialization system to boot this system.
* In this situation, you will get unpredictable results!
* If you really want to do this, issue the following command:
* touch /run/openrc/softlevel
* ERROR: networking failed to start
* ERROR: cannot start nginx as networking would not start


Any help would be much appreciated because I have spent almost 10h trying different configurations.







docker nginx gitlab e2e-testing






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 16:00









Renato CamposRenato Campos

264




264












  • Same thing here. I don't think the issue comes from your nginx conf. The issue might be the one with openrc not started at boot. I looked at the docker hub official nginx image and they start it this way CMD ["nginx", "-g", "daemon off;"] . Sounds Alpine completely rely on some kind of orchestrator to manage service availability. I commented this same issue about it github.com/gliderlabs/docker-alpine/issues/437. The op didn't have any answer on this issue...

    – stockersky
    Nov 13 '18 at 19:21












  • the issue appears to me that it's not so easy to start nginx on raw gitlabci? why not run the nginx inside the container as well?

    – Uku Loskit
    Nov 13 '18 at 23:35











  • @UkuLoskit, that's what I'm trying right now. I decided to put the reverse proxy in a container, and it seems to be working

    – Renato Campos
    Nov 14 '18 at 9:09

















  • Same thing here. I don't think the issue comes from your nginx conf. The issue might be the one with openrc not started at boot. I looked at the docker hub official nginx image and they start it this way CMD ["nginx", "-g", "daemon off;"] . Sounds Alpine completely rely on some kind of orchestrator to manage service availability. I commented this same issue about it github.com/gliderlabs/docker-alpine/issues/437. The op didn't have any answer on this issue...

    – stockersky
    Nov 13 '18 at 19:21












  • the issue appears to me that it's not so easy to start nginx on raw gitlabci? why not run the nginx inside the container as well?

    – Uku Loskit
    Nov 13 '18 at 23:35











  • @UkuLoskit, that's what I'm trying right now. I decided to put the reverse proxy in a container, and it seems to be working

    – Renato Campos
    Nov 14 '18 at 9:09
















Same thing here. I don't think the issue comes from your nginx conf. The issue might be the one with openrc not started at boot. I looked at the docker hub official nginx image and they start it this way CMD ["nginx", "-g", "daemon off;"] . Sounds Alpine completely rely on some kind of orchestrator to manage service availability. I commented this same issue about it github.com/gliderlabs/docker-alpine/issues/437. The op didn't have any answer on this issue...

– stockersky
Nov 13 '18 at 19:21






Same thing here. I don't think the issue comes from your nginx conf. The issue might be the one with openrc not started at boot. I looked at the docker hub official nginx image and they start it this way CMD ["nginx", "-g", "daemon off;"] . Sounds Alpine completely rely on some kind of orchestrator to manage service availability. I commented this same issue about it github.com/gliderlabs/docker-alpine/issues/437. The op didn't have any answer on this issue...

– stockersky
Nov 13 '18 at 19:21














the issue appears to me that it's not so easy to start nginx on raw gitlabci? why not run the nginx inside the container as well?

– Uku Loskit
Nov 13 '18 at 23:35





the issue appears to me that it's not so easy to start nginx on raw gitlabci? why not run the nginx inside the container as well?

– Uku Loskit
Nov 13 '18 at 23:35













@UkuLoskit, that's what I'm trying right now. I decided to put the reverse proxy in a container, and it seems to be working

– Renato Campos
Nov 14 '18 at 9:09





@UkuLoskit, that's what I'm trying right now. I decided to put the reverse proxy in a container, and it seems to be working

– Renato Campos
Nov 14 '18 at 9:09












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284890%2fgitlab-ci-start-nginx-for-e2e-testing%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284890%2fgitlab-ci-start-nginx-for-e2e-testing%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)