Anonymous

Changes

From NixNet
m
minor edits
= Installation =
The package is called <code>tarsnap</code> on most distributions and is usually included in the official repos. If it's not, take a look at their [https://www.tarsnap.com/download.html download page]. After installation, generate a key and associate it with your Tarnsap account using the following command.
<pre>
tarsnap-keygen --keyfile /root/tarsnap.key --user name@example.com --machine hostnameHOSTNAME
</pre>
= Configuration =
The configuration file is usually stored in <code>/etc/tarsnap.conf</code>. You may need to copy the sample configuration to <code>/etc/</code> from elsewhere but it's likely already in the production config before editingright place. This is what we use but make sure to look at the sample and read the manual before copying and pasting this.
<pre>
We use [https://github.com/alexjurkiewicz/acts/ ACTS] for automation. It stands for ''Another Calendar-based Tarsnap Script'' and manages backup creation and rotation. It keeps 31 daily backups, 12 monthly backups, and never deletes yearly backups; maintaining those are on you. When you feel like a specific yearly backup is no longer necessary, delete it yourself.
After adding a new user to our database that has read-only access to everything, we'll configure ACTS, create pre- and post-backup scripts for managing database dumps, configure ACTS, then set up email alerts.
== Database dumps ==
=== Setting PostgreSQL up ===
Same as above but PostgreSQL variant; you'll have to repeat the GRANT these statements after connecting to ''every'' database you want backed up. From what I can tell, there is no way to give a user read-only permission across ''all '' PostgreSQL databases.
<pre>
CREATE ROLE archive WITH LOGIN ENCRYPTED PASSWORD 'CHANGEMETOSOMETHINGSECURE';
DAY=$(date +%Y-%m-%d)
# Pick a database server, postgres or mysql
DATABASE=postgres
== ACTS configuration ==
ACTS can be installed by simply <code>wget</code>ing <code>acts</code> and <code>acts.conf.sample</code> directly from [https://github.com/alexjurkiewicz/acts/ the repo]. Alternatively, you can clone the whole repository and symlink <code>acts</code> to wherever you like for easier updates then copy <code>acts.conf.sample</code> to <code>/etc/acts.conf</code>. The following is how we do it.
<pre>
</pre>
Make sure you reference the sample configuration file but these are the base options we use. Add additional directories to the <code>backuptargets</code> line, omitting the preceding <code>/</code>. Until you run ACTS and verify that your configuration works properly, leave <code>verbose</code> set to 1. After you're sure everything works, set it to 0. ACTS expect expects the config file to be located in <code>/etc/acts.conf</code>
<pre>