1

So my job is to take the homepage (or maybe I should say "homesite" because it encompasses a few interrelated pages) and drag this onto its own Apache server. The problem I'm having right now is being able to weed out jumbled/bundled files (such as folders of js, css, and other files that i cant even identify) and knowing what is necessary to keep the homesite running.

I'm new to this stuff (I'm an intern) so feel free to ask questions if I'm leaving vital information out.

What I'm asking of you guys here is basically any pointers or tips you may be able to give me in order to get the job done. I could use some advice from people with a little more experience in web development.

btw: This question may appear as though I have not completed any prior research and that is, for the most part, true. But the problem is I really am not sure how to research this. If you guys could throw me some keywords to play with that would really be helpful. Thanks!

3 Answers 3

1

There are two ways to do this, both of which are a bit tedious.

Method #1: Search the code

Use a tool to do a text search throughout all of your code for each file name. (Just the file name, not the path! Relative paths are often used.) Then, make a determination for each instance whether or not that file is in use. This is a real hassle, but important.

Method #2: Analyze server logs

Run a crawler on all of your pages. Check your server's access log. Write a script to (or manually) search through that log for each file name in your source tree to see if it was accessed. Danger Will Robinson, as this will not catch included files! This is only useful for resources loaded client side, such as CSS, JS, and images. Also beware of minification that hide that these files are in use.

Finally, when you are all done, be sure to check error logs and what not to see if you broke anything. Make backups (and/or version control!) as you go.

0

To generic question. Usually it should suffice to:

  • move scripts and files (pack all with i.e. tar) if sites use
  • database, dump all databases (do NOT move binary table files)
  • check for cronjobs

on new server unpack all stuff, import databases, update script configs to point to them, adjust httpd/php/whatever setting if you got special needs. Done.

5
  • I don't think this is at all what he is asking. He needs to know how to figure out which resources in a site are no longer being used. At least, that's my read.
    – Brad
    Sep 11, 2012 at 17:28
  • do NOT move binary table files -- for large databases, this is the preferable method. Shut down the database, and cp the entire database directory. I do this all the time for both mysql and postgres databases. For ~100GB databases, it's orders of magnitude faster than a dump/reimport. It is easy to shoot yourself in the foot if you don't know what you're doing, though.
    – Frank Farmer
    Sep 11, 2012 at 17:30
  • @FrankFarmer, I doubt this guy is working with 100GB databases. In his case, it is definitely appropriate to do a dump to SQL. In any case, if you do move the binary versions, it is important to point out that the proper upgrade commands be run, and re-indexing may also be necessary.
    – Brad
    Sep 11, 2012 at 17:31
  • @FrankFarmer sure, but only if you know you got no binary format mismatch. He does not look experienced much and this is not "sysadmin for dummies" :)
    – WebnetMobile.com
    Sep 11, 2012 at 17:31
  • @Brad maybe you are right. But most sites usually sit nicely in one folder (and subfolders) so my approach may suffice as well. If he got something ultra-crappy-custom-tricky-made which spreads everywhere on the disk, then it might be cheaper to pay someone to fight this mess though
    – WebnetMobile.com
    Sep 11, 2012 at 17:33
0

It all depends on wether the site is driven by a database and serverside scripting, or if it is just a bunch of html, css, js and media. For simple sites there are tools out their that allow you to download an entire website. I often work with Sitesucker (http://www.macupdate.com/app/mac/11634/sitesucker) on the mac, but there should be plenty of tools for other platforms as well. I believe there are even some browser plugins available. I'm not sure if it will be as easy as copying the output from these tools to your server, but it should give you a good starting point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.