Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
217 lines (139 sloc) 12.9 KB
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width">
<title>Mail-in-a-Box Maintenance Guide</title>
<meta name="description" content="Maintenance instructions for Mail-in-a-Box. Take back control of your email with this easy-to-deploy mail server in a box." />
<meta property="og:site_name" content="Mail-in-a-Box">
<meta name="twitter:creator" content="@joshdata" />
<meta name="twitter:creator:id" content="352686442" />
<meta name="twitter:site" content="@mailinabox" />
<meta name="twitter:site:id" content="2612357965" />
<meta name="og:image" content="https://mailinabox.email/static/logo.png" />
<link rel="vcs-git" href="https://github.com/mail-in-a-box/mailinabox.email" title="code for Mail-in-a-Box website" />
<link rel="icon" type="image/png" href="/static/logo_small.png">
<link rel="apple-touch-icon" type="image/png" href="/static/logo_small.png">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />
<link rel="stylesheet" href="guides.css" />
<style>
</style>
</head>
<body data-spy="scroll" data-target="#nav">
<a href="https://github.com/mail-in-a-box/mailinabox.email/blob/master/maintenance.html" class="visible-md visible-lg"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>
<div id="back">
<div class="container">
<a href="/">
&lt; Back to Mail-in-a-Box
</a>
</div>
</div>
<div class="container">
<div class="row">
<div id="sidebar" class="col-sm-4 col-md-3">
<div id="nav" class="small">
<p style="margin: 0 0 .5em 14px; border-bottom: 1px solid #CCC; color: #888;">Table of Contents</p>
<ul class="nav nav-list">
<li><a href="#something-went-wrong">Something Went Wrong</a></li>
<li><a href="#multiple-domains">Multiple Domains</a></li>
<li><a href="#updating-software">Updating System Software</a></li>
<li><a href="#upgrade">Upgrading Mail-in-a-Box</a></li>
<li><a href="#moving-boxes">Moving to a New Box</a></li>
</ul>
</div>
</div>
<div class="col-sm-8 col-md-9">
<div style="padding-left: 1em; max-width: 55em">
<h1>Mail-in-a-Box Maintenance Guide</h1>
<p>This page covers frequently asked questions about how to configure a running Mail-in-a-Box and how to keep it up to date. For help setting up a new box, see the <a href="guide.html">setup guide</a>.</p>
<h2 id="something-went-wrong">Something Went Wrong!</h2>
<p>Is something not working right? Start here. Please follow these steps before asking a question on the discussion forum:</p>
<ol>
<li>Check your System Status Checks page in the control panel at <code>https://box.yourdomain.com/admin</code>. Everything should be green. Anything not green may help you diagnose the problem on your own.</li>
<li>Re-run the setup by logging into your box (using the same <code>ssh</code> command that you used <a href="guide.html#setup">during setup</a>) and running <code>sudo mailinabox</code>. Then check the System Status Checks page again.</li>
<li>Restart your box by logging in with SSH and then typing <code>sudo reboot</code>. Once the box has started up, check the System Status Checks page again.</li>
</ol>
<p>Please do these steps first. If you&rsquo;ve done these steps, then head to the <a href="https://discourse.mailinabox.email">discussion forum</a> to ask your question. In your post:</p>
<ol>
<li>Describe the problem you are having. Instead of saying &ldquo;it doesn&rsquo;t work&rdquo;, write the error message you see, post a screenshot, or describe what you are seeing that you don&rsquo;t want to be seeing.</li>
<li>Mention that you &ldquo;checked the status page, re-ran setup, and rebooted the box&rdquo;, per the steps above, so that anyone answering knows what you have tried so far. If you don&rsquo;t mention this, someone may ask you to do it before providing other assistance.</li>
<li>If everything in the System Status Checks is green, mention that by saying &ldquo;all checks are green&rdquo;. If something isn&rsquo;t green, mention it.</li>
</ol>
<p>If you figure out the problem on your own, you are also welcome to write up your experience on the <a href="https://discourse.mailinabox.email">discussion forum</a> so that it might help others.</p>
<h2 id="multiple-domains">Multiple Domain Names</h2>
<p>Your box can host email and serve static websites for more than one domain name. To set up additional domain names, just follow three steps:</p>
<ol>
<li>Buy an additional domain name if you don&rsquo;t yet own it. See the <a href="guide.html#domain-name-registration">Your Domain Name</a> section of the setup guide for tips.</li>
<li>Configure its nameservers to be the same nameservers on your first domain name. Follow the <a href="guide.html#domain-name-nameservers">Domain Name Configuration — Nameservers</a> section of the setup guide for instructions.</li>
<li>Add an email account (user) or alias on your box for the new domain name using the control panel. If you only plan to serve a website, still add an email address or alias &mdash; that&rsquo;s how the box knows to handle that domain name.</li>
</ol>
<h2 id="updating-software">Updating System Software</h2>
<p>Mail-in-a-Box is based on a collection of other software packages provided by <a href="http://www.ubuntu.com/">Ubuntu</a>. We call these packages system software packages. These packages may have security or other functionality updates.</p>
<p>You should periodically update the system software on your box. The box will automatically install security updates as they are made available by Ubuntu, but your control panel will let you know if a reboot is needed or if non-security updates are available for you to install.</p>
<p>When indicated to do so, log into your machine with SSH (using the same <code>ssh</code> command that you used <a href="guide.html#setup">during setup</a>) and then type:</p>
<pre>sudo apt-get update &amp;&amp; sudo apt-get upgrade</pre>
<p>If prompted to reboot, type:</p>
<pre>sudo reboot</pre>
<p>We will post security advisories to our twitter account <a href="https://twitter.com/mailinabox">@mailinabox</a>, the <a href="https://discourse.mailinabox.email/c/announcements">announcements section of the discussion forum</a>, and our Slack chat (see the homepage).</p>
<h2 id="upgrade">Upgrading Mail-in-a-Box</h2>
<p>You should move to the latest Mail-in-a-Box release as releases are posted, especially if an update addresses any security issues, although you do not necessarily need to do so. We will post release announcements to our twitter account <a href="https://twitter.com/mailinabox">@mailinabox</a>, the <a href="https://discourse.mailinabox.email/c/announcements">announcements section of the discussion forum</a>, and our Slack chat (see the homepage).</p>
<p>Check the <a href="https://github.com/mail-in-a-box/mailinabox/blob/master/CHANGELOG.md">release notes</a> prior to updating to see what&rsquo;s been changed in the latest version.</p>
<p>To upgrade Mail-in-a-Box to the latest release, first log into your machine using <code>SSH</code> in exactly the same manner as when you were setting up the box (see the setup guide section called <a href="guide.html#setup">Setting Up The Box</a> for a reminder of what that looked like).</p>
<p>Then, once logged in, run:</p>
<pre>curl -s https://mailinabox.email/setup.sh | sudo bash</pre>
<p>This is actually the same command you ran when setting up the box. It does upgrades too.</p>
<h2 id="moving-boxes">Moving to a New Box / Testing Backups</h2>
<p>If you want to move your Mail-in-a-Box installation to a new machine (e.g. you&rsquo;re getting more memory, getting a new IP address, etc.), or if something is horribly wrong with your box, you can easily move all of your data to a new machine.</p>
<div class="alert alert-success" role="alert">
<p>Even if your box is working fine, it&rsquo;s a good idea to test out this procedure from time to time so that you can verify that your backups are working and that you haven&rsquo;t lost the backup secret key.</p>
</div>
<h3>Create a new box</h3>
<p>Start by creating a new Mail-in-a-Box machine: Spin up a new machine following the setup guide&rsquo;s sections <a href="guide.html#machine">The Machine</a> and <a href="guide.html#setup">Setting Up The Box</a>. At this point you will have a mostly working, but empty, Mail-in-a-Box on your new machine.</p>
<h3>Restore your mail data (and other files)</h3>
<p>Next you&rsquo;ll restore your mail data and other files to the new machine. The safest way to do this is to restore the files from a backup.</p>
<h3>Forcing one last backup on the old machine</h3>
<p>If your old Mail-in-a-Box is still running, you can force a backup now to ensure you have everything backed up since the last nightly backup run. Log into your old machine using SSH and run:</p>
<pre>cd mailinabox
sudo management/backup.py</pre>
<h3>Locating your backup secret key</h3>
<p>Your backups are encrypted, and you will need your backup secret key to restore from the backup.</p>
<p>You should have already stored the backup secret key in a safe place &mdash; like in your home &mdash; per the backup instructions in the control panel. If you haven&rsquo;t done that yet... and if your old box is still running... now is the time! The file is located on your old box at <code>/home/user-data/backup/secret_key.txt</code>. Copy that file to a safe place now.</p>
<p>Copy that file onto your new box. Any SFTP program like <a href="https://filezilla-project.org/">FileZilla</a> can help you with that. (SFTP is like SSH, so you will use the same login credentials as you use with SSH.)</p>
<h3>Restoring backup files</h3>
<h4>Local backups</h4>
<p>If you are using the default backup method, which stores backups on the box itself, then hopefully you have figured out how to periodically copy those files somewhere else safe &mdash; otherwise what&rsquo;s the point!</p>
<p>Using any SFTP program like <a href="https://filezilla-project.org/">FileZilla</a> (or <code>scp</code> if you know how) copy your backups from wherever you stored them to somewhere on your new machine. If your old box is still running, then just copy them from <code>/home/user-data/backup/encrypted</code> on your old box.</p>
<p>Then restore the files:</p>
<pre>export PASSPHRASE=$(cat your_backup_secret_key_file.txt)
sudo -E duplicity restore file:///path/to/copied/files /home/user-data/</pre>
<h4>Amazon S3 backups</h4>
<p>If your backups are stored in Amazon S3, get your account credentials handy and then run a duplicity restore:</p>
<pre>export AWS_ACCESS_KEY_ID=paste your AWS access key ID here
export AWS_SECRET_ACCESS_KEY=paste your AWS secret access key here
export PASSPHRASE=$(cat your_backup_secret_key_file.txt)
sudo -E duplicity restore s3://s3.amazonaws.com/your-bucket-name/your-backup-path /home/user-data/</pre>
<p>You may have to adjust the S3 URL depending on what AWS region you use.</p>
<h3>Re-configure the box</h3>
<p>Re-run Mail-in-a-Box setup now that your old files are back:</p>
<pre>sudo mailinabox</pre>
<p>Your box should be functioning now. Log into the control panel on your new box to see if things look right.</p>
<h3>Update your DNS</h3>
<p>Finally, update your domain name&rsquo;s glue records to the new machine&rsquo;s IP address (see the setup guide&rsquo;s section on <a href="guide.html#machine">glue records</a>.</p>
<p>DNS can take a few hours to update, so wait a while, and then see if the control panel&rsquo;s status checks report any problems and that your devices are picking up mail on your new box.</p>
<p>(Skip this if you are just testing your backups.)</p>
<div class="hidden-xs" style="height: 200px"> </div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"> </script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script>
if ($(window).width() >= 768) {
// scroll spy with a fixed TOC doesn't work on small screens
$('#nav').attr('data-spy', 'affix');
$('body').scrollspy()
}
</script>
</body>
</html>