Skip to main content

Syncing subdomain with private Github repository

Comments

5 comments

  • cPanelLauren
    Hello, You wouldn't as far as I'm aware be able to do this when changes are made but you could set up a cron. I'd suggest reading the following:
    0
  • PluggedP93
    Hi Lauren, Thank you very much. That documentation helped out a lot, especially in terms of creating the proper ssh keys. I've now looked into CRON and it wouldn't do what i need it to, as we don't have a fixed release schedule, but more on a per-change basis. This is not however a huge issue since we can just click the "update" button. However, we would need to set up some sort of webhook that would run a script (ex: npm run start) every time the repository is deployed. Any tips? Thanks!
    0
  • cPanelLauren
    You're most welcome, I'm glad it helped! I think that this might get you going in the right direction? Git Version Control: Soon with Automatic Deployment! | cPanel Blog
    0
  • PluggedP93
    Hi Lauren, Thank you once more for that useful information. I have, following that, come up with the following .cpanel.yml file: --- deployment: tasks: - export DEPLOYPATHFRONT=/home/[user]/public_html/react/frontend - /bin/cp -R frontend $DEPLOYPATHFRONT - export DEPLOYPATHBACK=/home/[user]/public_html/react/backend - /bin/cp -R backend $DEPLOYPATHBACK Could you confirm if this seems appropriate? Also, I believe the command /bin/cp is only for copying files. What would the behavior be in the event where I needed some removed? And finally, Is it possible to add the execution of npm scripts to this file? Thank you once again, greatly appreciating your help!
    0
  • cPanelLauren
    Your YAML file looks good - I had someone else double-check it as well to ensure I wasn't missing something. Essentially any bash command can be run from the .yaml file as long as it doesn't reach outside the scope of the account's access (permissions). With that being said, you should be able to use /bin/rm
    to remove files - just as long as you understand that it will run that rm command every time this runs. You can also add npm scripts as long as they can be run in a bash command.
    0

Please sign in to leave a comment.