LAMP project migration

I have been involved in a birdwatching community web project for a long time. At the moment it has 250k pictures, 2500 blog posts from community members.

The site is a custom development – written by Askar Issabekov with php and MySQL and hosted under Dreamhost dedicated server.

Initially the migration plan was

  • get and configure new hosting
  • copy php scripts and media files
  • backup/restore MySQL databases
  • update hosts files and ensure everything works good
  • set source site in “maintenance” mode
    • put notification on the site header
    • set databases in read-only mode
  • backup/restore MySQL databases again
  • copy media files delta
  • set databases in r/w mode
  • ensure everything works good
  • change DNS from old host to new host

Some more data:

  • MySQL database: 120 MB

It turned out that

  • Source host uses Apache and target host uses Nginx
  • phpMyAdmin cannot import database from SQL backup

So we ended up the following

  • backup and document existing environment
  • get and configure new hosting
    • ensure php version is the same
  • copy php scripts and media files
    • remove all .htaccess and update nginx config files accordingly,
      e.g. Index etc.
    • fix files permissions (chmod)
  • backup/restore MySQL databases
    • if the database is big
      • – consider splitting database – a few tables each backup/restore
      • – consider zipping database while export-import
    • if phpMyAdmin fails – use command-line mysql
    • update database connections (user names, passwords, database names and hosts)
      as temporary measure – it is possible to allow access to old host databases from new host ip
  • update hosts files and ensure everything works good
  • set source site in “maintenance” mode
    • put notification on the site header
    • set databases in read-only mode
  • backup/restore MySQL databases again
  • set databases in r/w mode
  • copy media files delta
  • ensure everything works good
  • change DNS from old host to new host

Question: to avoid hassles with hosts files – is it possible to use a different real target name, then after verifying everything works good – change name

We’d also need to take care of e-mail migration

(WIP)

Leave a Reply

Your email address will not be published. Required fields are marked *