b0chard Posted Sunday at 11:13 AM Posted Sunday at 11:13 AM Hi there! I would like to ask for assistance on deploymentof my website with git submodules in it. I have a php website, I use Git on plesk to pull my repository on github and deploy it automatically using a webhook. Now, this repository has git submodules in it. But, I have no idea on how to add it on the file manager on plesk everytime it pulls the repo. I tried this method, hoping it would work, but nah: It throws me this error whenever it pulls the repo haha: this is how it looks on my website when it deploys. it just shows the index of that folder: Would be glad to someone help me on this. Thank youu!! Quote
wolstech Posted Sunday at 02:05 PM Posted Sunday at 02:05 PM The deployment actions are jailed to your home folder. Since git's binaries don't live in your home folder, it can't find the binary. There is a workaround for this limitation involving CGI that can be tried. Here's a link to another case where a user used that workaround to run npm for a node app, you should be able to adapt it to run git commands instead. https://helionet.org/index/topic/63231-run-npm-script-in-git-deploy-actions/ Note that the "create a scheduled task and run it at lease once" step that I mentioned in one of my replies over is essential. It won't work if you don't do that first (you'll get an error that curl isn't found). Quote
b0chard Posted Sunday at 02:31 PM Author Posted Sunday at 02:31 PM Hi wolstech, nice to see you again! here is what I did: 1. create a scheduled task, then run it. 2. go to Website & Domains > Git, then pull now. but I still got this error: Quote
wolstech Posted Sunday at 03:04 PM Posted Sunday at 03:04 PM You need to write a CGI script in a language like perl or python to run the git commands. Then you would use curl in the deploy actions to call the script via http. The curl call will trigger the CGI script, which will cause Apache to run the handler for the cgi, which will in turn run your git commands outside of the jail. Assuming you use Python to make the CGI script, you end up with a flow that looks like: Git Plesk Deploy calls curl->curl request to .py file->apache receives request and calls Python to process script->Python calls git->git processes submodules. Quote
b0chard Posted yesterday at 05:03 AM Author Posted yesterday at 05:03 AM (edited) I don't know what I'm doing now 🥴😮💨 so, here's what I did. 1. created a `submodule_update.py` file in the httpdocs/cgi-bin/ and changed the permission to 755 (rwx r-x r-x). 2. after that, I go to the websites & domains > git, then change the config to run additional deployment actions. I manually pulled and deploy, no errors shown. but the files from the submodules aint still updating on its respective submodule folders. Edit: Is the git folder really found at the root instead inside the httpdocs folder? Edited yesterday at 06:53 AM by b0chard Quote
wolstech Posted 23 hours ago Posted 23 hours ago I'll have to take a look when I'm on a computer, but I can see just from the screenshots you posted that the path in the os.chdir command is wrong. It should be /home/tenkyuu.dev/git... The path you have listed as missing the domain ( your home folder is /home/tenkyuu.dev) Quote
b0chard Posted 19 hours ago Author Posted 19 hours ago unfortunately, that didn't work I fixed the path: Quote
wolstech Posted 18 hours ago Posted 18 hours ago There's a whole bunch of issues here...your curl command returns a 301 because you used HTTP instead of HTTPS. CURL does not follow 301 redirects by default. <html> <head><title>301 Moved Permanently</title></head> <body> <center><h1>301 Moved Permanently</h1></center> <hr><center>cloudflare</center> </body> </html> Using HTTPS, the certificate revocation check fails due to Cloudflare. Not sure how to fix this on linux. curl -H "TOKEN: My_Super_Secure_Token" https://tenkyuu.dev/cgi-bin/submodule_update.py curl: (35) schannel: next InitializeSecurityContext failed: CRYPT_E_NO_REVOCATION_CHECK (0x80092012) - The revocation function was unable to check revocation for the certificate. I'm calling the script from my Windows box to debug it, and I just suppressed the error with --ssl-no-revoke, but that's reportedly not supported on linux. curl --ssl-no-revoke -H "TOKEN: My_Super_Secure_Token" https://tenkyuu.dev/cgi-bin/submodule_update.py Received token: My_Super_Secure_Token Starting submodule update... Error updating submodules: Command '['git', 'submodule', 'update', '--init', '--recursive']' returned non-zero exit status 1. I messed with the Python file a bit to try and get the stdout of git to show up, but had no luck. It just fails with code 1... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.