Edwin Huijsing

Registered
Aug 20, 2018
2
0
1
Germany
cPanel Access Level
Root Administrator
Hallo,

I am trying to use the git push deployment as shown https://documentation.cpanel.net/display/CKB/Guide+to+Git+-+How+to+Set+Up+Deployment.
The only problem that i face is the lack of information about the `.cpanel.yml`, this is the only information i have:
Code:
---
deployment:
 tasks:
  - export DEPLOYPATH=/home/user/public_html/
  - /bin/cp index.html $DEPLOYPATH
  - /bin/cp style.css $DEPLOYPATH
Based on this i create a file that holds a create lines for all directories and a copy lines for each file. I am also able to use composer.
I have search the net, but found nothing, about how to use yaml for this type of deployment.

Questions
* Is the target directory cleared (directory/files deleted) before the yaml is run?
If yes, how do i prevent that some directories/files are deleted?
If no, what is the best way to handle directory and file deletion?

* Where can i find more detail information about allowed yaml commands that can be used for deployment. Or should i say, where can i find more information about the hook that uses the yaml file.


Note:
While typing i noted that i can reduce the create directory and copy files if i use something like this
Code:
cp -r ./SourceFolder ./DestFolder
Regards
Edwin Huijsing
 

cPanelAdamF

cPanel Product Owner
Staff member
Mar 21, 2013
252
67
153
Houston TX
cPanel Access Level
DataCenter Provider
Twitter
In general, you can think of the cpanel.yml file as a shell script which will execute when the conditions are right for a deployment. cPanel doesn't do any special clean up before or after a deployment so the previous folder structure will remain for the next run.

While you can totally do any deployment strategy you like, I would suggest keeping your repository's working tree a separate thing from the document root where your project is being hosted out of. In the past, I've encountered a strategy where a symlink exists as the document-root of a domain and is then modified as the last step of a deployment to point at a new document root. (I have not done this myself, only that it's a common strategy)

Ultimately cpanel.yml is carte blanche!
 
  • Like
Reactions: frankbret

Isaac Hatilima

Registered
May 31, 2019
1
0
0
Lusaka, Zambia
cPanel Access Level
Root Administrator
Hello,
I am equally just starting with this. How ever my situation is a bit different. I want to know if I can have multiple export deploypaths in one yml file to my different subdomains. Same website different subdomains.
Thank you
 

cPanelAdamF

cPanel Product Owner
Staff member
Mar 21, 2013
252
67
153
Houston TX
cPanel Access Level
DataCenter Provider
Twitter
Hello,
I am equally just starting with this. How ever my situation is a bit different. I want to know if I can have multiple export deploypaths in one yml file to my different subdomains. Same website different subdomains.
Thank you
The easiest being to point the second subdomain's document root to the first's. Here's how to do that:
  1. Log into your cPanel account
  2. Browse to cPanel » Home » Domains » Domains
  3. Locate the first subdomain whose content you want to _also_ appear at another subdomain
  4. Copy it's Document Root value into your copy-paste buffer
  5. Locate the second subdomain where you want your content to also appear
  6. Paste the document root value from your copy-paste buffer to the document root value of the second subdomain
  7. Save the subdomain
 
  • Like
Reactions: cPanelMichael