Add new admin page for backup/restore. Wrote initial text for Backing Up section.

This commit is contained in:
Thomas Karpiniec 2016-01-30 14:26:33 +11:00
parent 1bade119e2
commit b892d2c338
2 changed files with 45 additions and 0 deletions

View File

@ -25,6 +25,7 @@ $config["output_dir"] = "rendered/admin";
$config["pages"] = array( $config["pages"] = array(
array("id" => "installing", "title" => "Installing GNU social"), array("id" => "installing", "title" => "Installing GNU social"),
array("id" => "queue_daemons", "title" => "Using Queue Daemons"), array("id" => "queue_daemons", "title" => "Using Queue Daemons"),
array("id" => "backup_restore", "title" => "Backing Up and Restoring"),
array("id" => "upgrading", "title" => "Upgrading Your Installation"), array("id" => "upgrading", "title" => "Upgrading Your Installation"),
array("id" => "protocol_overview", "title" => "Protocol Overview"), array("id" => "protocol_overview", "title" => "Protocol Overview"),
array("id" => "contributing", "title" => "Contributing") array("id" => "contributing", "title" => "Contributing")

View File

@ -0,0 +1,44 @@
{HEADING:SECTION:backup_procedure:Backing Up}
<p>It is important to back up GNU social regularly. If you need to revert to an old backup you will lose any newer notices. Any follows that happened since then will result in mismatched information on your server and remote servers.</p>
<p>You should also back up immediately prior to any upgrade. This is especially important if you are following the <i>nightly</i> branch where serious bugs might slip through.</p>
<p>There are two parts to your GNU social installation and they most <i>both</i> be backed up at the same time.</p>
<ol>
<li>The files hosted by your webserver. This is a mixture of GNU social code and user data. This a directory probably located somewhere like <tt>/var/www/social</tt>.</li>
<li>The contents of the MariaDB/MySQL database.</li>
</ol>
{HEADING:SUBSECTION:backup_web_files:Web Files}
<p>You don't need to do anything fancy. Just make sure you have a copy of the folder. If you're using a commercial web hosting service there is probably a button you can press to download an archive of all your files. Note that this normally does <em>not</em> include your database.</p>
<p>If you have shell access on the server, assuming the GNU social folder is located at <tt>/var/www/social</tt>, you can make a compressed backup in your home directory like this:</p>
<p>
<tt>TIMESTAMP=$(date +%Y%m%d-%H%M)</tt><br />
<tt>cd /var/www</tt><br />
<tt>tar -Jcf "~/$TIMESTAMP-social-www.tar.xz" --exclude=.git social</tt>
</p>
<p>If you are serving files straight out of the git repository this will back up only the currently checked out copy, not the entire history. (Using a git repository this way is not recommended as you may cause chaos in your database if you accidentally check out the wrong thing.)</p>
{HEADING:SUBSECTION:backup_database:Database}
<p>There are many different tools and techniques for backing up MySQL databases. If you're using a commercial web hosting service there will probably be somewhere in the web interface where you can download a copy of the GNU social database.</p>
<p>If you have shell access the simplest way to create a backup is using the tool <i>mysqldump</i>.</p>
<p>
<tt>TIMESTAMP=$(date +%Y%m%d-%H%M)</tt><br />
<tt>mysqldump -u "database_username" -p "database_name" | xz -c - > "~/$TIMESTAMP-$DB_NAME.sql.xz"</tt><br />
(You will be prompted for a password. Type in the password for the MySQL user.)
</p>
{HEADING:SECTION:restore_procedure:Restoring from a Backup}
<p>TODO</p>