dokku / dokku

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

"dokku git:sync --build" fails in the release phase because the app cant see a global environment variable #4737

Closed matijakolaric closed 3 years ago

matijakolaric commented 3 years ago

Description of problem

"dokku git:sync --build" fails in the release phase because the app cant see a global environment variable, on Django anyway. This started after upgrade to 0.25. After downgrading to 0.24.10, all is well.

  1. dokku config:set --global SECRET_KEY=whatever
  2. dokku git:sync --build demo git@github.com:matijakolaric-com/django-music-publisher.git

Actual Results

-----> Executing release task from Procfile: python manage.py migrate =====> Start of demo release task (2bf3d2b5a) output Traceback (most recent call last): File "manage.py", line 15, in execute_from_command_line(sys.argv) File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/init.py", line 419, in execute_from_command_line utility.execute() File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/init.py", line 395, in execute django.setup() File "/app/.heroku/python/lib/python3.8/site-packages/django/init.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/app/.heroku/python/lib/python3.8/site-packages/django/apps/registry.py", line 122, in populate app_config.ready() File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/admin/apps.py", line 27, in ready self.module.autodiscover() File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/admin/init.py", line 24, in autodiscover autodiscover_modules('admin', register_to=site) File "/app/.heroku/python/lib/python3.8/site-packages/django/utils/module_loading.py", line 47, in autodiscover_modules import_module('%s.%s' % (app_config.name, module_to_search)) File "/app/.heroku/python/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 783, in exec_module File "", line 219, in _call_with_frames_removed File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/auth/admin.py", line 6, in from django.contrib.auth.forms import ( File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/auth/forms.py", line 11, in from django.contrib.auth.tokens import default_token_generator File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/auth/tokens.py", line 117, in default_token_generator = PasswordResetTokenGenerator() File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/auth/tokens.py", line 18, in init self.secret = self.secret or settings.SECRET_KEY File "/app/.heroku/python/lib/python3.8/site-packages/django/conf/init.py", line 90, in getattr raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.") django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty. =====> End of demo release task (2bf3d2b5a) output ! Execution of release task failed: python manage.py migrate

Expected Results

Release phase should pass. (This particular app will fail in the web phase due to missing variables, if you get there, it's fine)

Environment Information

CURL_CONNECT_TIMEOUT: 90 CURL_TIMEOUT: 600 DOKKU_APP_TYPE: herokuish SECRET_KEY: whatever

dokku report APP_NAME output

-----> uname: Linux example.com 5.4.0-80-generic #90-Ubuntu SMP Fri Jul 9 22:49:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux -----> memory: total used free shared buff/cache available Mem: 1987 755 166 0 1065 1042 Swap: 2047 38 2009 -----> docker version: Client: Docker Engine - Community Version: 20.10.8 API version: 1.41 Go version: go1.16.6 Git commit: 3967b7d Built: Fri Jul 30 19:54:27 2021 OS/Arch: linux/amd64 Context: default Experimental: true

   Server: Docker Engine - Community
    Engine:
     Version:          20.10.8
     API version:      1.41 (minimum version 1.12)
     Go version:       go1.16.6
     Git commit:       75249d8
     Built:            Fri Jul 30 19:52:33 2021
     OS/Arch:          linux/amd64
     Experimental:     false
    containerd:
     Version:          1.4.9
     GitCommit:        e25210fe30a0a703442421b0f60afac609f950a3
    runc:
     Version:          1.0.1
     GitCommit:        v1.0.1-0-g4144b63
    docker-init:
     Version:          0.19.0
     GitCommit:        de40ad0

-----> docker daemon info: Client: WARNING: No swap limit support Context: default Debug Mode: true Plugins: app: Docker App (Docker Inc., v0.9.1-beta3) buildx: Build with BuildKit (Docker Inc., v0.6.1-docker) scan: Docker Scan (Docker Inc., v0.8.0)

   Server:
    Containers: 19
     Running: 13
     Paused: 0
     Stopped: 6
    Images: 93
    Server Version: 20.10.8
    Storage Driver: overlay2
     Backing Filesystem: extfs
     Supports d_type: true
     Native Overlay Diff: true
     userxattr: false
    Logging Driver: json-file
    Cgroup Driver: cgroupfs
    Cgroup Version: 1
    Plugins:
     Volume: local
     Network: bridge host ipvlan macvlan null overlay
     Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
    Swarm: inactive
    Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
    Default Runtime: runc
    Init Binary: docker-init
    containerd version: e25210fe30a0a703442421b0f60afac609f950a3
    runc version: v1.0.1-0-g4144b63
    init version: de40ad0
    Security Options:
     apparmor
     seccomp
      Profile: default
    Kernel Version: 5.4.0-80-generic
    Operating System: Ubuntu 20.04.2 LTS
    OSType: linux
    Architecture: x86_64
    CPUs: 2
    Total Memory: 1.941GiB
    Name: example.com
    ID: WTV5:O5NX:GI6J:ZZT5:SUW3:WGLK:D6PR:O36F:BOUZ:FXII:SGX6:ART6
    Docker Root Dir: /var/lib/docker
    Debug Mode: false
    Registry: https://index.docker.io/v1/
    Labels:
    Experimental: false
    Insecure Registries:
     127.0.0.0/8
    Live Restore Enabled: false

-----> git version: git version 2.25.1 -----> sigil version: 0.6.0 -----> herokuish version: herokuish: 0.5.30 buildpacks: heroku-buildpack-multi v1.0.0 heroku-buildpack-ruby v228 heroku-buildpack-nodejs v185 heroku-buildpack-clojure v87 heroku-buildpack-python v197 heroku-buildpack-java v69 heroku-buildpack-gradle v35 heroku-buildpack-scala v90 heroku-buildpack-play v26 heroku-buildpack-php v196 heroku-buildpack-go v153 buildpack-nginx v14 buildpack-null v3 -----> dokku version: dokku version 0.25.0 -----> plugn version: plugn: 0.6.1 -----> dokku plugins: 00_dokku-standard 0.25.0 enabled dokku core standard plugin 20_events 0.25.0 enabled dokku core events logging plugin app-json 0.25.0 enabled dokku core app-json plugin apps 0.25.0 enabled dokku core apps plugin apt 0.11.0 enabled Inject deb packages into dokku based on files in project builder 0.25.0 enabled dokku core builder plugin builder-dockerfile 0.25.0 enabled dokku core builder-dockerfile plugin builder-herokuish 0.25.0 enabled dokku core builder-herokuish plugin builder-null 0.25.0 enabled dokku core builder-null plugin builder-pack 0.25.0 enabled dokku core builder-pack plugin buildpacks 0.25.0 enabled dokku core buildpacks plugin certs 0.25.0 enabled dokku core certificate management plugin checks 0.25.0 enabled dokku core checks plugin common 0.25.0 enabled dokku core common plugin config 0.25.0 enabled dokku core config plugin cron 0.25.0 enabled dokku core cron plugin docker-options 0.25.0 enabled dokku core docker-options plugin domains 0.25.0 enabled dokku core domains plugin enter 0.25.0 enabled dokku core enter plugin git 0.25.0 enabled dokku core git plugin letsencrypt 0.9.4 enabled Automated installation of let's encrypt TLS certificates logs 0.25.0 enabled dokku core logs plugin network 0.25.0 enabled dokku core network plugin nginx-vhosts 0.25.0 enabled dokku core nginx-vhosts plugin plugin 0.25.0 enabled dokku core plugin plugin proxy 0.25.0 enabled dokku core proxy plugin ps 0.25.0 enabled dokku core ps plugin redirect 0.6.2 enabled Plugin for managing application redirects registry 0.24.0 enabled dokku core registry plugin repo 0.25.0 enabled dokku core repo plugin resource 0.25.0 enabled dokku core resource plugin run 0.25.0 enabled dokku core run plugin scheduler-docker-local 0.25.0 enabled dokku core scheduler-docker-local plugin scheduler-null 0.25.0 enabled dokku core scheduler-null plugin shell 0.25.0 enabled dokku core shell plugin ssh-keys 0.25.0 enabled dokku core ssh-keys plugin storage 0.25.0 enabled dokku core storage plugin tags 0.25.0 enabled dokku core tags plugin tar 0.25.0 enabled dokku core tar plugin trace 0.25.0 enabled dokku core trace plugin =====> demo app-json information App json computed selected: app.json App json global selected: app.json App json selected:
=====> demo app information App deploy source:
App dir: /home/dokku/demo App locked: true =====> demo builder information Builder build dir:
Builder computed build dir:
Builder computed selected:
Builder global build dir:
Builder global selected:
Builder selected:
=====> demo builder-dockerfile information Builder dockerfile computed dockerfile path: Dockerfile
Builder dockerfile global dockerfile path: Dockerfile
Builder dockerfile dockerfile path:
=====> demo builder-pack information Builder pack computed projecttoml path: project.toml
Builder pack global projecttoml path: project.toml
Builder pack projecttoml path:
=====> demo buildpacks information Buildpacks computed stack: gliderlabs/herokuish:latest-20 Buildpacks global stack:
Buildpacks list:
Buildpacks stack:
=====> demo ssl information Ssl dir: /home/dokku/demo/tls
Ssl enabled: false
Ssl hostnames:
Ssl expires at:
Ssl issuer:
Ssl starts at:
Ssl subject:
Ssl verified:
=====> demo checks information Checks disabled list: none
Checks skipped list: none
=====> demo cron information Cron task count: 0 =====> demo docker options information Docker options build:
Docker options deploy: --restart=on-failure:10
Docker options run:
=====> demo domains information Domains app enabled: true
Domains app vhosts:
Domains global enabled: false
Domains global vhosts:
=====> demo git information Git deploy branch: master
Git global deploy branch: master
Git keep git dir: false
Git rev env var: GIT_REV
Git sha: f891223
Git last updated at: 1628800557
=====> demo logs information Logs computed max size: 10m Logs global max size: 10m Logs global vector sink:
Logs max size:
Logs vector sink:
=====> demo 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:
=====> demo nginx information Nginx access log format:
Nginx access log path: /var/log/nginx/demo-access.log Nginx bind address ipv4:
Nginx bind address ipv6: ::
Nginx client max body size:
Nginx disable custom config: false
Nginx error log path: /var/log/nginx/demo-error.log Nginx global hsts: true
Nginx computed hsts: true
Nginx hsts:
Nginx hsts include subdomains: true
Nginx hsts max age: 15724800
Nginx hsts preload: false
Nginx proxy buffer size: 4096
Nginx proxy buffering: on
Nginx proxy buffers: 8 4096
Nginx proxy busy buffers size: 8192
Nginx proxy read timeout: 60s
Nginx last visited at: 1617926400
Nginx x forwarded for value: $remote_addr
Nginx x forwarded port value: $server_port
Nginx x forwarded proto value: $scheme
Nginx x forwarded ssl:
=====> demo proxy information Proxy enabled: true Proxy port map:
Proxy type: nginx =====> Setting deployed to false =====> demo ps information Deployed: false Processes: 0 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: false =====> demo registry information Registry computed image repo: dokku/demo Registry computed push on release: false Registry computed server:
Registry global push on release:
Registry global server:
Registry image repo:
Registry push on release:
Registry server:
Registry tag version:
=====> demo resource information =====> demo scheduler-docker-local information Scheduler docker local disable chown:
=====> demo storage information Storage build mounts:
Storage deploy mounts:
Storage run mounts:

josegonzalez commented 3 years ago

I just had a report on this in slack, so I added a test here. I'm investigating and should have a fix out soon.

matijakolaric commented 3 years ago

Great! I would suggest testing both app variables and global variables. You know, edge cases...

josegonzalez commented 3 years ago

Closing as there is a pull request. I'll merge/deploy when thats ready.