If you like DNray Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

Site versions control on regular hosting

Started by pavithrathiva, Jan 14, 2023, 12:58 AM

Previous topic - Next topic

pavithrathivaTopic starter

Greetings experts,

I am exploring the option of shifting the development/support of websites to Git. However, there's a challenge here - almost all client websites are hosted on regular hosting sites that have FTP access. It's not very convenient to work with such hosting sites.

Although I've been wanting to use Git for a long time, I'm unsure how to apply it to these sites. Several people can work on them and when filling in, possible changes already on the hosting need to be taken into account. It's easy to merge everything and create a repository on Github or Bitbucket, but I am yet to figure out how to fill everything on hosting.

Do you have any suggestions or solutions? Thanks.
  •  


britals1

This recipe for transferring files is incredibly easy. Here's how to do it:

1. Choose any VPS, even a cheap one will do if you don't have your own server.
2. Set up the appropriate number of GIT repositories on the VPS.
 
3. Within each repository, add a script hook that will upload modified files to your desired FTP web server.
   
There are solutions readily available for script hooks to be found through the provided links.

All you really need to do is familiarize yourself with the Git "hooks" mechanism.
Additionally, you might want to look into commands for launching FTP clients through the console or investigate methods for mounting FTP as a file system. With so many options available, simply choose what works best for you.
  •  

DavidBloom

The ftp protocol operation is not supported by git, leading to the following suggested approach:

1) Begin with an empty repository in bitbucket or github (note that private repositories are chargeable in github).
2) Clone the repository locally into folder X.
3) Establish configuration of the ftp client (such as FileZilla) to folder X and the hosting folder.
4) Upload the site files to the hosting.
5) Add the new files to git (git add).
6) Commit from (git commit -a).
7) Send the changes to a remote repository (bitbucket/github, git push).

Periodic ftp merges files to a local folder, while git diff is used to inspect changes. If valid, perform git commit, if not, revert the necessary ones (git checkout file_name). Follow up with git commit then send to a remote repository (git push), then re-upload from a local folder.

Additional suggestion: use a Git-FTP tool to streamline this process and automate these tasks for faster results and less hassle.
  •  

Tabslogic

Deploybot is a platform that facilitates efficient deployment of your projects. It offers a plethora of functionalities to make the process easier, including uploading via ftp, sftp, and atomic sftp.

Moreover, you have the option to pre-assemble the frontend on a separate docker container, which can make deploying even smoother.

An added benefit is the ability to specify patterns of excluded files or folders to be uploaded, enabling you to keep your project organized and streamlined.

Deploybot also offers notifications via various services such as Slack, so you can stay up-to-date with the status of the upload.

However, it's important to note that Deploybot is a paid service, costing $15 per month for up to 10 projects.
  •  

esparkinfo

One possible solution to your challenge is to use a Git deployment workflow that incorporates continuous integration and deployment (CI/CD) tools. This can help automate the process of deploying changes from your Git repositories to the hosting sites.

Here's a suggested approach:

1. Set up a Git repository on a platform like GitHub or Bitbucket for each client website.
2. Each developer can clone their respective repository locally and make changes there.
3. Use Git branching and merging to manage concurrent development by multiple team members. Developers can create feature branches, make changes, and then merge them back into the main branch.
4. Set up a CI/CD pipeline using a tool like Jenkins, Travis CI, or CircleCI. This can be configured to automatically build and deploy changes to the hosting site whenever a commit is pushed to the main branch.
5. Configure the CI/CD pipeline to use FTP or SSH to transfer the built and compiled website files to the hosting site. This can be achieved using plugins or custom scripts specific to your hosting provider.
6. Make sure to configure the CI/CD pipeline to account for any possible conflicts or changes already on the hosting site. For example, you can pull the latest changes from the hosting site before deploying the new changes from the Git repository, and then resolve any conflicts if necessary.
7. Test the deployment process thoroughly to ensure that it works as expected and doesn't cause any disruptions to the live websites.

By implementing this workflow, you can leverage the power of Git for version control and collaboration, while automating the deployment process to make it more convenient and efficient.
  •  


If you like DNray forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...