Maintaining Remote Web Sites With sitecopy (Debian Squeeze/Ubuntu 11.10)
Maintaining Remote Web Sites With sitecopy (Debian Squeeze/Ubuntu 11.10)Version 1.0 sitecopy is a tool for copying locally stored web sites to a remote web server (using FTP or WebDAV). It helps you to keep the remote site synchronized with your local copy by uploading modified local files and deleting remote files that have been deleted on the local computer. This tutorial shows how you can manage your remote web site from your local Debian Squeeze/Ubuntu 11.10 desktop with sitecopy. I do not issue any guarantee that this will work for you!
1 Preliminary NoteI'm using the username falko on my local Debian Squeeze/Ubuntu 11.10 desktop (I'm logged in on my local Linux desktop as that user - please don't log in as root). The files for the remote web site example.com are stored in the directory /home/falko/sites/example.com/ on the local computer. The remote document root is /var/www/example.com/web/. You can use sitecopy with FTP and WebDAV, so you should either have an FTP or a WebDAV account on the remote server. I'm using the FTP/WebDAV username defaultfalko and the password howtoforge here.
2 Installing sitecopysitecopy can be installed on the local desktop as follows (we need root privileges, therefore we use sudo): sudo apt-get install sitecopy You should now take a look at sitecopy's man page to familiarize yourself with its options: man sitecopy
3 Configuring sitecopyGo to your home directory on the local desktop... cd ~ ... and create the directory .sitecopy with permissions of 700 (sitecopy uses that directory to store file details): mkdir -m 700 .sitecopy Next create the sitecopy configuration file .sitecopyrc: touch .sitecopyrc Open the file... vi .sitecopyrc ... and fill in the configuration for the example.com site. Here are two examples, one for FTP...
... and one for WebDAV:
(You can define a stanza for each web site you want to manage with sitecopy.) The site directive must be followed by a name for the web site - you can freely choose one, e.g. example.com or mysite. This name will be used later on in the sitecopy commands. The following configuration options that belong to that site must be indented! Most of the following configuration options are self-explaining. The default protocol is FTP; if you want to use WebDAV, please specify protocol webdav. The local ditective contains the local path of the web site copy, remote contains the path of the web site on the remote server - it can be absolute or relative. If your user is chrooted (as is normally the case with FTP users), you should use a relative path (such as ~/ or ~/web). Otherwise use an absolute path. The exclude lines are optional, they are here just to demonstrate how you can exclude files from being maintained by sitecopy. You can find out more about sitecopy configuration on its man page: man sitecopy
4 First UsageBefore you use sitecopy for the first time, you have to decide which of the following three scenarios matches your situation:
4.1 Existing Remote Site And local Copy, Both In SyncIf both the remote site and the local copy exist and are in sync, run sitecopy --catchup example.com to make sitecopy think the local site is exactly the same as the remote copy. Replace example.com with the name of the site you use in the .sitecopyrc file. falko@falko-desktop:~$ sitecopy --catchup example.com
4.2 Existing Remote Site, No Local CopyIf you have no local copy of the existing remote web site, run sitecopy --fetch example.com first so that sitecopy fetches the list of files from the remote server (replace example.com with the name of the site you use in the .sitecopyrc file): falko@falko-desktop:~$ sitecopy --fetch example.com Then run sitecopy --synch example.com to update the local site from the remote copy. falko@falko-desktop:~$ sitecopy --synch example.com
4.3 New Remote Site, Existing Local CopyIf the local copy exists, but you have an empty remote site, run sitecopy --init example.com first to intialize the site. Replace example.com with the name of the site you use in the .sitecopyrc file. falko@falko-desktop:~$ sitecopy --init example.com Then run sitecopy --update example.com to upload the local copy to the remote site: falko@falko-desktop:~$ sitecopy --update example.com
5 Using sitecopyAfterwards, sitecopy usage is really easy. You can work with your local copy and update, create, and delete files. A first, but optional step is to run sitecopy example.com to find out which files have changed locally (replace example.com with the name of the site you use in the .sitecopyrc file): falko@falko-desktop:~$ sitecopy example.com To synchronize your remote web site with your local copy (i.e. upload new and changed files to the remote server and delete files on the remote server that have been deleted locally), you simply run sitecopy --update example.com falko@falko-desktop:~$ sitecopy --update example.com That's it! Have fun with sitecopy!
6 Links
|




Recent comments
8 hours 43 min ago
11 hours 38 min ago
12 hours 52 min ago
14 hours 15 min ago
15 hours 53 min ago
17 hours 22 min ago
18 hours 36 min ago
1 day 10 hours ago
1 day 11 hours ago
1 day 15 hours ago