Community

Run Commands when Webhook is fired doesn't work

fl
fliva #1

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.

fl
fliva #3

Where I find that logs?

us
usmannasir #4

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

fl
fliva #5

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?

us
usmannasir #6

Ok, I will look into this.

fl
fliva #7

Thank you very much.

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

us
usmannasir #8

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

fl
fliva #9

Great, thank you!

fl
fliva #10

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

us
usmannasir #11

export the required environment variables inside your command?

fl
fliva #12

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

us
usmannasir #14

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

fl
fliva #15

Thank you!

fl
fliva #17

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

Sign in to reply