aboutsummaryrefslogtreecommitdiff
path: root/build/Website_Backups_with_Apple_iCloud/index.html
blob: b236264a736a0c5bbd1649022d7819753e8de7b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="icon" href="data:,">
	<title>Website Backups with Apple iCloud</title>
	<link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
	<link href="/rss.xml" type="application/rss+xml" rel="alternate" title="RSS feed for blog posts" />
<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style>
</head>

<nav>
	<a href="#menu">Menu &darr;</a>
</nav>

<main>
<h1 id="website-backups-with-apple-icloud">Website Backups with Apple iCloud</h1>

<p>2024-02-16</p>

<p>My main work machine, an M2 MacBook Air, meshes really well with my iPhone SE (they are in the same ecosystem after all - duh!). Since both of these devices are Apple products, it makes sense that I pay for the optional iCloud service for extra storage. 50GB to be exact. I only need to bare minimum which costs just $1.68 a month, making this storage option cheaper than most cups of coffee these days.</p>

<p>Recently I&#8217;ve been using iCloud as my &#8220;middle-man&#8221; backup system. I still have local, offline storage for most personal data but having additional off-site backups is never a bad thing. I make things easier for myself by taking advantage of <code>rsync</code>. You&#8217;ll need to make sure you have that program installed before trying this yourself:</p>

<pre><code># This assumes you have homebrew installed first
brew install rsync
</code></pre>

<p>Then, whenever I feel like backing up an existing project or website I simply run:</p>

<pre><code>rsync -a user_name@ssh.webserver.domain:&#47;home&#47;var&#47;www&#47; &#47;Users&#47;username&#47;Library&#47;Mobile\ Documents&#47;com\~apple\~CloudDocs&#47;Backups&#47;site-backup
</code></pre>

<blockquote>
<p>Note: The <code>-a</code> option tells <code>rsync</code> to sync directories recursively, transfer special and block devices, preserve symbolic links, modification times, groups, ownership, and permissions.</p>
</blockquote>

<p>The beautiful magic of <code>rsync</code>! Obviously, you&#8217;d want to properly name your directories (ie. <code>&#47;Backups&#47;site-backup</code>) for a cleaner structure and ensure that your iCloud directory is set correctly. (remember to read code before just copy-pasting!). With this approach you can backup entire server directories or be specific with each individual project folder. I would also recommend setting up some alias in your <code>.bashrc</code> or <code>.zshrc</code> etc. to make things more streamlined when running backups manually:</p>

<pre><code>alias site-backup="rsync -a user_name@ssh.webserver.domain:&#47;home&#47;var&#47;www&#47; &#47;Users&#47;username&#47;Library&#47;Mobile\ Documents&#47;com\~apple\~CloudDocs&#47;Backups&#47;site-backup"
# Then you simply run the following for a manual backup:
site-backup
</code></pre>

<p>You can take this further by automating things via cron jobs, but for my use case that is a little overkill. Hopefully this helps anyone looking for a quick and dirty backup system, especially one that can piggyback of your existing iCloud that you might be paying for already.</p>
<footer role="contentinfo">
    <h2>Menu Navigation</h2>
    <ul id="menu">
        <li><a href="/">Home</a></li>
        <li><a href="/projects">Projects</a></li>
        <li><a href="/uses">Uses</a></li>
        <li><a href="/wiki">Wiki</a></li>
        <li><a href="/resume">Resume</a></li>
        <li><a href="/colophon">Colophon</a></li>
        <li><a href="/now">Now</a></li>
        <li><a href="/donate">Donate</a></li>
        <li><a href="/atom.xml">RSS</a></li>
        <li><a href="#top">&uarr; Top of the page</a></li>
    </ul>
    <small>
        Built with <a href="https://git.sr.ht/~bt/barf">barf</a>. <br>
        Maintained with ♥ for the web. <br>
        Proud supporter of <a href="https://usefathom.com/ref/DKHJVX">Fathom</a> &amp; <a href="https://nextdns.io/?from=74d3p3h8">NextDNS</a>. <br>
        The content for this site is <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>.<br> The <a href="https://git.sr.ht/~bt/bt.ht">code for this site</a> is <a href="https://git.sr.ht/~bt/bt.ht/tree/master/item/LICENSE">MIT</a>.
    </small>
</footer>