1

So I have a strange question, but I'm working on a script to deploy a PHP codebase and want to see if something like this is possible:

I have a directory that Apache uses as a DocumentRoot:

/home/www/

We have a PHP app that must add several files and directories to this directory.

We are currently doing this by SCP'ing a tarfile and extracting it in /home/www. I'm looking to do this in a better way because when we are extracting the files, our PHP app gets some read permissions errors. I'd like to update these file atomically inside /home/www (and preferably "at once")

Is there a way to do this without having to make a symlink to every file/directory that I'm extracting into the web directory?

mmattax
  • 1,284
  • 7
  • 19
  • 30

1 Answers1

3

I generally will setup something like this.

/var/www/version1
/var/www/version2
/var/www/production (document root, symlink -> current version)

So basically you just upload to a new directory, once the upload is complete tweak your symlink and everything changes at once.

When applications are designed in a way to separate code from the application (like they should!), then life is a lot more complicated. You may have to do something with a unionfs.

Zoredache
  • 128,755
  • 40
  • 271
  • 413