CVSviaFTP: Automagically update your remote FTP/WWW site

CVSviaFTP: Automagically update your remote FTP/WWW site

Post by Vadim Maslo » Tue, 13 Aug 1996 04:00:00



Hi, there!

I have to announce an addition to CVS that makes life
of Web designers and administrators easier.

Fast: you can do "cvs update" or "cvs checkout" over FTP connection.
Some of us have only FTP connection to the WWW site to maintain.
Copying changes from the test site to the production site
by means of FTP is sometimes the only option we have.

Get details and the modified CVS itself at

http://www.siber.com/cvs-via-ftp/

Details: README file included:

        CVSviaFTP: Automagically update your remote FTP/WWW site
        ========================================================

IMPORTANT note: This README file is updated, but not very frequently.
For the newest version look at http://www.siber.com/cvs-via-ftp/index.html.

CVSviaFTP is a life-saver for Web site designers and administrators who
need to update their site remotely using FTP protocol only.
Here's my story.

Why I did it
------------

I am maintaining a 700+ file multilevel WWW directory tree at
http://www.siber.com/ and I only have FTP access to the tree (my
provider took away shell accounts with access to Web sites from all
the customers citing security concerns).

Since I have a test site on my local computer and a production site on
the remote computer accessible only via FTP, I would have to manually
FTP over all the changes from the test site to the production site,
which is, to put it mildly, painful.

So I decided to modify revision control system named CVS to make it
update a mirror of the directory tree *via FTP protocol*.

The strong points of my designs are:
- Communication is minimal: only updated files are sent over FTP
  and nothing else.
- New directories are created automatically at the remote site.
  Unneeded directories are automatically removed.
- In addition to Update you can do a complete Checkout of the
  local directory tree to the remote site.

What is CVS
-----------

First, you need to know what the CVS is.  I don't really have time to
explain it, so let's assume that you know it.

And if you don't know what it is, you still can get my distribution of CVS
and read papers and man pages on CVS that appear the distribution.

In short words, CVS is a revision control system that's built on top
of RCS.  The good things about it is that it works, it's free, and I
like it.  RCS is a standard low-level Revision Control System most
widely used on UNIX and everywhere else.

How to Install CVSviaFTP
------------------------

First, download http://www.siber.com/cvs-via-ftp/cvs-1.8.1-via-ftp.tar.gz,
ungzip and untar it.

Then follow the instructions in the INSTALL file that's a part of
distribution.  CVS is installed just like any other GNU software
package.

How CVSviaFTP Works
-------------------

I modified CVS so that it can do "cvs checkout" and "cvs update"
at the remote site using FTP protocol.

To use the CVSviaFTP feature, download and install CVSviaFTP
(described above), and then type in your checked out directory:

cvs update   -F ftp_commands_file

                OR

cvs checkout -F ftp_commands_file

After updating your local directory in the file ftp_commands_file you
will get a sequence of FTP commands that upgrades the FTP-accessible
mirror of this local directory.

That is, CVSviaFTP will not start an FTP session for you, it will just
write out a file that you can later feed to your favorite FTP client.
It was done on purpose:
- Different people like different FTP clients;
- You need to prepend login commands and append
  quit or other finishing commands to the sequence produced by CVSviaFTP.
- For real sensitive sites you may want to manually check
  FTP command sequence just to be sure everything's OK.

How to Integrate It
-------------------

This is an example of a C shell script that does
the whole "local commit / remote update" thing:

#!/bin/csh -x
if ( "$1" != "" ) then
  cd ~/html
  cvs commit -m "$1"
endif
cd ~/html-dist/html
cvs update -F ftp.out -P -d
cat ~/etc/ftp-start $ftpfile ~/etc/ftp-finish >ftp-comms
ncftp -u gunky.junky.com <ftp-comms

In this script the test tree is kept at ~/html, and the tree that is
to be mirrored at the remote site is kept at ~/html-dist/html.

The script commits changes in the test tree to the repository, checks
out changes to ~/html-dist/html and writes FTP commands to ftp.out.
Then header and finisher lines are added to the ftp.out and FTP is
called that executes the update at the remote site.

Notes On Use
------------

Read them if you want to know more:

CVS does not like symbolic links. CVSviaFTP does not like them
either.  It expects that "cd xxx/.." always gets to the
original directory.

You cannot do "cvs commit" via FTP, that is, repository
should be accessible to your machine in a 'regular' CVS way:
- Repository is mounted on local file system;
- Repository is on NFS-mounted file system;
- Repository is accessible via CVS client-server relationship.

My approach only works if initially the checked-out local directory
and the remote mirror directory trees are exactly the same, because
CVSviaFTP does not fstat remote files.
The reason it does not do it is that it slows things down
considerably (FTP protocol is slow), it is not portable (there is no
fstat command in FTP and format of ls's output is non-standard).

There is a bug in CVS: when you do "cvs update" with no arguments,
CVS does "cd ." and after processing matches it with "cd .."
which gets you to the level above from where you started.
Since current directory is not kept upon exit, you don't notice it,
but my ftp_cd() function does. However it keeps quiet about it
most time. Still fixing this bug is a good idea.

Before doing actual FTPing, it would not hurt to check file with
FTP commands. I use CVSviaFTP to maintain my live site at
http://www.siber.com, so please be assured that it is tested.
But taking a look at FTP command sequence before firing off FTP
would not hurt.

Legal Stuff
-----------

This software is distributed according to the GNU Public License,
that is for free (bezvozmezdno).

That is, you can use it for free, even to develop commercial products,
but if you modify it, the result is subject to the GNU Public License.

There is NO any explicit or implied warranty on this product, or any
promise thereof, that the product will work.  By downloading the
tarred-n-zipped distribution file you assume all the liability that
may arise from the use of this product.

Additional Services
-------------------

You can purchase a contract for maintenance of this product
from Siber Systems.

You are welcome to advertise at this page.

Final words
-----------

If you have questions/proposals, please contact


Last updated August 11, 1996.

 
 
 

1. Wanted: Auto FTP updates on remote web site

Hi there! Where can I find a program which allows you to automatically
synchronize a local development tree and a remote site via FTP
only? This is for a web site I admin where I only have FTP access to the
web server. Ideally, it would notice which files/directories have
changed between updates and transfer the appropriate files to the remote
site, creating and removing directories as needed.

I saw an announcement a few months ago of an open source program which
does this, but now I cannot find it anywhere. Please point me in the
right direction. Thanks!

-benjy

2. Problem: popclient shows password when someone 'ps -elf'

3. UPDATE: Linux Benchmarks WWW Site

4. help with iteration

5. WWW: Linux v2 Info HQ Web Site Updated

6. probeall usb

7. WWW: Request for Feedback on WWW site on Linux distributions

8. Redirection + alert messages

9. UnixWare FTP sites for my FTP sites FAQ?

10. How to send a file to a WWW or FTP site ?

11. WWW: Linux BYTE Benchmarks WWW Site

12. WWW/FTP patch sites?

13. Linux PCMCIA www and ftp site change