3

I'm writing a little app in KohanaPHP framework. Suppose, this app will have some updates in future. Current version is for example v1.0.

What is the best and the most optimal way to:

  • check if there is some new version
  • and if so, update files in current server from remote server

So far, I use cURL to get info form version.txt file in my remote file and then I compare it with constant variable in app engine. Then I use https://github.com/kanema/kohana-ftp module to connect with server and update app.

Is there any better solution, especially in checking for updates (this with version.txt is a bit annoying and take some time).

Mr Sooul
  • 659
  • 2
  • 9
  • 19

2 Answers2

2
  1. Use some version control system like Git.
  2. Use some update scripts, scripts checking whether the current version (version on production) is the same as in the remote repository (the most up-to-date one, the one updated when you make changes) and - if the versions differ - update the production.
  3. Invoke the script from point 2. on a constant basis, for example using cron.

This will be the fastest (based on Git internal mechanisms) solution, very reliable (you will be using version control system) and quite secure (you will not be overwriting for example files uploaded by users).

There are some examples of such tools on the Internet.

There is also some example of simply pulling recent changes from the Git repository using cron jobs here: stackoverflow.com/questions/4414140/git-auto-pull-using-cronjob

Alternatively, you can use so called "Service hooks" to call the update scripts only when the version in the repository is changed by someone making the push to the repository (feature is available for example in GitHub).

Community
  • 1
  • 1
Tadeck
  • 132,510
  • 28
  • 152
  • 198
0

It depends on your platform. I personally use/support Linux, and use packages (e.g. .deb for Debian-based systems) to bundle, install, and update my apps/services.

AJ.
  • 27,586
  • 18
  • 84
  • 94