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

Nginx deployment issue #2052

Closed
ZiplEix opened this issue May 1, 2024 · 2 comments
Closed

Nginx deployment issue #2052

ZiplEix opened this issue May 1, 2024 · 2 comments

Comments

@ZiplEix
Copy link

ZiplEix commented May 1, 2024

What is the problem?

I mage a dockerfile to to deploy my flutter web site. To do this i use a multilayer dockerfile to build the web site and then serve it with nginx. like that :

...

FROM nginx:alpine
COPY --from=0 /app/build/web /usr/share/nginx/html

# config nginx lestener
RUN sed -i 's/listen       80;/listen       8080;/' /etc/nginx/conf.d/default.conf
COPY --from=0 /app/build/web /usr/share/nginx/html

# Expose port 80 and start Nginx server
EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]

On my computeur it work perfectly. But when I try to deploy it with cap rover y got this error log :

/docker-entrypoint.sh: Configuration complete; ready for start up
2024/04/30 20:49:13 [notice] 1#1: using the "epoll" event method
2024/04/30 20:49:13 [notice] 1#1: nginx/1.25.5
2024/04/30 20:49:13 [notice] 1#1: built by gcc 13.2.1 20231014 (Alpine 13.2.1_git20231014)
2024/04/30 20:49:13 [notice] 1#1: OS: Linux 5.4.0-162-generic
2024/04/30 20:49:13 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2024/04/30 20:49:13 [notice] 1#1: start worker processes
2024/04/30 20:49:13 [notice] 1#1: start worker process 28
2024/04/30 20:49:16 [notice] 1#1: signal 3 (SIGQUIT) received, shutting down
2024/04/30 20:49:16 [notice] 28#28: gracefully shutting down
2024/04/30 20:49:16 [notice] 28#28: exiting
2024/04/30 20:49:16 [notice] 28#28: exit
2024/04/30 20:49:16 [notice] 1#1: signal 3 (SIGQUIT) received, shutting down
2024/04/30 20:49:16 [notice] 29#29: gracefully shutting down
2024/04/30 20:49:16 [notice] 29#29: exiting
2024/04/30 20:49:16 [notice] 29#29: exit
2024/04/30 20:49:16 [notice] 1#1: signal 17 (SIGCHLD) received from 28
2024/04/30 20:49:16 [notice] 1#1: worker process 28 exited with code 0
2024/04/30 20:49:16 [notice] 1#1: exit
2024/04/30 20:49:16 [notice] 1#1: signal 17 (SIGCHLD) received from 29
2024/04/30 20:49:16 [notice] 1#1: worker process 29 exited with code 0
2024/04/30 20:49:16 [notice] 1#1: exit

I think that caprover shutdown the instance of nginx created by my dockerfile but I'm not realy shure and I don't know nginx very well. The other app that a deploy on my caprover work very well but they don't use nginx

The full log
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2024/04/30 20:38:47 [notice] 1#1: using the "epoll" event method
2024/04/30 20:38:47 [notice] 1#1: nginx/1.25.5
2024/04/30 20:38:47 [notice] 1#1: built by gcc 13.2.1 20231014 (Alpine 13.2.1_git20231014)
2024/04/30 20:38:47 [notice] 1#1: OS: Linux 5.4.0-162-generic
2024/04/30 20:38:47 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2024/04/30 20:38:47 [notice] 1#1: start worker processes
2024/04/30 20:38:47 [notice] 1#1: start worker process 29
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2024/04/30 20:49:10 [notice] 1#1: using the "epoll" event method
2024/04/30 20:49:10 [notice] 1#1: nginx/1.25.5
2024/04/30 20:49:10 [notice] 1#1: built by gcc 13.2.1 20231014 (Alpine 13.2.1_git20231014)
2024/04/30 20:49:10 [notice] 1#1: OS: Linux 5.4.0-162-generic
2024/04/30 20:49:10 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2024/04/30 20:49:10 [notice] 1#1: start worker processes
2024/04/30 20:49:10 [notice] 1#1: start worker process 28
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2024/04/30 20:49:13 [notice] 1#1: using the "epoll" event method
2024/04/30 20:49:13 [notice] 1#1: nginx/1.25.5
2024/04/30 20:49:13 [notice] 1#1: built by gcc 13.2.1 20231014 (Alpine 13.2.1_git20231014)
2024/04/30 20:49:13 [notice] 1#1: OS: Linux 5.4.0-162-generic
2024/04/30 20:49:13 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2024/04/30 20:49:13 [notice] 1#1: start worker processes
2024/04/30 20:49:13 [notice] 1#1: start worker process 28
2024/04/30 20:49:16 [notice] 1#1: signal 3 (SIGQUIT) received, shutting down
2024/04/30 20:49:16 [notice] 28#28: gracefully shutting down
2024/04/30 20:49:16 [notice] 28#28: exiting
2024/04/30 20:49:16 [notice] 28#28: exit
2024/04/30 20:49:16 [notice] 1#1: signal 3 (SIGQUIT) received, shutting down
2024/04/30 20:49:16 [notice] 29#29: gracefully shutting down
2024/04/30 20:49:16 [notice] 29#29: exiting
2024/04/30 20:49:16 [notice] 29#29: exit
2024/04/30 20:49:16 [notice] 1#1: signal 17 (SIGCHLD) received from 28
2024/04/30 20:49:16 [notice] 1#1: worker process 28 exited with code 0
2024/04/30 20:49:16 [notice] 1#1: exit
2024/04/30 20:49:16 [notice] 1#1: signal 17 (SIGCHLD) received from 29
2024/04/30 20:49:16 [notice] 1#1: worker process 29 exited with code 0
2024/04/30 20:49:16 [notice] 1#1: exit

If applicable, content of captain-definition file:

{
"schemaVersion": 2,
"dockerfilePath": "./Dockerfile"
}

Steps to reproduce the problem:

from what I see the probleme occurd every time nginx is involved in the dockerfile I want to deploy with caprover

Output of the following command on your server:

uname -a && lsb_release -a && free -h
@ZiplEix ZiplEix changed the title [Deployment Issue] Nginx deployment issue May 1, 2024
@githubsaturn
Copy link
Collaborator

On my computeur it work perfectly. But when I try to deploy it with cap rover y got this error log :

Two things to try out:

1- Change your Dockerfile to bare minimum, deploy and see if it works:

FROM nginx:alpine
CMD ["nginx", "-g", "daemon off;"]

If it works, then try:

FROM nginx:alpine
RUN sed -i 's/listen       80;/listen       8080;/' /etc/nginx/conf.d/default.conf
EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]

If it works, then the problem is the part of the Dockerfile that you removed

2- Build an image locally on your computer and push the exact same image to a docker registry and use the exact same image on CapRover. Does this work?

@githubsaturn
Copy link
Collaborator

To add more context:
CapRover DOES NOT stop a container automatically in any scenario.

@ZiplEix ZiplEix closed this as completed May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants