Answer the question
In order to leave comments, you need to log in
How to implement auto-deploy with bitbooket?
Good afternoon.
I have never used the git before, I improved my knowledge on it at the weekend - I liked it. I also heard about auto-deployment of certain git branches for the test and main server when their branches change.
As implemented now:
Created a repository on bitbucket
Generated an rsa key on the server, registered it in the settings.
The site got three subdomains:
dev.xxxx - test server
www.xxx - main
git.xxx - for webhook bitbucket
Above the domain root for webhook, I created a git folder, cloned the bitbucket repository there.
Registered webhook bitbucket at dev.xxx/deploy.php?key=xxxx The result was
a file with something like this:
// проверка на наличие обновлений в ветке, если есть - продолжаем, иначе выход
// обновляем репозиторий
system("cd ".$git."; git checkout dev; git pull;");
// удаляем папку с основными данными
system('rm -rf '.$dev.'/app');
// удаляем папку vendor
system('rm -rf '.$dev.'/vendor');
// копирум новые данне
system('rsync -av --exclude=".git" '.$git.'/ '.$dev);
// Запускаем composer
system('cd '.$dev.'; export COMPOSER_HOME="'.$composerTempDir.'"; '.$php.' '.$composer.' install 2>&1');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question