Backup and restore
Backups are your site's last line of defense. All data on a Zittme site lives in two places.
| Target | Contents |
|---|---|
| Database | Almost all data, including posts, comments, members, and settings |
| files/ folder | Attachments, site settings (files/config), and cache |
With just these two, you can restore your site anywhere. Core files are not backup targets because you can simply download the distribution again. However, keep any third-party resources you installed yourself (additions to modules, addons, layouts, widgets, and themes) along with them.
How to back up (your own server)
# DB
mysqldump -u 사용자 -p DB이름 | gzip > backup-$(date +%Y%m%d).sql.gz
# files 폴더 (캐시는 제외해도 됨)
tar czf files-$(date +%Y%m%d).tgz --exclude='files/cache' files/Register these in cron to keep a copy automatically every day, and always copy the backup files off the server too (another server, your own PC, or cloud storage). If the whole server dies, the backups on it disappear as well.
How to back up (web hosting)
- Export SQL from the DB management tool (phpMyAdmin, etc.) in your hosting control panel.
- Download the
files/folder over FTP, or bundle it with the file manager's compression feature and download it. - Even if your host provides an automatic backup service, take another copy yourself before any important change.
Restore procedure
- Extract a fresh distribution and put the core files in place.
- Restore the backed-up
files/folder in its entirety. (files/configcontains the DB connection info) - Create a new DB and import the backup SQL.
- Put the third-party resources back in their original paths.
- Visit the site to check it. If the screen looks wrong, empty the contents of
files/cache. - Before a core update
- Before installing or updating third-party resources
- Before changing your domain or moving servers
- Before bulk deletion or cleanup work
If the DB connection info (host, account) has changed, update files/config/db.config.php with the new values.
When you must back up
Moving servers
Moving is the same as restoring: move the distribution + files/ + DB to the new server, configure the web server, and then point DNS to the new server. It is safer to check the new server in advance using your hosts file before switching DNS.