dokku / dokku

A docker-powered PaaS that helps you build and manage the lifecycle of applications
https://dokku.com
MIT License
29.07k stars 1.92k forks source link

dokku 0.35.5 all deployments fail due to broken nginx.config #7277

Open e11bits opened 7 hours ago

e11bits commented 7 hours ago

Description of problem

Today all of my depolyments fail:

[emerg] 1684694#1684694: invalid number of arguments in "client_body_timeout" directive in /home/dokku/smartroute/nginx.conf:10

This is due to the following in the nginx config:

client_body_timeout < no value >; client_header_timeout < no value >; keepalive_timeout < no value >;
lingering_timeout < no value >;
send_timeout < no value >;

Even in apps where I don't have nginx.conf.sigil override, the deployment fails.

Steps to reproduce

dokku ps:rebuild www

dokku report $APP_NAME

-----> uname: Linux dokku 6.1.0-26-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.112-1 (2024-09-30) x86_64 GNU/Linux
-----> memory: 
                      total        used        free      shared  buff/cache   available
       Mem:            3819         978         328          53        2847        2840
       Swap:              0           0           0
-----> disk utilization: 
       Filesystem      Size  Used Avail Use% Mounted on
       /dev/sda1        19G  9.6G  8.1G  55% /
-----> disk inode utilization: 
       Filesystem     Inodes IUsed IFree IUse% Mounted on
       /dev/sda1        1.2M  290K  933K   24% /
-----> docker version: 
       Client: Docker Engine - Community
        Version:           27.3.1
        API version:       1.47
        Go version:        go1.22.7
        Git commit:        ce12230
        Built:             Fri Sep 20 11:41:11 2024
        OS/Arch:           linux/amd64
        Context:           default

       Server: Docker Engine - Community
        Engine:
         Version:          27.3.1
         API version:      1.47 (minimum version 1.24)
         Go version:       go1.22.7
         Git commit:       41ca978
         Built:            Fri Sep 20 11:41:11 2024
         OS/Arch:          linux/amd64
         Experimental:     false
        containerd:
         Version:          1.7.22
         GitCommit:        7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c
        runc:
         Version:          1.1.14
         GitCommit:        v1.1.14-0-g2c9f560
        docker-init:
         Version:          0.19.0
         GitCommit:        de40ad0
-----> docker daemon info: 
       Client: Docker Engine - Community
        Version:    27.3.1
        Context:    default
        Debug Mode: true
        Plugins:
         buildx: Docker Buildx (Docker Inc.)
           Version:  v0.17.1
           Path:     /usr/libexec/docker/cli-plugins/docker-buildx
         compose: Docker Compose (Docker Inc.)
           Version:  v2.29.7
           Path:     /usr/libexec/docker/cli-plugins/docker-compose

       Server:
        Containers: 8
         Running: 8
         Paused: 0
         Stopped: 0
        Images: 34
        Server Version: 27.3.1
        Storage Driver: overlay2
         Backing Filesystem: extfs
         Supports d_type: true
         Using metacopy: false
         Native Overlay Diff: true
         userxattr: false
        Logging Driver: json-file
        Cgroup Driver: systemd
        Cgroup Version: 2
        Plugins:
         Volume: local
         Network: bridge host ipvlan macvlan null overlay
         Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
        Swarm: inactive
        Runtimes: io.containerd.runc.v2 runc
        Default Runtime: runc
        Init Binary: docker-init
        containerd version: 7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c
        runc version: v1.1.14-0-g2c9f560
        init version: de40ad0
        Security Options:
         apparmor
         seccomp
          Profile: builtin
         cgroupns
        Kernel Version: 6.1.0-26-amd64
        Operating System: Debian GNU/Linux 12 (bookworm)
        OSType: linux
        Architecture: x86_64
        CPUs: 2
        Total Memory: 3.73GiB
        Name: dokku
        ID: d8ba57ca-d64e-4f08-b5fb-f422b039e58d
        Docker Root Dir: /var/lib/docker
        Debug Mode: false
         File Descriptors: 74
         Goroutines: 76
         System Time: 2024-10-17T16:12:35.222668247Z
         EventsListeners: 1
        Experimental: false
        Insecure Registries:
         127.0.0.0/8
        Live Restore Enabled: false

WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
-----> herokuish version: 
 !     Herokuish image gliderlabs/herokuish:latest-24 is not available
-----> dokku version: dokku version 0.35.5
-----> dokku-event-listener version: v0.17.0
-----> dokku-update version: dokku-update v0.9.5
-----> docker-container-healthchecker version: v0.11.3
-----> docker-image-labeler version: v0.8.0
-----> git version: git version 2.39.5
-----> lambda-builder version:        v0.8.0                                                                          
-----> netrc version: v0.10.0
 !     pack binary is not available
-----> plugn version: plugn: v0.16.0
-----> sigil version: v0.11.0
-----> sshcommand version: sshcommand v0.18.1
-----> dokku plugins: 
         00_dokku-standard    0.35.5 enabled    dokku core standard plugin
         20_events            0.35.5 enabled    dokku core events logging plugin
         app-json             0.35.5 enabled    dokku core app-json plugin
         apps                 0.35.5 enabled    dokku core apps plugin
         builder              0.35.5 enabled    dokku core builder plugin
         builder-dockerfile   0.35.5 enabled    dokku core builder-dockerfile plugin
         builder-herokuish    0.35.5 enabled    dokku core builder-herokuish plugin
         builder-lambda       0.35.5 enabled    dokku core builder-lambda plugin
         builder-nixpacks     0.35.5 enabled    dokku core builder-nixpacks plugin
         builder-null         0.35.5 enabled    dokku core builder-null plugin
         builder-pack         0.35.5 enabled    dokku core builder-pack plugin
         buildpacks           0.35.5 enabled    dokku core buildpacks plugin
         caddy-vhosts         0.35.5 enabled    dokku core caddy-vhosts plugin
         certs                0.35.5 enabled    dokku core certificate management plugin
         checks               0.35.5 enabled    dokku core checks plugin
         common               0.35.5 enabled    dokku core common plugin
         config               0.35.5 enabled    dokku core config plugin
         cron                 0.35.5 enabled    dokku core cron plugin
         docker-options       0.35.5 enabled    dokku core docker-options plugin
         domains              0.35.5 enabled    dokku core domains plugin
         enter                0.35.5 enabled    dokku core enter plugin
         git                  0.35.5 enabled    dokku core git plugin
         haproxy-vhosts       0.35.5 enabled    dokku core haproxy-vhosts plugin
         letsencrypt          0.20.4 enabled    Automated installation of let's encrypt TLS certificates
         logs                 0.35.5 enabled    dokku core logs plugin
         network              0.35.5 enabled    dokku core network plugin
         nginx-vhosts         0.35.5 enabled    dokku core nginx-vhosts plugin
         openresty-vhosts     0.35.5 enabled    dokku core openresty-vhosts plugin
         plugin               0.35.5 enabled    dokku core plugin plugin
         ports                0.35.5 enabled    dokku core ports plugin
         postgres             1.39.0 enabled    dokku postgres service plugin
         proxy                0.35.5 enabled    dokku core proxy plugin
         ps                   0.35.5 enabled    dokku core ps plugin
         registry             0.35.5 enabled    dokku core registry plugin
         repo                 0.35.5 enabled    dokku core repo plugin
         resource             0.35.5 enabled    dokku core resource plugin
         run                  0.35.5 enabled    dokku core run plugin
         scheduler            0.35.5 enabled    dokku core scheduler plugin
         scheduler-docker-local 0.35.5 enabled    dokku core scheduler-docker-local plugin
         scheduler-k3s        0.35.5 enabled    dokku core scheduler-k3s plugin
         scheduler-null       0.35.5 enabled    dokku core scheduler-null plugin
         shell                0.35.5 enabled    dokku core shell plugin
         ssh-keys             0.35.5 enabled    dokku core ssh-keys plugin
         storage              0.35.5 enabled    dokku core storage plugin
         trace                0.35.5 enabled    dokku core trace plugin
         traefik-vhosts       0.35.5 enabled    dokku core traefik-vhosts plugin
=====> www app-json information
       App json computed selected:    app.json
       App json global selected:      app.json
       App json selected:             
=====> www app information
       App created at:                1703539802
       App deploy source:             git-push
       App deploy source metadata:    f488c20c80ed97cecbd22d08ad60943c93b8bc39
       App dir:                       /home/dokku/www
       App locked:                    false
=====> www builder information
       Builder build dir:             
       Builder computed build dir:    
       Builder computed selected:     
       Builder global build dir:      
       Builder global selected:       
       Builder selected:              
=====> www builder-dockerfile information
       Builder dockerfile computed dockerfile path: Dockerfile               
       Builder dockerfile global dockerfile path: Dockerfile               
       Builder dockerfile dockerfile path:                          
=====> www builder-herokuish information
       Builder herokuish computed allowed: true                     
       Builder herokuish global allowed: true                     
       Builder herokuish allowed:                              
=====> www builder-lambda information
       Builder lambda computed lambdayml path: lambda.yml               
       Builder lambda global lambdayml path: lambda.yml               
       Builder lambda lambdayml path:                          
=====> www builder-nixpacks information
       Builder nixpacks computed nixpackstoml path: nixpacks.toml            
       Builder nixpacks global nixpackstoml path: nixpacks.toml            
       Builder nixpacks nixpackstoml path:                          
       Builder nixpacks computed no cache: false                    
       Builder nixpacks global no cache: false                    
       Builder nixpacks no cache:                              
=====> www builder-pack information
       Builder pack computed projecttoml path: project.toml             
       Builder pack global projecttoml path: project.toml             
       Builder pack projecttoml path:                          
=====> www buildpacks information
       Buildpacks computed stack:     gliderlabs/herokuish:latest-24
       Buildpacks global stack:       
       Buildpacks list:               
       Buildpacks stack:              
=====> www caddy information
       Caddy image:                   lucaslorentz/caddy-docker-proxy:2.9
       Caddy letsencrypt email:                                
       Caddy letsencrypt server:      https://acme-v02.api.letsencrypt.org/directory
       Caddy log level:               ERROR                    
       Caddy polling interval:        5s                       
       Caddy tls internal:            false                    
=====> www ssl information
       Ssl dir:                       /home/dokku/www/tls      
       Ssl enabled:                   true                     
       Ssl hostnames:                 e11bits.com lazarevic.de www.e11bits.com www.lazarevic.de
       Ssl expires at:                Dec 28 02:30:26 2024 GMT 
       Ssl issuer:                    C = US, O = Let's Encrypt, CN = E6
       Ssl starts at:                 Sep 29 02:30:27 2024 GMT 
       Ssl subject:                   subject=CN = www.e11bits.com
       Ssl verified:                  verified by a certificate authority
=====> www checks information
       Checks disabled list:          none                     
       Checks skipped list:           none                     
       Checks computed wait to retire: 60                       
       Checks global wait to retire:  60                       
       Checks wait to retire:                                  
=====> www docker options information
       Docker options build:                                   
       Docker options deploy:         --restart=on-failure:10  
       Docker options run:                                     
=====> www domains information
       Domains app enabled:           true                     
       Domains app vhosts:            www.e11bits.com www.lazarevic.de e11bits.com lazarevic.de
       Domains global enabled:        true                     
       Domains global vhosts:         e11bits.com              
=====> www git information
       Git deploy branch:             main                     
       Git global deploy branch:      master                   
       Git keep git dir:              false                    
       Git rev env var:               GIT_REV                  
       Git sha:                       HEAD                     
       Git source image:                                       
       Git last updated at:           1728557117               
=====> www haproxy information
       Haproxy image:                 byjg/easy-haproxy:4.4.0  
       Haproxy letsencrypt email:                              
       Haproxy letsencrypt server:    https://acme-v02.api.letsencrypt.org/directory
       Haproxy log level:             ERROR                    
=====> www letsencrypt information
       Letsencrypt active:            true                     
       Letsencrypt autorenew:         true                     
       Letsencrypt computed dns provider:                          
       Letsencrypt global dns provider:                          
       Letsencrypt dns provider:                               
       Letsencrypt computed email:    laza@e11bits.com         
       Letsencrypt global email:      laza@e11bits.com         
       Letsencrypt email:                                      
       Letsencrypt expiration:        1735353026               
       Letsencrypt computed graceperiod: 2592000                  
       Letsencrypt global graceperiod:                          
       Letsencrypt graceperiod:                                
       Letsencrypt computed lego docker args:                          
       Letsencrypt global lego docker args:                          
       Letsencrypt lego docker args:                           
       Letsencrypt computed server:   https://acme-v02.api.letsencrypt.org/directory
       Letsencrypt global server:                              
       Letsencrypt server:                                     
=====> www logs information
       Logs computed max size:        10m
       Logs global max size:          10m
       Logs global vector sink:       
       Logs max size:                 
       Logs vector global image:      timberio/vector:0.41.1-debian
       Logs vector sink:              
=====> www network information
       Network attach post create:           
       Network attach post deploy:           
       Network bind all interfaces:          false
       Network computed attach post create:  
       Network computed attach post deploy:  
       Network computed bind all interfaces: false
       Network computed initial network:     
       Network computed tld:                 
       Network global attach post create:    
       Network global attach post deploy:    
       Network global bind all interfaces:   false
       Network global initial network:       
       Network global tld:                   
       Network initial network:              
       Network static web listener:          
       Network tld:                          
       Network web listeners:                172.17.0.5:5000
=====> www nginx information
       Nginx access log format:                                
       Nginx computed access log format:                          
       Nginx global access log format:                          
       Nginx access log path:                                  
       Nginx computed access log path: /var/log/nginx/www-access.log
       Nginx global access log path:  /var/log/nginx/www-access.log
       Nginx bind address ipv4:                                
       Nginx computed bind address ipv4:                          
       Nginx global bind address ipv4:                          
       Nginx bind address ipv6:                                
       Nginx computed bind address ipv6: ::                       
       Nginx global bind address ipv6: ::                       
       Nginx client max body size:                             
       Nginx computed client max body size: 1m                       
       Nginx global client max body size: 1m                       
       Nginx disable custom config:                            
       Nginx computed disable custom config: false                    
       Nginx global disable custom config: false                    
       Nginx error log path:                                   
       Nginx computed error log path: /var/log/nginx/www-error.log
       Nginx global error log path:   /var/log/nginx/www-error.log
       Nginx hsts include subdomains:                          
       Nginx computed hsts include subdomains: true                     
       Nginx global hsts include subdomains: true                     
       Nginx hsts max age:                                     
       Nginx computed hsts max age:   15724800                 
       Nginx global hsts max age:     15724800                 
       Nginx hsts preload:                                     
       Nginx computed hsts preload:   false                    
       Nginx global hsts preload:     false                    
       Nginx hsts:                                             
       Nginx computed hsts:           true                     
       Nginx global hsts:             true                     
       Nginx last visited at:                                  
       Nginx nginx conf sigil path:                            
       Nginx computed nginx conf sigil path: nginx.conf.sigil         
       Nginx global nginx conf sigil path: nginx.conf.sigil         
       Nginx proxy buffer size:                                
       Nginx computed proxy buffer size: 4k                       
       Nginx global proxy buffer size: 4k                       
       Nginx proxy buffering:                                  
       Nginx computed proxy buffering: on                       
       Nginx global proxy buffering:  on                       
       Nginx proxy buffers:                                    
       Nginx computed proxy buffers:  8 4k                     
       Nginx global proxy buffers:    8 4k                     
       Nginx proxy busy buffers size:                          
       Nginx computed proxy busy buffers size: 8k                       
       Nginx global proxy busy buffers size: 8k                       
       Nginx proxy read timeout:                               
       Nginx computed proxy read timeout: 60s                      
       Nginx global proxy read timeout: 60s                      
       Nginx underscore in headers:                            
       Nginx computed underscore in headers: off                      
       Nginx global underscore in headers: off                      
       Nginx x forwarded for value:                            
       Nginx computed x forwarded for value: $remote_addr             
       Nginx global x forwarded for value: $remote_addr             
       Nginx x forwarded port value:                           
       Nginx computed x forwarded port value: $server_port             
       Nginx global x forwarded port value: $server_port             
       Nginx x forwarded proto value:                          
       Nginx computed x forwarded proto value: $scheme                  
       Nginx global x forwarded proto value: $scheme                  
       Nginx x forwarded ssl:                                  
       Nginx computed x forwarded ssl:                          
       Nginx global x forwarded ssl:                           
=====> www openresty information
       Openresty access log format:                            
       Openresty access log path:     /var/log/nginx/www-access.log
       Openresty allowed letsencrypt domains func base64: cmV0dXJuIHRydWUK         
       Openresty bind address ipv4:                            
       Openresty bind address ipv6:   ::                       
       Openresty client max body size:                          
       Openresty error log path:      /var/log/nginx/www-error.log
       Openresty global hsts:         true                     
       Openresty computed hsts:       true                     
       Openresty hsts:                                         
       Openresty hsts include subdomains: true                     
       Openresty hsts max age:        15724800                 
       Openresty hsts preload:        false                    
       Openresty image:               dokku/openresty-docker-proxy:0.9.1
       Openresty letsencrypt email:                            
       Openresty letsencrypt server:  https://acme-v02.api.letsencrypt.org/directory
       Openresty proxy buffer size:   4k                       
       Openresty proxy buffering:     on                       
       Openresty proxy buffers:       8 4k                     
       Openresty proxy busy buffers size: 8k                       
       Openresty proxy read timeout:  60s                      
       Openresty underscore in headers: off                      
       Openresty x forwarded for value: $remote_addr             
       Openresty x forwarded port value: $server_port             
       Openresty x forwarded proto value: $scheme                  
       Openresty x forwarded ssl:                              
=====> www ports information
       Ports map:                     
       Ports map detected:            http:80:5000 https:443:5000
=====> www proxy information
       Proxy computed type:           nginx
       Proxy enabled:                 true
       Proxy global type:             nginx
       Proxy type:                    
=====> www ps information
       Deployed:                      true
       Processes:                     1
       Ps can scale:                  true
       Ps computed procfile path:     Procfile
       Ps global procfile path:       Procfile
       Ps procfile path:              
       Ps restart policy:             on-failure:10
       Restore:                       true
       Running:                       true
       Status web 1:                  running (CID: edbda794091)
=====> www registry information
       Registry computed image repo:        dokku/www
       Registry computed push on release:   false
       Registry computed server:            
       Registry global image repo template: 
       Registry global push on release:     
       Registry global server:              
       Registry image repo:                 
       Registry push extra tags:            
       Registry push on release:            
       Registry server:                     
       Registry tag version:                
=====> www resource information
=====> www scheduler information
       Scheduler computed selected:   docker-local
       Scheduler global selected:     docker-local
       Scheduler selected:            
=====> www scheduler-docker-local information
       Scheduler docker local init process: true                     
       Scheduler docker local parallel schedule count:                          
=====> www scheduler-k3s information
       Scheduler k3s computed deploy timeout:       300s
       Scheduler k3s computed image pull secrets:   
       Scheduler k3s computed letsencrypt server:   prod
       Scheduler k3s computed namespace:            default
       Scheduler k3s computed rollback on failure:  false
       Scheduler k3s deploy timeout:                
       Scheduler k3s global deploy timeout:         300s
       Scheduler k3s global image pull secrets:     
       Scheduler k3s global ingress class:          nginx
       Scheduler k3s global kube context:           
       Scheduler k3s global kubeconfig path:        /etc/rancher/k3s/k3s.yaml
       Scheduler k3s global letsencrypt email prod: 
       Scheduler k3s global letsencrypt email stag: 
       Scheduler k3s global letsencrypt server:     prod
       Scheduler k3s global namespace:              default
       Scheduler k3s global network interface:      eth0
       Scheduler k3s global rollback on failure:    false
       Scheduler k3s image pull secrets:            
       Scheduler k3s letsencrypt server:            
       Scheduler k3s namespace:                     
       Scheduler k3s rollback on failure:           
=====> www storage information
       Storage build mounts:                                   
       Storage deploy mounts:                                  
       Storage run mounts:                                     
=====> www traefik information
       Traefik api enabled:           false                    
       Traefik api vhost:             traefik.dokku.me         
       Traefik basic auth password:                            
       Traefik basic auth username:                            
       Traefik dashboard enabled:     false                    
       Traefik image:                 traefik:3.1.5            
       Traefik letsencrypt email:                              
       Traefik letsencrypt server:    https://acme-v02.api.letsencrypt.org/directory
       Traefik log level:             ERROR                    
       Traefik http entry point:      http                     
       Traefik https entry point:     https

Additional information

No response

Output of failing commands after running: dokku trace:off

No response

Output of failing commands after running: dokku trace:on

No response

josegonzalez commented 7 hours ago

Did you pull the latest nginx.conf.sigil from the master branch? That one has extra timeout options that aren't yet released, which would be the only reason for a failing deploy...

josegonzalez commented 7 hours ago

Yeah, this is the file thats in the v0.35.5 release: https://github.com/dokku/dokku/blob/v0.35.5/plugins/nginx-vhosts/templates/nginx.conf.sigil

e11bits commented 7 hours ago

I used the latest nginx.conf.sigil from github for some apps and when I setup a new app today it broke because of that. Then I used the nginx.conf.sigil of v0.35.5, but it failed again. Then I removed the nginx.conf.sigil altogether to see if it would work and it still fails.

During the depolyment I see:

-----> Configuring bongo.e11bits.com...(using built-in template)
-----> Creating http nginx.conf
Reloading nginx
! Failed to validate nginx config for smartroute. Contents below...

So no nginx.conf.sigil is used to override the nginx.conf here, but it stillfails.

josegonzalez commented 7 hours ago

Is smartroute the app that is being deployed? Are you installing Dokku from source?

What is the output of the following command:

cat /var/lib/dokku/plugins/enabled/nginx-vhosts/templates/nginx.conf.sigil
e11bits commented 6 hours ago

smartroute is the app. (bongo was just an app deploy and see without nginx.conf.sigil).

From Packages for Debian: https://packagecloud.io/dokku/dokku/debian bookworm main

cat /var/lib/dokku/plugins/enabled/nginx-vhosts/templates/nginx.conf.sigil

{{ range $port_map := .PROXY_PORT_MAP | split " " }}
{{ $port_map_list := $port_map | split ":" }}
{{ $scheme := index $port_map_list 0 }}
{{ $listen_port := index $port_map_list 1 }}
{{ $upstream_port := index $port_map_list 2 }}

{{ if eq $scheme "http" }}
server {
  listen      [{{ $.NGINX_BIND_ADDRESS_IP6 }}]:{{ $listen_port }};
  listen      {{ if $.NGINX_BIND_ADDRESS_IP4 }}{{ $.NGINX_BIND_ADDRESS_IP4 }}:{{end}}{{ $listen_port }};
  {{ if $.NOSSL_SERVER_NAME }}server_name {{ $.NOSSL_SERVER_NAME }}; {{ end }}
  access_log  {{ $.NGINX_ACCESS_LOG_PATH }}{{ if and ($.NGINX_ACCESS_LOG_FORMAT) (ne $.NGINX_ACCESS_LOG_PATH "off") }} {{ $.NGINX_ACCESS_LOG_FORMAT }}{{ end }};
  error_log   {{ $.NGINX_ERROR_LOG_PATH }};
  underscores_in_headers {{ $.NGINX_UNDERSCORE_IN_HEADERS }};
{{ if (and (eq $listen_port "80") ($.SSL_INUSE)) }}
  include {{ $.DOKKU_ROOT }}/{{ $.APP }}/nginx.conf.d/*.conf;
  location / {
    return 301 https://$host:{{ $.PROXY_SSL_PORT }}$request_uri;
  }
{{ else }}
  location    / {

    gzip on;
    gzip_min_length  1100;
    gzip_buffers  4 32k;
    gzip_types    text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/wasm application/json application/xml application/rss+xml font/truetype application/x-font-ttf font/opentype application/vnd.ms-fontobject image/svg+xml;
    gzip_vary on;
    gzip_comp_level  6;

    proxy_pass  http://{{ $.APP }}-{{ $upstream_port }};
    proxy_http_version 1.1;
    proxy_read_timeout {{ $.PROXY_READ_TIMEOUT }};
    proxy_buffer_size {{ $.PROXY_BUFFER_SIZE }};
    proxy_buffering {{ $.PROXY_BUFFERING }};
    proxy_buffers {{ $.PROXY_BUFFERS }};
    proxy_busy_buffers_size {{ $.PROXY_BUSY_BUFFERS_SIZE }};
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For {{ $.PROXY_X_FORWARDED_FOR }};
    proxy_set_header X-Forwarded-Port {{ $.PROXY_X_FORWARDED_PORT }};
    proxy_set_header X-Forwarded-Proto {{ $.PROXY_X_FORWARDED_PROTO }};
    proxy_set_header X-Request-Start $msec;
    {{ if $.PROXY_X_FORWARDED_SSL }}proxy_set_header X-Forwarded-Ssl {{ $.PROXY_X_FORWARDED_SSL }};{{ end }}
  }

  {{ if $.CLIENT_MAX_BODY_SIZE }}client_max_body_size {{ $.CLIENT_MAX_BODY_SIZE }};{{ end }}

  error_page 400 401 402 403 405 406 407 408 409 410 411 412 413 414 415 416 417 418 420 422 423 424 426 428 429 431 444 449 450 451 /400-error.html;
  location /400-error.html {
    root {{ $.DOKKU_LIB_ROOT }}/data/nginx-vhosts/dokku-errors;
    internal;
  }

  error_page 404 /404-error.html;
  location /404-error.html {
    root {{ $.DOKKU_LIB_ROOT }}/data/nginx-vhosts/dokku-errors;
    internal;
  }

  error_page 500 501 502 503 504 505 506 507 508 509 510 511 /500-error.html;
  location /500-error.html {
    root {{ $.DOKKU_LIB_ROOT }}/data/nginx-vhosts/dokku-errors;
    internal;
  }
  include {{ $.DOKKU_ROOT }}/{{ $.APP }}/nginx.conf.d/*.conf;
{{ end }}
}
{{ else if eq $scheme "https"}}
server {
  listen      [{{ $.NGINX_BIND_ADDRESS_IP6 }}]:{{ $listen_port }} ssl {{ if eq $.HTTP2_SUPPORTED "true" }}http2{{ end }};
  listen      {{ if $.NGINX_BIND_ADDRESS_IP4 }}{{ $.NGINX_BIND_ADDRESS_IP4 }}:{{end}}{{ $listen_port }} ssl {{ if eq $.HTTP2_SUPPORTED "true" }}http2{{ end }};
  {{ if $.SSL_SERVER_NAME }}server_name {{ $.SSL_SERVER_NAME }}; {{ end }}
  {{ if $.NOSSL_SERVER_NAME }}server_name {{ $.NOSSL_SERVER_NAME }}; {{ end }}
  access_log  {{ $.NGINX_ACCESS_LOG_PATH }}{{ if and ($.NGINX_ACCESS_LOG_FORMAT) (ne $.NGINX_ACCESS_LOG_PATH "off") }} {{ $.NGINX_ACCESS_LOG_FORMAT }}{{ end }};
  error_log   {{ $.NGINX_ERROR_LOG_PATH }};
  underscores_in_headers {{ $.NGINX_UNDERSCORE_IN_HEADERS }};

  ssl_certificate           {{ $.APP_SSL_PATH }}/server.crt;
  ssl_certificate_key       {{ $.APP_SSL_PATH }}/server.key;
  ssl_protocols             TLSv1.2 {{ if eq $.TLS13_SUPPORTED "true" }}TLSv1.3{{ end }};
  ssl_prefer_server_ciphers off;

  keepalive_timeout   70;

  location    / {

    gzip on;
    gzip_min_length  1100;
    gzip_buffers  4 32k;
    gzip_types    text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml  application/rss+xml font/truetype application/x-font-ttf font/opentype application/vnd.ms-fontobject image/svg+xml;
    gzip_vary on;
    gzip_comp_level  6;

    proxy_pass  http://{{ $.APP }}-{{ $upstream_port }};
    {{ if eq $.HTTP2_PUSH_SUPPORTED "true" }}http2_push_preload on; {{ end }}
    proxy_http_version 1.1;
    proxy_read_timeout {{ $.PROXY_READ_TIMEOUT }};
    proxy_buffer_size {{ $.PROXY_BUFFER_SIZE }};
    proxy_buffering {{ $.PROXY_BUFFERING }};
    proxy_buffers {{ $.PROXY_BUFFERS }};
    proxy_busy_buffers_size {{ $.PROXY_BUSY_BUFFERS_SIZE }};
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For {{ $.PROXY_X_FORWARDED_FOR }};
    proxy_set_header X-Forwarded-Port {{ $.PROXY_X_FORWARDED_PORT }};
    proxy_set_header X-Forwarded-Proto {{ $.PROXY_X_FORWARDED_PROTO }};
    proxy_set_header X-Request-Start $msec;
    {{ if $.PROXY_X_FORWARDED_SSL }}proxy_set_header X-Forwarded-Ssl {{ $.PROXY_X_FORWARDED_SSL }};{{ end }}
  }

  {{ if $.CLIENT_MAX_BODY_SIZE }}client_max_body_size {{ $.CLIENT_MAX_BODY_SIZE }};{{ end }}

  error_page 400 401 402 403 405 406 407 408 409 410 411 412 413 414 415 416 417 418 420 422 423 424 426 428 429 431 444 449 450 451 /400-error.html;
  location /400-error.html {
    root {{ $.DOKKU_LIB_ROOT }}/data/nginx-vhosts/dokku-errors;
    internal;
  }

  error_page 404 /404-error.html;
  location /404-error.html {
    root {{ $.DOKKU_LIB_ROOT }}/data/nginx-vhosts/dokku-errors;
    internal;
  }

  error_page 500 501 503 504 505 506 507 508 509 510 511 /500-error.html;
  location /500-error.html {
    root {{ $.DOKKU_LIB_ROOT }}/data/nginx-vhosts/dokku-errors;
    internal;
  }

  error_page 502 /502-error.html;
  location /502-error.html {
    root {{ $.DOKKU_LIB_ROOT }}/data/nginx-vhosts/dokku-errors;
    internal;
  }
  include {{ $.DOKKU_ROOT }}/{{ $.APP }}/nginx.conf.d/*.conf;
}
{{ else if eq $scheme "grpc"}}
{{ if eq $.GRPC_SUPPORTED "true"}}{{ if eq $.HTTP2_SUPPORTED "true"}}
server {
  listen      [{{ $.NGINX_BIND_ADDRESS_IP6 }}]:{{ $listen_port }} http2;
  listen      {{ if $.NGINX_BIND_ADDRESS_IP4 }}{{ $.NGINX_BIND_ADDRESS_IP4 }}:{{end}}{{ $listen_port }} http2;
  {{ if $.NOSSL_SERVER_NAME }}server_name {{ $.NOSSL_SERVER_NAME }}; {{ end }}
  access_log  {{ $.NGINX_ACCESS_LOG_PATH }}{{ if and ($.NGINX_ACCESS_LOG_FORMAT) (ne $.NGINX_ACCESS_LOG_PATH "off") }} {{ $.NGINX_ACCESS_LOG_FORMAT }}{{ end }};
  error_log   {{ $.NGINX_ERROR_LOG_PATH }};
  underscores_in_headers {{ $.NGINX_UNDERSCORE_IN_HEADERS }};
  location    / {
    grpc_pass  grpc://{{ $.APP }}-{{ $upstream_port }};
  }

  {{ if $.CLIENT_MAX_BODY_SIZE }}client_max_body_size {{ $.CLIENT_MAX_BODY_SIZE }};{{ end }}
  include {{ $.DOKKU_ROOT }}/{{ $.APP }}/nginx.conf.d/*.conf;
}
{{ end }}{{ end }}
{{ else if eq $scheme "grpcs"}}
{{ if eq $.GRPC_SUPPORTED "true"}}{{ if eq $.HTTP2_SUPPORTED "true"}}
server {
  listen      [{{ $.NGINX_BIND_ADDRESS_IP6 }}]:{{ $listen_port }} ssl http2;
  listen      {{ if $.NGINX_BIND_ADDRESS_IP4 }}{{ $.NGINX_BIND_ADDRESS_IP4 }}:{{end}}{{ $listen_port }} ssl http2;
  {{ if $.NOSSL_SERVER_NAME }}server_name {{ $.NOSSL_SERVER_NAME }}; {{ end }}
  access_log  {{ $.NGINX_ACCESS_LOG_PATH }}{{ if and ($.NGINX_ACCESS_LOG_FORMAT) (ne $.NGINX_ACCESS_LOG_PATH "off") }} {{ $.NGINX_ACCESS_LOG_FORMAT }}{{ end }};
  error_log   {{ $.NGINX_ERROR_LOG_PATH }};
  underscores_in_headers {{ $.NGINX_UNDERSCORE_IN_HEADERS }};

  ssl_certificate           {{ $.APP_SSL_PATH }}/server.crt;
  ssl_certificate_key       {{ $.APP_SSL_PATH }}/server.key;
  ssl_protocols             TLSv1.2 {{ if eq $.TLS13_SUPPORTED "true" }}TLSv1.3{{ end }};
  ssl_prefer_server_ciphers off;

  location    / {
    grpc_pass  grpc://{{ $.APP }}-{{ $upstream_port }};
  }

  {{ if $.CLIENT_MAX_BODY_SIZE }}client_max_body_size {{ $.CLIENT_MAX_BODY_SIZE }};{{ end }}
  include {{ $.DOKKU_ROOT }}/{{ $.APP }}/nginx.conf.d/*.conf;
}
{{ end }}{{ end }}
{{ end }}
{{ end }}

{{ if $.DOKKU_APP_WEB_LISTENERS }}
{{ range $upstream_port := $.PROXY_UPSTREAM_PORTS | split " " }}
upstream {{ $.APP }}-{{ $upstream_port }} {
{{ range $listeners := $.DOKKU_APP_WEB_LISTENERS | split " " }}
{{ $listener_list := $listeners | split ":" }}
{{ $listener_ip := index $listener_list 0 }}
  server {{ $listener_ip }}:{{ $upstream_port }};{{ end }}
}
{{ end }}{{ end }}
josegonzalez commented 6 hours ago

Looks like the built-in one is fine, so this is just an issue with any apps with the vendored version. You're going to want to remove the nginx.conf.sigil from the smartroute app and redeploy it.

Is there a reason you are vendoring the nginx.conf.sigil vs just using what comes with Dokku?

e11bits commented 6 hours ago

I still don't know what was going on. An app that failed to deploy minutes ago just deploys now without changes. The last commit of the app is from Mon Sep 9 and I just did a dokku ps:rebuild <app> twice. Once failed and now ok.

I have no proof, but it felt like the bad nginx.conf.sigil got somehow "shared" between apps.

I apply the following patch to the builtin nginx.conf.sigil for my Django apps:

--- nginx.conf.sigil.orig   2023-12-25 15:38:08.562876767 +0700
+++ nginx.conf.sigil    2023-12-25 15:40:17.615942490 +0700
@@ -17,6 +17,12 @@
     return 301 https://$host:{{ $.PROXY_SSL_PORT }}$request_uri;
   }
 {{ else }}
+  ############## NEXT PART ADDED FOR django-project-template #####################################
+  location /assets/ {
+    root /var/lib/dokku/data/storage/{{ $.APP }}/;
+  }
+  ############## END OF PART ADDED FOR django-project-template ###################################
+
   location    / {

     gzip on;
@@ -81,6 +87,12 @@

   keepalive_timeout   70;

+  ############## NEXT PART ADDED FOR django-project-template #####################################
+  location /assets/ {
+    root /var/lib/dokku/data/storage/{{ $.APP }}/;
+  }
+  ############## END OF PART ADDED FOR django-project-template ###################################
+
   location    / {

     gzip on;