Run Commands when Webhook is fired doesn't work

CyberPanel 2.0.1

The webhook feature to automatically update the repository attached to a site works, but the deployment commands set are not executed, although they are activated and it is recommended to execute them after each pull operation triggered by webhook.

Worked for me → Imgur: The magic of the Internet

Where I find that logs?

There is a Git Logs button on the same page where you Manage Git (Appears after selecting a folder)

I found the problem. The commands should be executed from the ROOT folder in the repository. This doesn’t happen and it complicates things a lot, can you make the folder from which the commands are run to be the root of the repository?

Ok, I will look into this.

Thank you very much.

One last question. Are the commands executed by the root user or the user to whom the website belongs?

They are executed as a website user and not as root.

Great, thank you!

Check out this error generated by composer install command

INFO 06.12.2020_09-04-01 Result: [RuntimeException] The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly
INFO 06.12.2020_09-04-00 Running: /usr/local/lsws/lsphp74/bin/php /usr/bin/composer install --prefer-dist -n -o -d ~/public_html/

The command is correct because, form console, using su - user to impersonate che website user, the command successfully install composer dependancies without errors, bot for some reason, from post-webhook commands doesn’t work

export the required environment variables inside your command?

But why it happens only when command is run by webhook?

Please check composer_home environment variable not set · Issue #393 · composer/packagist · GitHub.

This error occurs because the user running the command has not set the HOME environment variable.

And, as a matter of fact, this problem has never happened to me on other panels such as RunCloud, ServerPilot, Laravel Forge, etc.

I asked David to look into this, it may take until Monday or Tuesday.

Thank you!

Fixed with this commit → update lscpd to fix:… · usmannasir/cyberpanel@2dfac48 · GitHub

Fix resides in v2.0.2-dev branch.

Thanks, I’ll test it with the next update then.