dokku: Dockerfile (with EXPOSE) HTTPS/SSL config is not generated correctly

Description of problem: On adding a wildcard certificate to an existing application we would expect the nginx.conf inside of the application folder to contain an https block, however it does not. The application is deployed via Dockerfile and exposes port 80 of the container.

Dokku reports that it thinks it has generated an https config in the output from the dokku certs:add command.

Adding a new domain to the app does update the nginx config, this shows that the config is writeable and working with other features.

Output of the following commands

$ uname -a
Linux instance-1 3.19.0-56-generic #62~14.04.1-Ubuntu SMP Fri Mar 11 11:03:15 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ free -m
             total       used       free     shared    buffers     cached
Mem:          7480       6706        774          0        286       3820
-/+ buffers/cache:       2599       4881
Swap:            0          0          0
$ docker version
Client:
 Version:      1.10.3
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   20f81dd
 Built:        Thu Mar 10 15:54:52 2016
 OS/Arch:      linux/amd64
Server:
 Version:      1.10.3
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   20f81dd
 Built:        Thu Mar 10 15:54:52 2016
 OS/Arch:      linux/amd64
$ docker -D info
Containers: 3
 Running: 2
 Paused: 0
 Stopped: 1
Images: 19
Server Version: 1.10.3
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 29
 Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Plugins: 
 Volume: local
 Network: host bridge null
Kernel Version: 3.19.0-56-generic
Operating System: Ubuntu 14.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.305 GiB
Name: instance-1
ID: 6NAN:VGFU:OP3F:4M43:AYKH:LXBQ:H3GM:3KZP:ARQT:7G4D:M243:S5QW
WARNING: No swap limit support
$ sigil -v
0.4.0
$ dokku version
0.5.2
$ dokku plugin
plugn: dev
  00_dokku-standard    0.5.2 enabled    dokku core standard plugin
  20_events            0.5.2 enabled    dokku core events logging plugin
  apps                 0.5.2 enabled    dokku core apps plugin
  build-env            0.5.2 enabled    dokku core build-env plugin
  certs                0.5.2 enabled    dokku core certificate management plugin
  checks               0.5.2 enabled    dokku core checks plugin
  common               0.5.2 enabled    dokku core common plugin
  config               0.5.2 enabled    dokku core config plugin
  deployment-keys      0.1.0 enabled    Manage SSH deployment keys that should get injected into your containers on-build
  docker-options       0.5.2 enabled    dokku core docker-options plugin
  domains              0.5.2 enabled    dokku core domains plugin
  enter                0.5.2 enabled    dokku core enter plugin
  git                  0.5.2 enabled    dokku core git plugin
  hostkeys-plugin      0.1.0 enabled    Manage hostkeys for your container environment
  logs                 0.5.2 enabled    dokku core logs plugin
  logspout             0.2.0 enabled    sends dokku app stdout to a logging service
  named-containers     0.5.2 enabled    dokku core named containers plugin
  nginx-vhosts         0.5.2 enabled    dokku core nginx-vhosts plugin
  plugin               0.5.2 enabled    dokku core plugin plugin
  proxy                0.5.2 enabled    dokku core proxy plugin
  ps                   0.5.2 enabled    dokku core ps plugin
  shell                0.5.2 enabled    dokku core shell plugin
  storage              0.5.2 enabled    dokku core storage plugin
  tags                 0.5.2 enabled    dokku core tags plugin
  tar                  0.5.2 enabled    dokku core tar plugin
$ cat /home/dokku/<app>/nginx.conf
server {
  listen      [::]:80;
  listen      80;
  server_name test.preview.example.com preview.example.com; 
  access_log  /var/log/nginx/preview.example.com-access.log;
  error_log   /var/log/nginx/preview.example.com-error.log;
  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://preview.example.com-80;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Port $server_port;
    proxy_set_header X-Request-Start $msec;
  }
}
include /home/dokku/preview.example.com/nginx.conf.d/*.conf;
upstream preview.example.com-80 {
  server 172.17.0.3:80;
}


Environment details (AWS, VirtualBox, physical, etc.): Google Cloud

How was dokku installed?: Using the apt-get install as per Dokku documentation.

How reproducible: Add wildcard certificate as per the certs:add command to the desired app, it reports that all is ok, and an https config has been generated. However this is not the case.

Steps to Reproduce:

  1. dokku certs:add <app> server.crt server.key
  2. dokku certs:info <app>
  3. sudo cat ~dokku/<app>/nginx.conf

Actual Results: No https/ssl block in the nginx.conf for the app.

Expected Results: To have an https/ssl block in the nginx.conf for the app in question.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 23 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Same here 😉

@Crispy1975 I think there’s two paths here.

  • Short term: First, to make this work today use a custom nginx template.
  • Long term: Second, someone implements the port mapping stuff that exposes nginx to app-container port mapping config.