How to customize .cpanel.yml in this scenario?
/home/user/repository/ is a git repository, it is a Laravel directory that includes:
.git/
app/
public/
config/
routes/
datatbase
.cpanel.yml
server.php
....
and the root directory /home/user/ includes default cpanel folders plus the content of /home/user/repository/ except:
public_html/ instaed of public/ with the same content
no .git/ folder
how to customize .cpanel.yml to:
- copy all directories from /home/user/repository/ to /home/user/ except public/ and .git/
- copy the content of /home/user/repository/public/ to /home/user/public_html/
-
I believe the information here - specifically the bash command examples might be useful: Guide to Git - Deployment - cPanel Knowledge Base - cPanel Documentation But I don't think there is a way to exclude files natively though you might be able to write a the cp to exclude - there's a pretty informational discussion on this here: How to use 'cp' command to exclude a specific directory? 0 -
the documentation needs more details about the syntax used in `.cpanel.yml`, for example: - can you use `/bin/rsync` instead of `/bin/cp`? - can you use different name than `DEPLOYPATH`? - what does `export` do? and can you use multiple `export` statements? 0 -
While I do definitely agree this could use more examples, I believe you can use any bash commands here. You can read the man page about export from the CLI: man export
Essentially though: Set an environment variable. The supplied names are marked for automatic export to the environment of subsequently executed commands.0 -
this works fine: --- deployment: tasks: - export ROOT=/home/maahadonline/ - /bin/ls -A -I ".git" -I "public" | /bin/xargs -I % /bin/cp -ru % $ROOT # print without copy : - /bin/ls -A -I ".git" -I "public" | /bin/xargs -t -I % /bin/cp -ru % $ROOT - export PUBLIC=/home/maahadonline/public_html/ - /bin/ls -A -I ".htaccess" public | /bin/xargs -I % /bin/cp -ru public/% $PUBLIC # print without copy : - /bin/ls -A -I ".htaccess" public | /bin/xargs -t -I % /bin/cp -ru public/% $PUBLIC 0
Please sign in to leave a comment.
Comments
4 comments