Jump to content

Recommended Posts

Posted

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:

image.png.7f86ea463dc7e4897e9c34b19ca91985.png

 

It throws me this error whenever it pulls the repo haha:

image.png.abaeb8f32e7de2da991900e6e2be1479.png

 

this is how it looks on my website when it deploys. it just shows the index of that folder:

image.png.bac7483a1371ae4514145d759a758d0c.png

 

Would be glad to someone help me on this.

 

Thank youu!! :)

Posted

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).

 

Posted

Hi wolstech, nice to see you again!

here is what I did:

1. create a scheduled task, then run it.

image.png.eca0b53345d1184041148c997cb03bef.png

 

2. go to Website & Domains > Git, then pull now.

image.png.b632dd36418abe9d0f6a1abde32899f7.png

 

but I still got this error:

image.png.61caf10d7affa35a203bd6bfc6dfd6cd.png

Posted

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.

Posted (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).

image.thumb.png.1ff65173a1c8761705fbb9e718e8349a.png

 

2. after that, I go to the websites & domains > git, then change the config to run additional deployment actions.

image.png.74e78c90bca830264b31e015c123feae.png

 

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?Screenshot_20250421-145106.thumb.jpg.f39517b79c150e8e499a9d8ca11e492f.jpg

Edited by b0chard
Posted

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)

Posted

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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...