Skip to main content

Recommended .cpanel.yml settings for Git Deployment?

Comments

10 comments

  • cPanelLauren
    Hi @kabatak Have you checked out the documentation here: Git Version Control - Version 74 Documentation - cPanel Documentation Specifically, the pull or deploy tab under "Manage Repositories"
    0
  • kabatak
    @cPanelLauren Yup! There's not much info regarding recommended .yml settings. It only suggests enumerating individual files to copy which is not really ideal.
    0
  • kabatak
    So I'm trying things and this works using rsync: Moderator Note: Removed the rsync example command because it can lead to unexpected file removal.
    I'm still open to suggestions but it would also be nice if Cpanel have a built-in implementation of deploying code from Git rather than relying on custom user commands. E.g., What if the server doesn't have rsync? I think Cpanel's "Deploy" button should do this task by default without the need for a .cpanel.yml file. Only additional commands or special use case should be put under the .cpanel.yml file, because I think 99% of use cases will only want an "rsync" deployment. Edit: With the exception of indicating the deploy location (which requires an .cpanel.yml file), an "rysnc" functionality should be available to all users upon hitting deploy.
    0
  • kabatak
    Update: The previous script I posted does not actually work but this one now does: Removed the rsync example command because it can lead to unexpected file removal.
    Apparently, relative path from the repository dir does not work when using rsync, so we must use absolute path. Again, I wish this comes as default in the Cpanel "Deploy" button.
    0
  • johnwp
    Thanks
    0
  • mariavilaro
    Update: The previous script I posted does not actually work but this one now does: Removed the rsync example command because it can lead to unexpected file removal.
    Apparently, relative path from the repository dir does not work when using rsync, so we must use absolute path. Again, I wish this comes as default in the Cpanel "Deploy" button.

    WARNING with this command! rsync --delete will delete also ignored files in the repo. So if you use for example a laravel application, the .env file will be deleted, and also all storage files created from the app... Ask me how I know. The only real solution, IMHO, is that cpanel did the checkout -f the branch to the destination folder.
    0
  • cPanelMichael
    Hello @mariavilaro, I edited the previous posts to remove references to that rsync command in an effort to prevent others from unintentionally removing files or directories under their accounts. Thank you.
    0
  • lieferbaer
    Update: The previous script I posted does not actually work but this one now does: Removed the rsync example command because it can lead to unexpected file removal.
    Apparently, relative path from the repository dir does not work when using rsync, so we must use absolute path. Again, I wish this comes as default in the Cpanel "Deploy" button.

    Hi @kabatak, can you share your working command "resync" with me over email: postwayAThotmail DE. Although using absolute paths, cpanel not executing my command. I think so, this should come as default in the Cpanel "Deploy" button too. Thank you.
    0
  • kabatak
    @lieferbaer Sorry for late reply but I am no longer using the Git feature in Cpanel at the moment.
    0
  • kamm
    What's everyone currently doing to deal with deleting files? I don't see a solution here.
    0

Please sign in to leave a comment.