dokku / dokku

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

PHP Buildpack: Permission denied on /tmp/heroku.fcgi.5000.sock #2649

Closed Brunty closed 7 years ago

Brunty commented 7 years ago

Description of problem:

Site is here: https://symfony-demo.dokku.mfyu.co.uk/

It's just a base install of symfony 3 with a few things setup so I can run database migrations as a deploy step.

I'm getting a 502 bad gateway.

Running dokku logs symfony-demo gives the following line that I noticed:

2017/03/12 23:41:03 [crit] 260#0: *1 connect() to unix:/tmp/heroku.fcgi.5000.sock failed (13: Permission denied) while connecting to upstream, client: 172.17.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/tmp/heroku.fcgi.5000.sock:", host: "symfony-demo.dokku.mfyu.co.uk"

Then if I dokku enter symfony-demo and ls -lah /tmp I see the following:

total 64K
drwxrwxrwt 1 root          root          4.0K Mar 12 23:54 .
drwxr-xr-x 1 root          root          4.0K Mar 12 23:40 ..
-rw------- 1 root          root           16K Mar 12 23:40 bashenv.084526661
-rw------- 1 root          root           16K Mar 12 23:54 bashenv.912808672
drwxr-xr-x 1 herokuishuser herokuishuser 4.0K Mar 12 23:39 build
drwxr-xr-x 6 herokuishuser herokuishuser 4.0K Mar 12 23:39 buildpack1cTcG
drwxr-xr-x 1 herokuishuser herokuishuser 4.0K Feb 27 21:08 buildpacks
drwxr-xr-x 2 root          root          4.0K Feb 27 21:08 cache
drwxr-xr-x 1 herokuishuser herokuishuser 4.0K Mar 12 23:39 env
srw-rw---- 1 root          root             0 Mar 12 23:40 heroku.fcgi.5000.sock
prw-r--r-- 1 root          root             0 Mar 12 23:52 heroku.logspipe-162.yXRFEH
-rw-r--r-- 1 root          root          1.3K Mar 12 23:52 heroku.nginx_access.5000.log
-rw-r--r-- 1 root          root             0 Mar 12 23:40 heroku.php-fpm.5000.log
-rw-r--r-- 1 root          root             0 Mar 12 23:40 heroku.php-fpm.5000.www.slowlog
-rw-r--r-- 1 root          root             0 Mar 12 23:40 heroku.php-fpm.www.5000.log
prw-r--r-- 1 root          root             0 Mar 12 23:40 heroku.waitpipe-5000.NosPkd

heroku.fcgi.5000.sock is owned by root, hence the permission issue.

But, if I enter another app (where things are working) and do the same, I get this:

total 88K
drwxrwxrwt 1 root          root          4.0K Mar 12 23:55 .
drwxr-xr-x 1 root          root          4.0K Mar  9 09:51 ..
-rw------- 1 root          root           15K Mar  9 09:51 bashenv.330319371
-rw------- 1 root          root           15K Mar 12 23:55 bashenv.618219963
drwxr-xr-x 1 herokuishuser herokuishuser 4.0K Feb 28 23:55 build
drwxr-xr-x 6 herokuishuser herokuishuser 4.0K Feb 28 23:55 buildpackNpI9p
drwxr-xr-x 1 herokuishuser herokuishuser 4.0K Feb 27 21:08 buildpacks
drwxr-xr-x 2 root          root          4.0K Feb 27 21:08 cache
drwxr-xr-x 1 herokuishuser herokuishuser 4.0K Feb 28 23:55 env
srw-rw---- 1 herokuishuser herokuishuser    0 Mar  9 09:51 heroku.fcgi.5000.sock
prw-r--r-- 1 herokuishuser herokuishuser    0 Mar 12 23:40 heroku.logspipe-14.psfT7W
-rw-r--r-- 1 herokuishuser herokuishuser  23K Mar 12 23:40 heroku.nginx_access.5000.log
-rw-r--r-- 1 herokuishuser herokuishuser    0 Mar  9 09:51 heroku.php-fpm.5000.log
-rw-r--r-- 1 herokuishuser herokuishuser    0 Mar  9 09:51 heroku.php-fpm.5000.www.slowlog
-rw-r--r-- 1 herokuishuser herokuishuser    0 Mar  9 09:51 heroku.php-fpm.www.5000.log
prw-r--r-- 1 herokuishuser herokuishuser    0 Mar  9 09:51 heroku.waitpipe-5000.WLzVfs

Where it's owned by herokuishuser which is fine.

Any ideas? I'm not sure why the file permission would be wrong as I'm using the same buildpack for both apps (the working app is a private repo)

dokku report

-----> uname: Linux dokku 4.4.38-std-1 #1 SMP Mon Dec 12 10:45:29 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
-----> memory: 
              total        used        free      shared  buff/cache   available
Mem:           7976         356        1078         168        6541        7155
Swap:             0           0           0
-----> docker version: 
Client:
 Version:      1.13.1
 API version:  1.26
 Go version:   go1.7.5
 Git commit:   092cba3
 Built:        Wed Feb  8 06:50:14 2017
 OS/Arch:      linux/amd64

Server:
 Version:      1.13.1
 API version:  1.26 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   092cba3
 Built:        Wed Feb  8 06:50:14 2017
 OS/Arch:      linux/amd64
 Experimental: false
-----> docker daemon info: 
Containers: 15
 Running: 7
 Paused: 0
 Stopped: 8
Images: 49
Server Version: 1.13.1
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1
runc version: 9df8b306d01f59d3a8029be411de015b7304dd8f
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.4.38-std-1
Operating System: Ubuntu 16.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 6
Total Memory: 7.79 GiB
Name: dokku
ID: CUOY:N7GW:UM4A:EF6J:H4VC:WVIN:YDIM:5ZF5:SDHK:YRPH:6H5T:LE35
Docker Root Dir: /mnt/data/docker
Debug Mode (client): true
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
-----> sigil version: 0.4.0
-----> herokuish version: 
herokuish: 0.3.24
buildpacks:
  heroku-buildpack-multi     v1.0.0
  heroku-buildpack-ruby      v150
  heroku-buildpack-nodejs    v93
  heroku-buildpack-clojure   v75
  heroku-buildpack-python    v97
  heroku-buildpack-java      v48
  heroku-buildpack-gradle    v19
  heroku-buildpack-grails    v21
  heroku-buildpack-scala     v72
  heroku-buildpack-play      v26
  heroku-buildpack-php       v117
  heroku-buildpack-go        v54
  heroku-buildpack-erlang    fa17af9
  buildpack-nginx            v8
-----> dokku version: 0.8.0
-----> dokku plugins: 
plugn: 0.2.2
  00_dokku-standard    0.8.0 enabled    dokku core standard plugin
  20_events            0.8.0 enabled    dokku core events logging plugin
  apps                 0.8.0 enabled    dokku core apps plugin
  build-env            0.8.0 enabled    dokku core build-env plugin
  certs                0.8.0 enabled    dokku core certificate management plugin
  checks               0.8.0 enabled    dokku core checks plugin
  common               0.8.0 enabled    dokku core common plugin
  config               0.8.0 enabled    dokku core config plugin
  docker-options       0.8.0 enabled    dokku core docker-options plugin
  domains              0.8.0 enabled    dokku core domains plugin
  elasticsearch        1.0.0 enabled    dokku elasticsearch service plugin
  enter                0.8.0 enabled    dokku core enter plugin
  git                  0.8.0 enabled    dokku core git plugin
  letsencrypt          0.8.6 enabled    Automated installation of let's encrypt TLS certificates
  logs                 0.8.0 enabled    dokku core logs plugin
  maintenance          0.4.0 enabled    Maintenance mode for apps
  mariadb              1.0.0 enabled    dokku mariadb service plugin
  memcached            1.0.0 enabled    dokku memcached service plugin
  mysql                1.0.0 enabled    dokku mysql service plugin
  named-containers     0.8.0 enabled    dokku core named containers plugin
  nginx-vhosts         0.8.0 enabled    dokku core nginx-vhosts plugin
  plugin               0.8.0 enabled    dokku core plugin plugin
  postgres             1.0.0 enabled    dokku postgres service plugin
  proxy                0.8.0 enabled    dokku core proxy plugin
  ps                   0.8.0 enabled    dokku core ps plugin
  rabbitmq             1.0.0 enabled    dokku rabbitmq service plugin
  redis                1.0.0 enabled    dokku redis service plugin
  repo                 0.8.0 enabled    dokku core repo plugin
  shell                0.8.0 enabled    dokku core shell plugin
  ssh-keys             0.8.0 enabled    dokku core ssh-keys plugin
  storage              0.8.0 enabled    dokku core storage plugin
  tags                 0.8.0 enabled    dokku core tags plugin
  tar                  0.8.0 enabled    dokku core tar plugin

cat /home/dokku/symfony-demo/nginx.conf

server {
  listen      [::]:80;
  listen      80;
  server_name symfony-demo.dokku.mfyu.co.uk;
  access_log  /var/log/nginx/symfony-demo-access.log;
  error_log   /var/log/nginx/symfony-demo-error.log;

  return 301 https://$host:443$request_uri;

}

server {
  listen      [::]:443 ssl ;
  listen      443 ssl ;
  server_name symfony-demo.dokku.mfyu.co.uk;
  server_name symfony-demo.dokku.mfyu.co.uk;
  access_log  /var/log/nginx/symfony-demo-access.log;
  error_log   /var/log/nginx/symfony-demo-error.log;

  ssl_certificate     /home/dokku/symfony-demo/tls/server.crt;
  ssl_certificate_key /home/dokku/symfony-demo/tls/server.key;
  ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;

  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://symfony-demo-5000;
    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/symfony-demo/nginx.conf.d/*.conf;
}

upstream symfony-demo-5000 {

  server 172.17.0.6:5000;
}

Environment details (AWS, VirtualBox, physical, etc.): Scaleway VPS.

How was Dokku installed?: via instructions here: http://dokku.viewdocs.io/dokku/getting-started/installation/

josegonzalez commented 7 years ago

Can you update your herokuish install?

apt-get update
apt-get install herokuish

That should fix your deploy issue, the heroku php buildpack in your version is a bit old/broken.

Brunty commented 7 years ago

Just done that, re-deployed the app and getting the same issue.

I've also tried destroying and re-creating the app just in case, same thing.

josegonzalez commented 7 years ago

Remove the .buildpacks file from your repo and try again.

Brunty commented 7 years ago

Will do, it's in the process of deploying now.

With build packs, is it best to use an environment variable, .buildpacks file or just let dokku work it out (unless you've got a multi-buildpack setup, in which case I think .buildpacks would be required?

Brunty commented 7 years ago

Removing .buildpacks didn't work.

josegonzalez commented 7 years ago

We do buildpack detection the same way as heroku does, so I would let Dokku figure it out and then override with a .buildpacks file if you need something specific, or need multiple buildpacks.

I'll try your repo out on a test server of mine.

josegonzalez commented 7 years ago

Can you show the steps for all the things you setup before deploying this app? I'm getting issues deploying your app that seem to be related to missing dependency updates?

Also, feel free to jump on our slack channel to get help on this issue.

Brunty commented 7 years ago

Oh, that's due to needing to run:

dokku config:set symfony-demo SYMFONY_ENV=prod

for Symfony, otherwise it tries to run it's post-composer scripts in dev mode, which ask for packages that aren't installed outside of require-dev

josegonzalez commented 7 years ago

Did you also attach a database to this app? I'm getting issues with the app.json postdeploy script.

Brunty commented 7 years ago

Oh, yeah, sorry, I'll list all the commands:

dokku mysql:create symfony-demo-db
dokku mysql:link symfony-demo-db symfony-demo

Apologies for the missing info.

josegonzalez commented 7 years ago

App works for me on my server. Output of dokku report:

-----> uname: Linux ubuntu-2gb-nyc3-01 4.4.0-53-generic #74~14.04.1-Ubuntu SMP Fri Dec 2 03:43:31 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
-----> memory:
             total       used       free     shared    buffers     cached
Mem:          2000       1866        134         39         58        552
-/+ buffers/cache:       1255        744
Swap:            0          0          0
-----> docker version:
Client:
 Version:      1.12.5
 API version:  1.24
 Go version:   go1.6.4
 Git commit:   7392c3b
 Built:        Fri Dec 16 02:30:42 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.5
 API version:  1.24
 Go version:   go1.6.4
 Git commit:   7392c3b
 Built:        Fri Dec 16 02:30:42 2016
 OS/Arch:      linux/amd64
-----> docker daemon info:
Containers: 15
 Running: 5
 Paused: 0
 Stopped: 10
Images: 49
Server Version: 1.12.5
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 283
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: null host bridge overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: apparmor
Kernel Version: 4.4.0-53-generic
Operating System: Ubuntu 14.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.954 GiB
Name: ubuntu-2gb-nyc3-01
ID: 3WVM:SNTK:TX5C:D7HH:RBJS:RKWB:JAAS:A5JL:WLCD:VRKK:C3PL:TLHC
Docker Root Dir: /var/lib/docker
Debug Mode (client): true
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Insecure Registries:
 127.0.0.0/8
-----> sigil version: 0.4.0
-----> herokuish version:
herokuish: 0.3.26
buildpacks:
  heroku-buildpack-multi     v1.0.0
  heroku-buildpack-ruby      v153
  heroku-buildpack-nodejs    v98
  heroku-buildpack-clojure   v76
  heroku-buildpack-python    v99
  heroku-buildpack-java      v51
  heroku-buildpack-gradle    v21
  heroku-buildpack-grails    v21
  heroku-buildpack-scala     v76
  heroku-buildpack-play      v26
  heroku-buildpack-php       v120
  heroku-buildpack-go        v62
  heroku-buildpack-erlang    fa17af9
  buildpack-nginx            v8
-----> dokku version: 0.8.0
-----> dokku plugins:
plugn: 0.2.2
  00_dokku-standard    0.8.0 enabled    dokku core standard plugin
  20_events            0.8.0 enabled    dokku core events logging plugin
  apps                 0.8.0 enabled    dokku core apps plugin
  build-env            0.8.0 enabled    dokku core build-env plugin
  certs                0.8.0 enabled    dokku core certificate management plugin
  checks               0.8.0 enabled    dokku core checks plugin
  clone                0.4.1 enabled    dokku git clone plugin
  common               0.8.0 enabled    dokku core common plugin
  config               0.8.0 enabled    dokku core config plugin
  docker-options       0.8.0 enabled    dokku core docker-options plugin
  domains              0.8.0 enabled    dokku core domains plugin
  elasticsearch        1.0.0 enabled    dokku elasticsearch service plugin
  enter                0.8.0 enabled    dokku core enter plugin
  git                  0.8.0 enabled    dokku core git plugin
  global-cert          0.0.1 enabled    dokku plugin that allows setting a global certificate for applications
  graphite-grafana     0.1.0 enabled    dokku statsd & graphite service plugin with grafana dashboard
  logs                 0.8.0 enabled    dokku core logs plugin
  mariadb              1.0.0 enabled    dokku mariadb service plugin
  mysql                1.0.0 enabled    dokku mysql service plugin
  named-containers     0.8.0 enabled    dokku core named containers plugin
  nginx-vhosts         0.8.0 enabled    dokku core nginx-vhosts plugin
  plugin               0.8.0 enabled    dokku core plugin plugin
  postgres             1.0.0 enabled    dokku postgres service plugin
  proxy                0.8.0 enabled    dokku core proxy plugin
  ps                   0.8.0 enabled    dokku core ps plugin
  redis                1.0.0 enabled    dokku redis service plugin
  repo                 0.8.0 enabled    dokku core repo plugin
  shell                0.8.0 enabled    dokku core shell plugin
  ssh-keys             0.8.0 enabled    dokku core ssh-keys plugin
  storage              0.8.0 enabled    dokku core storage plugin
  tags                 0.8.0 enabled    dokku core tags plugin
  tar                  0.8.0 enabled    dokku core tar plugin
Brunty commented 7 years ago

Hmm, interesting, must be something about my setup that's broken somewhere.

I'm trying another apps:destroy and apps:create (with the various env setting and db attaching) just to see what happens.

Deploying another app that already works is working fine and the permissions are good. Not sure why this app just isn't doing it!

Brunty commented 7 years ago

No dice on the destroy and re-create (I also ran dokku cleanup and docker pull gliderlabs/herokuish in between the destroy and create just in case)

josegonzalez commented 7 years ago

Can you try this on a fresh instance?

Brunty commented 7 years ago

I will when I get some time, currently 1am here and I need to get some sleep - will post back here with results when I have them.

Brunty commented 7 years ago

Currently trying this on Dokku installed from the pre-made Digital Ocean droplet.

http://139.59.160.214:13625 getting the same issue:

-----> uname: Linux dokku-512mb-lon1-01 4.4.0-63-generic #84-Ubuntu SMP Wed Feb 1 17:20:32 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
-----> memory:
              total        used        free      shared  buff/cache   available
Mem:            488         192          12          39         283         212
Swap:             0           0           0
-----> docker version:
Client:
 Version:      1.13.1
 API version:  1.26
 Go version:   go1.7.5
 Git commit:   092cba3
 Built:        Wed Feb  8 06:50:14 2017
 OS/Arch:      linux/amd64

Server:
 Version:      1.13.1
 API version:  1.26 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   092cba3
 Built:        Wed Feb  8 06:50:14 2017
 OS/Arch:      linux/amd64
 Experimental: false
-----> docker daemon info:
Containers: 13
 Running: 3
 Paused: 0
 Stopped: 10
Images: 25
Server Version: 1.13.1
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 82
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1
runc version: 9df8b306d01f59d3a8029be411de015b7304dd8f
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.4.0-63-generic
Operating System: Ubuntu 16.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 488.4 MiB
Name: dokku-512mb-lon1-01
ID: YQ7L:63TI:2YI5:OHEK:SD3Y:EZIS:PUS6:6XDR:IMJW:VPBE:VSXW:VHUW
Docker Root Dir: /var/lib/docker
Debug Mode (client): true
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
-----> sigil version: 0.4.0
-----> herokuish version:
herokuish: 0.3.26
buildpacks:
  heroku-buildpack-multi     v1.0.0
  heroku-buildpack-ruby      v153
  heroku-buildpack-nodejs    v98
  heroku-buildpack-clojure   v76
  heroku-buildpack-python    v99
  heroku-buildpack-java      v51
  heroku-buildpack-gradle    v21
  heroku-buildpack-grails    v21
  heroku-buildpack-scala     v76
  heroku-buildpack-play      v26
  heroku-buildpack-php       v120
  heroku-buildpack-go        v62
  heroku-buildpack-erlang    fa17af9
  buildpack-nginx            v8
-----> dokku version: 0.8.0
-----> dokku plugins:
plugn: 0.2.2
  00_dokku-standard    0.8.0 enabled    dokku core standard plugin
  20_events            0.8.0 enabled    dokku core events logging plugin
  apps                 0.8.0 enabled    dokku core apps plugin
  build-env            0.8.0 enabled    dokku core build-env plugin
  certs                0.8.0 enabled    dokku core certificate management plugin
  checks               0.8.0 enabled    dokku core checks plugin
  common               0.8.0 enabled    dokku core common plugin
  config               0.8.0 enabled    dokku core config plugin
  docker-options       0.8.0 enabled    dokku core docker-options plugin
  domains              0.8.0 enabled    dokku core domains plugin
  enter                0.8.0 enabled    dokku core enter plugin
  git                  0.8.0 enabled    dokku core git plugin
  logs                 0.8.0 enabled    dokku core logs plugin
  mysql                1.0.0 enabled    dokku mysql service plugin
  named-containers     0.8.0 enabled    dokku core named containers plugin
  nginx-vhosts         0.8.0 enabled    dokku core nginx-vhosts plugin
  plugin               0.8.0 enabled    dokku core plugin plugin
  proxy                0.8.0 enabled    dokku core proxy plugin
  ps                   0.8.0 enabled    dokku core ps plugin
  repo                 0.8.0 enabled    dokku core repo plugin
  shell                0.8.0 enabled    dokku core shell plugin
  ssh-keys             0.8.0 enabled    dokku core ssh-keys plugin
  storage              0.8.0 enabled    dokku core storage plugin
  tags                 0.8.0 enabled    dokku core tags plugin
  tar                  0.8.0 enabled    dokku core tar plugin
josegonzalez commented 7 years ago

What are the exact steps you took to deploy this application?

Brunty commented 7 years ago

Created the droplet on digital ocean, completed the web UI setup with public key.

SSH'd into the server (as root):

dokku apps:create symfony
dokku plugin:install https://github.com/dokku/dokku-mysql.git mysql
dokku mysql:create symfony-db && dokku mysql:link symfony-db symfony
dokku config:set symfony SYMFONY_ENV=prod
dokku mysql:link symfony-db symfony

Locally in the repo:

git remote add do dokku@139.59.160.214:symfony
git push do master
josegonzalez commented 7 years ago

I'm seeing a different issue with this app, even with the SYMFONY_ENV set:

jose@Joses-MacBook-Pro:~/src/symfony-dokku git:master $ git push do master
Counting objects: 55, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (48/48), done.
Writing objects: 100% (55/55), 43.36 KiB | 0 bytes/s, done.
Total 55 (delta 0), reused 0 (delta 0)
-----> Cleaning up...
-----> Building symfony from herokuish...
-----> Setting config vars
       CURL_CONNECT_TIMEOUT: 5
-----> Setting config vars
       CURL_TIMEOUT: 30
-----> Adding BUILD_ENV to build environment...
-----> Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
       Detected buildpacks: multi php
-----> Multipack app detected
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-php.git
=====> Detected Framework: PHP
-----> Bootstrapping...
-----> Installing platform packages...
       - php (7.1.2)
       - apache (2.4.20)
       - nginx (1.8.1)

       !     WARNING: Your 'composer.lock' is not up to date with the latest
       changes in 'composer.json'. To ensure you are not getting stale
       dependencies, run 'composer update' on your machine and commit
       any changes to Git before pushing again.

-----> Installing dependencies...
       Composer version 1.3.2 2017-01-27 18:23:41
       Loading composer repositories with package information
       Installing dependencies from lock file
       Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
       Package operations: 37 installs, 0 updates, 0 removals
       - Installing ocramius/package-versions (1.1.2) Downloading: 100%
       - Installing doctrine/lexer (v1.0.1) Downloading: 100%
       - Installing doctrine/annotations (v1.4.0) Downloading: 100%
       - Installing symfony/polyfill-mbstring (v1.3.0) Downloading: 100%
       - Installing twig/twig (v2.2.0) Downloading: 100%
       - Installing symfony/polyfill-util (v1.3.0) Downloading: 100%
       - Installing paragonie/random_compat (v2.0.9) Downloading: 100%
       - Installing symfony/polyfill-php70 (v1.3.0) Downloading: 100%
       - Installing symfony/polyfill-php56 (v1.3.0) Downloading: 100%
       - Installing symfony/symfony (v3.2.6) Downloading: 100%
       - Installing symfony/polyfill-intl-icu (v1.3.0) Downloading: 100%
       - Installing psr/log (1.0.2) Downloading: 100%
       - Installing psr/cache (1.0.1) Downloading: 100%
       - Installing doctrine/inflector (v1.1.0) Downloading: 100%
       - Installing doctrine/collections (v1.4.0) Downloading: 100%
       - Installing doctrine/cache (v1.6.1) Downloading: 100%
       - Installing doctrine/common (v2.7.2) Downloading: 100%
       - Installing doctrine/doctrine-cache-bundle (1.3.0) Downloading: 100%
       - Installing zendframework/zend-eventmanager (3.1.0) Downloading: 100%
       - Installing zendframework/zend-code (3.1.0) Downloading: 100%
       - Installing ocramius/proxy-manager (2.1.0) Downloading: 100%
       - Installing doctrine/dbal (v2.5.12) Downloading: 100%
       - Installing doctrine/migrations (v1.5.0) Downloading: 100%
       - Installing jdorn/sql-formatter (v1.2.17) Downloading: 100%
       - Installing doctrine/doctrine-bundle (1.6.7) Downloading: 100%
       - Installing doctrine/doctrine-migrations-bundle (v1.2.1) Downloading: 100%
       - Installing doctrine/instantiator (1.0.5) Downloading: 100%
       - Installing doctrine/orm (v2.5.6) Downloading: 100%
       - Installing incenteev/composer-parameter-handler (v2.1.2) Downloading: 100%
       - Installing sensiolabs/security-checker (v4.0.2) Downloading: 100%
       - Installing sensio/distribution-bundle (v5.0.18) Downloading: 100%
       - Installing sensio/framework-extra-bundle (v3.0.23) Downloading: 100%
       - Installing monolog/monolog (1.22.0) Downloading: 100%
       - Installing symfony/monolog-bundle (v3.0.3) Downloading: 100%
       - Installing symfony/polyfill-apcu (v1.3.0) Downloading: 100%
       - Installing swiftmailer/swiftmailer (v5.4.6) Downloading: 100%
       - Installing symfony/swiftmailer-bundle (v2.5.3) Downloading: 100%
       Generating optimized autoload files
       ocramius/package-versions:  Generating version class...
       ocramius/package-versions: ...done generating version class
       > IncenteevParameterHandlerScriptHandler::buildParameters
       Creating the "app/config/parameters.yml" file
       > SensioBundleDistributionBundleComposerScriptHandler::buildBootstrap
       > SensioBundleDistributionBundleComposerScriptHandler::clearCache
       PHP Fatal error:  Uncaught SymfonyComponentDebugExceptionClassNotFoundException: Attempted to load class "SensioGeneratorBundle" from namespace "SensioBundleGeneratorBundle".
       Did you forget a "use" statement for another namespace? in /tmp/build/app/AppKernel.php:26
       Stack trace:
       #0 /tmp/build/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(406): AppKernel->registerBundles()
       #1 /tmp/build/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(113): SymfonyComponentHttpKernelKernel->initializeBundles()
       #2 /tmp/build/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): SymfonyComponentHttpKernelKernel->boot()
       #3 /tmp/build/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(120): SymfonyBundleFrameworkBundleConsoleApplication->doRun(Object(SymfonyComponentConsoleInputArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
       #4 /tmp/build/bin/console(28): SymfonyComponentConsoleApplication->run(Object(SymfonyComponent in /tmp/build/app/AppKernel.php on line 26
       Script SensioBundleDistributionBundleComposerScriptHandler::clearCache handling the symfony-scripts event terminated with an exception

       [RuntimeException]
       An error occurred when executing the "'cache:clear --no-warmup'" command:
       PHP Fatal error:  Uncaught SymfonyComponentDebugExceptionClassNotFoundException: Attempted to load class "SensioGeneratorBundle" from namespace "SensioBundleGeneratorBundle".
       Did you forget a "use" statement for another namespace? in /tmp/build/app/AppKernel.php:26
       Stack trace:
       #0 /tmp/build/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(406): AppKernel->registerBundles()
       #1 /tmp/build/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(113): SymfonyComponentHttpKernelKernel->initializeBundles()
       #2 /tmp/build/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): SymfonyComponentHttpKernelKernel->boot()
       #3 /tmp/build/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(120): SymfonyBundleFrameworkBundleConsoleApplication->doRun(Object(SymfonyComponentConsoleInputArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
       #4 /tmp/build/bin/console(28): SymfonyComponentConsoleApplication->run(Object(SymfonyComponent in /tmp/build/app/AppKernel.php on line 26
       .

       install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...

To dokku.me:symfony
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'dokku@dokku.me:symfony'
Brunty commented 7 years ago

I'll re-try this later, I'd forgotten to look into it further due to working on other stuff.

Brunty commented 7 years ago

With SYMFONY_ENV=prod on Dokku I don't get this error, I'll look at recording a screencast later of the issue and how exactly I've gone about setting everything up.

Brunty commented 7 years ago

Screencast: https://www.youtube.com/watch?v=ClpC4UEfEfw

I've also completely re-done the repo with some changes that I'd been testing locally this morning too so a pull will be required.

josegonzalez commented 7 years ago

Does this app run on heroku with the same buildpack?

Brunty commented 7 years ago

It does: https://mfyu-symfony-test.herokuapp.com/

josegonzalez commented 7 years ago

Interesting, the /start web subprocess doesn't seem to be using herokuishuser as we expect, but instead continues on with root...

What happens if you boot a fresh ubuntu 14.04 instance (not the one that installs 0.6.5 on DO), run our installation, and then try deploying?

Brunty commented 7 years ago

I'll give that a try, the main dokku install I'm trying to run it on isn't on DO though (I just spun that one up for really quick testing)

I'm running it on Ubuntu 16.04 and have successfully deploy other PHP apps (both before this issue, and after discovering it)

Brunty commented 7 years ago

(it's also running on https://www.scaleway.com)

josegonzalez commented 7 years ago

Interesting output after playing with your Procfile:

# your code
root        \_ docker-containerd-shim 7bb84a17ef6076683c6db73da88db52d372c2326a033453a1019dc5f5c3e2149 /var/run/docker/libcontainerd/7
root        |   \_ /start web
root        |       \_ /root/.basher/bash -c main 'web'
root        |           \_ /root/.basher/bash -c main 'web'
root        |               \_ bash vendor/bin/heroku-php-nginx -C nginx.conf web
root        |                   \_ bash vendor/bin/heroku-php-nginx -C nginx.conf web
root        |                   |   \_ tail -qF -n 0 /tmp/heroku.php-fpm.5000.log /tmp/heroku.php-fpm.www.5000.log /tmp/heroku.php-fpm
root        |                   |   \_ sed -u -E -e s/^\[[^]]+\] WARNING: \[pool [^]]+\] child [0-9]+ said into std(err|out): "(.*)("|
root        |                   \_ bash vendor/bin/heroku-php-nginx -C nginx.conf web
root        |                   |   \_ php-fpm: master process (/app/vendor/heroku/heroku-buildpack-php/conf/php/php-fpm.conf)
nobody      |                   |       \_ php-fpm: pool www
nobody      |                   |       \_ php-fpm: pool www
nobody      |                   |       \_ php-fpm: pool www
nobody      |                   |       \_ php-fpm: pool www
root        |                   \_ bash vendor/bin/heroku-php-nginx -C nginx.conf web
root        |                       \_ nginx: master process nginx -g daemon off; include /app/vendor/heroku/heroku-buildpack-php/conf
nobody      |                           \_ nginx: worker process
nobody      |                           \_ nginx: worker process

# without the warmup and subshell
root       \_ docker-containerd-shim 265de5ad35f0714d4470136ffee53a37dfb63990278f004b95073c9a0ebbc359 /var/run/docker/libcontainerd/2
root           \_ /start web
32767              \_ bash vendor/bin/heroku-php-nginx -C nginx.conf web
32767                  \_ bash vendor/bin/heroku-php-nginx -C nginx.conf web
32767                  |   \_ tail -qF -n 0 /tmp/heroku.php-fpm.5000.log /tmp/heroku.php-fpm.www.5000.log /tmp/heroku.php-fpm.5000.ww
32767                  |   \_ sed -u -E -e s/^\[[^]]+\] WARNING: \[pool [^]]+\] child [0-9]+ said into std(err|out): "(.*)("|...)$/\2
32767                  \_ bash vendor/bin/heroku-php-nginx -C nginx.conf web
32767                  |   \_ php-fpm: master process (/app/vendor/heroku/heroku-buildpack-php/conf/php/php-fpm.conf)
32767                  |       \_ php-fpm: pool www
32767                  |       \_ php-fpm: pool www
32767                  |       \_ php-fpm: pool www
32767                  |       \_ php-fpm: pool www
32767                  \_ bash vendor/bin/heroku-php-nginx -C nginx.conf web
32767                      \_ nginx: master process nginx -g daemon off; include /app/vendor/heroku/heroku-buildpack-php/conf/nginx/h
32767                          \_ nginx: worker process
32767                          \_ nginx: worker process

# just the subshell
root     16045  0.0  0.1 206944  2884 ?        Sl   12:30   0:00      \_ docker-containerd-shim f5a2f742cd68b15dad32634f9987ff50d30c1d8ce62a454d3f617d5b12dfcf5e /var/run/docker/libcontainerd/f
root     16090  0.0  0.1   8044  3176 ?        Ssl  12:30   0:00          \_ /start web
32767    16113  0.0  0.1  18044  2852 ?        S    12:30   0:00              \_ bash vendor/bin/heroku-php-nginx -C nginx.conf web
32767    16523  0.0  0.0  18044  1920 ?        S    12:30   0:00                  \_ bash vendor/bin/heroku-php-nginx -C nginx.conf web
32767    16532  0.0  0.0   4384   732 ?        S    12:30   0:00                  |   \_ tail -qF -n 0 /tmp/heroku.php-fpm.5000.log /tmp/heroku.php-fpm.www.5000.log /tmp/heroku.php-fpm.5000.ww
32767    16533  0.0  0.0  10976  1520 ?        S    12:30   0:00                  |   \_ sed -u -E -e s/^\[[^]]+\] WARNING: \[pool [^]]+\] child [0-9]+ said into std(err|out): "(.*)("|...)$/\2
32767    16524  0.0  0.0  18044  1856 ?        S    12:30   0:00                  \_ bash vendor/bin/heroku-php-nginx -C nginx.conf web
32767    16527  0.0  1.8 344284 37884 ?        Ss   12:30   0:00                  |   \_ php-fpm: master process (/app/vendor/heroku/heroku-buildpack-php/conf/php/php-fpm.conf)
32767    16534  0.0  0.4 344284  8568 ?        S    12:30   0:00                  |       \_ php-fpm: pool www
32767    16535  0.0  0.4 344284  8568 ?        S    12:30   0:00                  |       \_ php-fpm: pool www
32767    16536  0.0  0.4 344284  8504 ?        S    12:30   0:00                  |       \_ php-fpm: pool www
32767    16537  0.0  0.4 344284  8568 ?        S    12:30   0:00                  |       \_ php-fpm: pool www
32767    16538  0.0  0.0  18044  1856 ?        S    12:30   0:00                  \_ bash vendor/bin/heroku-php-nginx -C nginx.conf web
32767    16539  0.0  0.1  20036  3424 ?        S    12:30   0:00                      \_ nginx: master process nginx -g daemon off; include /app/vendor/heroku/heroku-buildpack-php/conf/nginx/h
32767    16540  0.0  0.1  20480  2324 ?        S    12:30   0:00                          \_ nginx: worker process
32767    16541  0.0  0.1  20480  2324 ?        S    12:30   0:00                          \_ nginx: worker process

# with the warmup and no subshell
root      4223  0.0  0.1 208000  2924 ?        Sl   12:32   0:00      \_ docker-containerd-shim ff86d0344caec72e26cbbc04a1ed312c2bd1a3f8bbaa8c1204eed83d595a0370 /var/run/docker/libcontainerd/f
root      4240  0.1  0.1   8044  3388 ?        Ssl  12:32   0:00          \_ /start web
root      4267  0.0  0.0   1564  1312 ?        S    12:32   0:00              \_ /root/.basher/bash -c main 'web'
root      4589  0.0  0.0   1564   544 ?        S    12:32   0:00                  \_ /root/.basher/bash -c main 'web'
root      4590  0.0  0.1  18044  2944 ?        S    12:32   0:00                      \_ bash vendor/bin/heroku-php-nginx -C nginx.conf web
root      4671  0.0  0.0  18044  1992 ?        S    12:32   0:00                          \_ bash vendor/bin/heroku-php-nginx -C nginx.conf web
root      4680  0.0  0.0   4384   724 ?        S    12:32   0:00                          |   \_ tail -qF -n 0 /tmp/heroku.php-fpm.5000.log /tmp/heroku.php-fpm.www.5000.log /tmp/heroku.php-fpm
root      4681  0.0  0.0  10976  1464 ?        S    12:32   0:00                          |   \_ sed -u -E -e s/^\[[^]]+\] WARNING: \[pool [^]]+\] child [0-9]+ said into std(err|out): "(.*)("|
root      4673  0.0  0.0  18044  1928 ?        S    12:32   0:00                          \_ bash vendor/bin/heroku-php-nginx -C nginx.conf web
root      4676  0.2  1.7 344284 35744 ?        Ss   12:32   0:00                          |   \_ php-fpm: master process (/app/vendor/heroku/heroku-buildpack-php/conf/php/php-fpm.conf)
nobody    4682  0.0  0.3 344284  6200 ?        S    12:32   0:00                          |       \_ php-fpm: pool www
nobody    4683  0.0  0.3 344284  6200 ?        S    12:32   0:00                          |       \_ php-fpm: pool www
nobody    4684  0.0  0.3 344284  6200 ?        S    12:32   0:00                          |       \_ php-fpm: pool www
nobody    4685  0.0  0.3 344284  6200 ?        S    12:32   0:00                          |       \_ php-fpm: pool www
root      4686  0.0  0.0  18044  1928 ?        S    12:32   0:00                          \_ bash vendor/bin/heroku-php-nginx -C nginx.conf web
root      4687  0.0  0.1  28464  3936 ?        S    12:32   0:00                              \_ nginx: master process nginx -g daemon off; include /app/vendor/heroku/heroku-buildpack-php/conf
nobody    4688  0.0  0.1  28908  2760 ?        S    12:32   0:00                                  \_ nginx: worker process
nobody    4689  0.0  0.1  28908  2760 ?        S    12:32   0:00                                  \_ nginx: worker process

A few things:

If anything, this "bug" belongs in gliderlabs/herokuish, but due to the nature of how exec works, I don't think we'll be able to solve this without patching exec. Sorry :(

Brunty commented 7 years ago

You can use something like our post-deploy tasks to warm up opcode cache in php, which is what I guess you're doing.

The only deploy tasks I had were migrations on the database, I've since removed that and re-run, but same issue.

I guess no deploying Symfony on dokku for me. Strange that it worked find with SlimPHP projects I have.

josegonzalez commented 7 years ago

This was your Procfile:

web: composer warmup && $(composer config bin-dir)/heroku-php-nginx -C nginx.conf web

Making it any variation of the following works:

web: $(composer config bin-dir)/heroku-php-nginx -C nginx.conf web

The problem is that your web process is doing two things at once, so exec is probably making the first process properly run by herokuishuser and then borking on the second, resulting in it being run as root.

This has nothing to do with slim vs symfony, whether you do or don't have deploy tasks, but a fundamental limitation of how herokuish executes the Procfile processes. I mentioned deploy tasks as an alternative to this as you could hit an endpoint in your app that executes the composer warmup command somehow to simulate the same functionality.

Brunty commented 7 years ago

Gonna re-try without the warmup - I'd completely forgotten it was in my procfile - all it does it construct some parameters and warmup the symfony cache, so I'll look at moving that elsewhere.

Without the warmup things work fine - so I'll move that elsewhere.

Thanks for all your time & effort with this @josegonzalez - keep being awesome and thank you and the contributors for Dokku :)

josegonzalez commented 7 years ago

Another alternative would maybe be to execute a make target:

.PHONY: web
web:
    composer warmup
    vendor/bin/heroku-php-nginx -C nginx.conf web

and your Procfile would be:

web: make web

I think that will avoid the issue, but I don't know.

Brunty commented 7 years ago

I'll look into that, now I know what's causing the issue, I can always just leave it out, it'll only warmup the cache so the next request wouldn't have to do it.

Brunty commented 7 years ago

In fact, I don't need to warmup myself, those things are already handled as post-install scripts in composer.

I'm such an idiot.