Manage SFTP web project on multiple remote web hosts at the same time

I have already done some research but unfortunately I could not find a solution that I could do in my case.

So, work on LAMP stacks and for a customer there is the problem of having to work simultaneously on three different trunks of the same project. So, at this time, there are three hosts (on the same server):

develop.myproject.ext
testing.myproject.ext
production.myproject.ext

As conceivable, the project has this course: 1. new features are developed on the develop version of the project 2. just finished, they are "copied" to the testing version, where testing is done by customer 3. Once everything is working and customer approves, the changes are reported in the production version

I use Elementary OS and Sublime Text 3 with the SFTP plugin (each time a file is edited, the save is automatically loaded on the destination host).

At the moment, I use a method not very convenient, that is, a file where I keep track of the updated files for each host, which is very dispersive (i need to know for every host where i loaded which file) and the thing is likely to create conflicts in case there they are both development and testing (for example, I have version 1.2 of a develop file, 1.1 on testing, and 1.0 on production).

Is there a methodology, a program, in short, something that can facilitate this management?

I have already evaluated the option to use Git (Gitlab in particular), but this assumes that it has to pass each time from the terminal (or use plugin on Sublime Text) to load the file and still have three separate branches, which seems, however, unmanageable (I do not need to have all the history and functions that git offers me).

Since all three hosts operate on different databases, it would be convenient to have a management tool that automatically migrates the entire database from production to the other two hosts (the one that is constantly updated). However, this is not particularly urgent because I have found a temporary solusion using a series of automatic bash scripts.

Thanks to anyone who decides to help me.


The git solution should work well with branches for each build

  • Develop
  • Testing
  • Production

The relevant branch can be fast forwarded to the new point each time, making it easier to keep the 3 versions in sync.

Example

(1 | DTP)

You add 2 commits to develop

(1 | TP) -> (2) -> (3 | D)

Once you are happy, you fast-forward testing to develop

(1 | P) -> (2) -> (3 | DT)

Once you are happy with that, you fast-forward production to testing

(1) -> (2) -> (3 | DTP)

The commits here could be merging in feature branches, or whichever workflow you prefer

As for uploading, you can either pull on the server, or if you cannot get a shell you can have a script checkout each branch and push it to the relevant server automatically.

If these are all web servers then you could use a server like caddy with a plugin like this, which will automatically sync itself with your repo, so the script would be unneeded