I have the following setup
[dev laptop] -- git push --> [gitlab]
|
git pull
|
V
[prod server]
The above result in the following workflow
dev-laptop$ git push gitlab
dev-laptop$ ssh prod-server
prod-server$ cd app
prod-server$ git pull gitlab
prod-server$ pm2 restart app
prod-server$ exit
dev-laptop$ rsync
images and other binary files between dev and prod
How can I reduce the number of the above steps? Here is what I've thought:
get rid of gitlab in between so that I
git push
directly from my dev-laptop to the prod-server. But I don't know how to do this or if it can even be done.set up some
git hooks
on gitlab so when Igit push
to it, onpost-receive
, gitlabgit push(es)
the changes to the prod-server. And, add apost-receive
git hook on the prod-server that restartspm2
. Of course, I don't quite know how to do this as well.
Update: Ideally, since I am the only developer in this project, I would like to have a workflow like so
[dev laptop] -- git push --> [prod server]
The above, in conjunction with a few git hooks
as described above, would simplify my life considerably. Of course, the danger is that I don't have a central repo anymore, so in case my dev laptop or prod server go belly up, I don't have a backup. But that is a danger I can choose to live with.
Update2: the safety of having a central repo is very attractive.