English 中文(简体)
Synchronising scripts / db / files from dev system to web server
原标题:

I work as a freelance web dev, and up until now have been ftping my scripts / databases / static files to my web server manually, but I m finding that is too error prone. So I m looking for an app to automate uploading new and updated scripts / files / databases / etc. I know a lot of independent devs use WinSCP or Unison, but I don t think those apps can synch databases.

Does anyone have any other suggestions? It doesn t need to be anything overly feature rich as I m not working within a team or across multiple operating systems or anything like that. I can purchase any reasonably priced license if necesary. My work is primarily for PHP / MySQL / Apache on a Windows system, and then uploaded to a Linux / Apache server.

thanks for your time!

最佳回答

You can use something like rsync which will synchronise anything and will work over an SSH connection. However, you may want to consider separating your application from the data and use different methods. Presumably, if you develop on your machine, you will run local tests and the local data should not normally go onto the website. In that case, if you run something like SVN locally, and then use an SVN client on the webserver to pull down updates, you can synchronise the application without affecting the data.

Of course, when you need it, rsync can be used to upload everything, for instance to a new site.

By its nature, rsync can restart smoothly whenever a transfer is interrupted, because it always compares both source and destination, and then transfers only as much data as is needed to make the destination equal to the source. This means that most of your transfers will run a lot faster than with FTP.

If the nature of your web application requires the database to be regularly updated, do not be tempted to try SVN because revision control systems really only work well with source code files. Also, when you use rsync to send an update, you have to make sure that the database is not active because it is effectively in a corrupt state until the rsync completes successfully. If you always update to a staging folder on the web server, and then move that into production when the database is shut down, that would work best.

问题回答

Hopefully you re using some kind of version control system like SVN or Mercurial. Then all your developers can work from the same repository, will have a complete history, and most of the merging will happen automatically.

Not using version control is a huge pain in the ass! You will accidentally stomp on eachothers work, lose files, forget what was changed, have multiple copies of files everywhere, etc. Version control systems deal with all these issues plus they centralize your code into a single location to pull from and push to.





相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签