Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy hook fails (permission denied) #177

Open
aimfeld opened this issue Oct 14, 2022 · 2 comments
Open

Deploy hook fails (permission denied) #177

aimfeld opened this issue Oct 14, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@aimfeld
Copy link

aimfeld commented Oct 14, 2022

After upgrading linux mint from 20 to 21, I had to update docker as well (Docker version 20.10.19). After that, I noticed that the deploy hook configured in .platform.app.yaml is not being run when I do a lando rebuild (I'm using lando v3.6.4). I tried downgrading docker to 20.10.18, 20.10.16, and 20.10.13, but the problem persists (earlier docker versions are not avaible for ubuntu jammy it seems).
When I lando ssh into the container and run the commands in the deploy hook section manually, my local build works.

I checked the logs in .lando/logs, and I don't any errors or relevant info.

@aimfeld aimfeld added the bug Something isn't working label Oct 14, 2022
@aimfeld
Copy link
Author

aimfeld commented Oct 14, 2022

When running a verbose rebuild with lando rebuild -y -vvvv, I see a permission denied error when the deploy hook is executed: Permission denied: '/sys/fs/cgroup/systemd/notify/default/tasks'. The error has nothing to do with the specific commands in the deploy hook, it occurs even if I remove the commands.

2022-10-14 07:57:08,017 platformsh.agent.service INFO Executing deploy hook: set -e
cd
# Wait a few seconds until DB container is running, otherwise phinx migrate fails on lando
if [ "$PLATFORM_ENVIRONMENT" = "lando" ]; then echo "Sleeping to wait for DB container..."; sleep 15; fi
vendor/bin/phing run-migrations
vendor/bin/phing clear-data
vendor/bin/doctrine orm:generate-proxies
vendor/bin/phing clear-caches
vendor/bin/phing import-project
vendor/bin/phing reset-accounts

2022-10-14 07:57:08,019 platformsh.agent.service ERROR Deploy hook failed: [Errno 13] Permission denied: '/sys/fs/cgroup/systemd/notify/default/tasks'
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/platformsh_app/service.py", line 1307, in _post_deploy
    self._execute_logged("/var/log/deploy.log", deploy_hook, "default")
  File "/usr/lib/python2.7/dist-packages/platformsh_app/service.py", line 1478, in _execute_logged
    self._execute_logged_child(where, cmd, cgroup_id)
  File "/usr/lib/python2.7/dist-packages/platformsh_app/service.py", line 1451, in _execute_logged_child
    with open("/sys/fs/cgroup/systemd/notify/%s/tasks" % cgroup_id, "wb") as tasks:
  File "/usr/lib/python2.7/dist-packages/platformsh_gevent/__init__.py", line 251, in friendly_open
    return io.open(name, mode=mode, buffering=_cap_bufsize(buffering))
  File "/usr/lib/python2.7/dist-packages/platformsh_gevent/__init__.py", line 83, in io_open
    fileobj = blocking_io_open(file, mode_binary, buffering=0, closefd=closefd)
IOError: [Errno 13] Permission denied: '/sys/fs/cgroup/systemd/notify/default/tasks'
2022-10-14 07:57:08,024 platformsh.agent ERROR Control returned to log_and_load() in child process
{"php": {"scheme": "http", "port": 80}, "http": {"scheme": "http", "port": 80}}2022-10-14 07:57:08,057 platformsh.agent.service ERROR Deploy hook failed: Child #186 exited with non-zero code: 256
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/platformsh_app/service.py", line 1307, in _post_deploy
    self._execute_logged("/var/log/deploy.log", deploy_hook, "default")
  File "/usr/lib/python2.7/dist-packages/platformsh_app/service.py", line 1476, in _execute_logged
    self._execute_logged_parent(pid, cgroup_id)
  File "/usr/lib/python2.7/dist-packages/platformsh_app/service.py", line 1437, in _execute_logged_parent
    raise Exception("Child #%d exited with non-zero code: %d" % (pid, code))
Exception: Child #186 exited with non-zero code: 256

@aimfeld aimfeld changed the title Deploy hooks are not being run anymore Deploy hook fails (permission denied) Oct 14, 2022
@aimfeld
Copy link
Author

aimfeld commented Oct 21, 2022

As a workaround, I tried running the code in the platform.sh deploy hook from the lando run build step instead. That doesn't work either, because the platform.sh environment variables (such as PLATFORM_RELATIONSHIPS) are not available in the build step for some reason. Therefore, the DB migrations fail because of missing DB credentials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant