I have some Codeigniter projects on some domains (on the same server), and the project is already in git.
How to ensure server gets the new update when I push the code to git?
Can anyone explain to me step by step?
You can achieve this using Git and Jenkins job. Create a Jenkins Job to deploy your code to server and Setup Git webhook to Call Jenkins job.
Check this link: https://www.serverkaka.com/2019/02/configure-github-webhook-in-jenkins-job-pipeline.html
OR
Create an empty Git repo on the server
Write a Git Hook to deploy the code
Deploy from the local computer
Check this link: https://medium.com/@francoisromain/vps-deploy-with-git-fea605f1303b
Depens on how you hosting your application in production
docker swarm deploy
to update your containersGit itself has a server-side post-receive
hook. You can use it to run a command that triggers your deployment whenever you push to your repo. Web services like Gitlab or Bitbucket rely on this mechanism to offer plug-ins that trigger CI services. Less flexible but you can configure it conveniently from the web front end.
Another option would be to use a tool like Puppet on the target machine that periodically checks the repo for changes and pulls them in. The following Puppet code would clone/update the repo into the /path/to/repo
directory (by default Puppet runs every 30 min):
vcsrepo { '/path/to/repo':
ensure => latest,
provider => git,
source => 'git://example.com/repo.git',
}
See the documentation of the vcsrepo module for details.
.gitlab-ci.yml
file see here docs.gitlab.com/ee/ci/yaml/README.html