New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
git - auto update
Hi,
I'm running my own Gitea instance where I'm hosting most of my web projects.
I then clone this repo to my main production server, which works without a problem.
However, I always have to run "git pull" on the production server, after I have committed some changes.
Is there a way to keep it automatically updated so I don't have to run the command every time after a change?
Thanks!
Comments
git pull in a cronjob.
Make a separate branch for that.
Is there a better way than a cronjob?
Could run a daemon on the server which listens for webhooks and pulls on request.
I think it could all be automated with something like jenkins
You need a CI system for that. Drone works well with Gitea, Gitlab has their own built-in. Jenkins is one of the oldest one and it's a mess but some like it.
gitlab-ci would be a great way.
You just tell it to scp your files to your production server. At least that is what I have done in the past. Currently I just make docker images, as they are more portable.
You would need a runner for this... I am using gitlab-runner. Not sure what your product has.
i can also recommend gitlab ci - easy to use, provides a complete git management solution.
and for your use case: you can create configuration gitlab-ci.yml like AlyssaD mentioned that deploys your code after building.
but for security you should execute deploy only if unit tests etc. pass and maybe still better manually, i can guarantee oneday you will deploy a bug because of autodeploy..
so maybe add "when:manual" it means, when pipeline passed with code analysis, unit ttests etc. u click the "deploy" button in gitlab manuall and it auto deploys.
for some languages like php tool like "deployer" can help with deploy workflows like ssh, minify css etc.
This is possible via Gitea webhooks, you could set up a webhook and call a pull after an update has gone through.
https://docs.gitea.io/en-us/webhooks/