I work as a freelance web dev, and up until now have been ftping my scrip开发者_如何学运维ts / 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.
精彩评论