diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2024-03-10 14:59:14 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2024-03-10 14:59:14 +0100 |
| commit | 1100562e29f6476448b656dbddd4cf22505523f6 (patch) | |
| tree | 442eec492199104bd49dfd74474ce89ade8fcac9 /content/posts/2021-01-24-replacing-dropbox-with-s3.md | |
| parent | a40d80be378e46a6c490e1b99b0d8f4acd968503 (diff) | |
| download | mitjafelicijan.com-1100562e29f6476448b656dbddd4cf22505523f6.tar.gz | |
Move back to JBMAFP
Diffstat (limited to 'content/posts/2021-01-24-replacing-dropbox-with-s3.md')
| -rw-r--r-- | content/posts/2021-01-24-replacing-dropbox-with-s3.md | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/content/posts/2021-01-24-replacing-dropbox-with-s3.md b/content/posts/2021-01-24-replacing-dropbox-with-s3.md new file mode 100644 index 0000000..61754df --- /dev/null +++ b/content/posts/2021-01-24-replacing-dropbox-with-s3.md | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | --- | ||
| 2 | title: Replacing Dropbox in favor of DigitalOcean spaces | ||
| 3 | url: /replacing-dropbox-in-favor-of-digitalocean-spaces.html | ||
| 4 | date: 2021-01-24T12:00:00+02:00 | ||
| 5 | type: post | ||
| 6 | draft: false | ||
| 7 | --- | ||
| 8 | |||
| 9 | A few months ago I experimented with DigitalOcean spaces as my backup solution | ||
| 10 | that could [replace Dropbox | ||
| 11 | eventually](/digitalocean-spaces-to-sync-between-computers.html). That solution | ||
| 12 | worked quite nicely, and I was amazed how smashing together a couple of existing | ||
| 13 | solutions would work this fine. | ||
| 14 | |||
| 15 | I have been running that solution in the background for a couple of months now | ||
| 16 | and kind of forgot about it. But recent developments around deplatforming and | ||
| 17 | having us people hostages of technology and big companies speed up my goals to | ||
| 18 | become less dependent on | ||
| 19 | [Google](https://edition.cnn.com/2020/12/17/tech/google-antitrust-lawsuit/index.html), | ||
| 20 | [Dropbox](https://www.pcworld.com/article/2048680/dropbox-takes-a-peek-at-files.html) | ||
| 21 | etc and take back some control. | ||
| 22 | |||
| 23 | I am not a conspiracy theory nut, but to be honest, what these companies are | ||
| 24 | doing lately is out of control. It is a matter of principle at this point. I | ||
| 25 | have almost completely degoogled my life all the way from ditching Gmail, | ||
| 26 | YouTube and most of the services surrounding Google. And I must tell you, I feel | ||
| 27 | so good. I haven't felt this way for a long time. | ||
| 28 | |||
| 29 | **Anyways. Let's get to the meat of things.** | ||
| 30 | |||
| 31 | Before you continue you should read my post about [syncing to | ||
| 32 | Dropbox](/digitalocean-spaces-to-sync-between-computers.html). | ||
| 33 | |||
| 34 | > Also to note, I am using Linux on my machine with Gnome desktop environment. | ||
| 35 | This should work on MacOS too. To use this on Windows I suggest using | ||
| 36 | [Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10) | ||
| 37 | or [Cygwin](https://www.cygwin.com/). | ||
| 38 | |||
| 39 | ## Folder structure | ||
| 40 | |||
| 41 | I liked structure from Dropbox. One folder where everything is located and | ||
| 42 | synced. So, that's why adopted this also for my sync setup. | ||
| 43 | |||
| 44 | ```go | ||
| 45 | ~/Vault | ||
| 46 | ↳ backup | ||
| 47 | ↳ bin | ||
| 48 | ↳ documents | ||
| 49 | ↳ projects | ||
| 50 | ``` | ||
| 51 | |||
| 52 | All of my code is located in `~/Vault/projects` folder. And most of the projects | ||
| 53 | are Git repositories. I do not use this sync method for backup per see but in | ||
| 54 | case I reinstall my machine I can easily recreate all the important folder | ||
| 55 | structure with one quick command. No external drives needed that can fail etc. | ||
| 56 | |||
| 57 | ## Sync script | ||
| 58 | |||
| 59 | My sync script is located in `~/Vault/bin/vault-backup.sh` | ||
| 60 | |||
| 61 | ```bash | ||
| 62 | #!/bin/bash | ||
| 63 | |||
| 64 | # dconf load /com/gexperts/Tilix/ < tilix.dconf | ||
| 65 | # 0 2 * * * sh ~/Vault/bin/vault-backup.sh | ||
| 66 | |||
| 67 | cd ~/Vault/backup/dotfiles | ||
| 68 | |||
| 69 | MACHINE=$(whoami)@$(hostname) | ||
| 70 | mkdir -p $MACHINE | ||
| 71 | cd $MACHINE | ||
| 72 | |||
| 73 | cp ~/.config/VSCodium/User/settings.json settings.json | ||
| 74 | cp ~/.s3cfg s3cfg | ||
| 75 | cp ~/.bash_extended bash_extended | ||
| 76 | cp ~/.ssh ssh -rf | ||
| 77 | |||
| 78 | codium --list-extensions > vscode-extension.txt | ||
| 79 | dconf dump /com/gexperts/Tilix/ > tilix.dconf | ||
| 80 | |||
| 81 | cd ~/Vault | ||
| 82 | s3cmd sync --delete-removed --exclude 'node_modules/*' --exclude '.git/*' --exclude '.venv/*' ./ s3://bucket-name/backup/ | ||
| 83 | |||
| 84 | echo `date +"%D %T"` >> ~/.vault.log | ||
| 85 | |||
| 86 | notify-send \ | ||
| 87 | -u normal \ | ||
| 88 | -i /usr/share/icons/Adwaita/96x96/status/security-medium-symbolic.symbolic.png \ | ||
| 89 | "Vault sync succeded at `date +"%D %T"`" | ||
| 90 | ``` | ||
| 91 | |||
| 92 | This script also backups some of the dotfiles I use and sends notification to | ||
| 93 | Gnome notification center. It is a straightforward solution. Nothing special | ||
| 94 | going on. | ||
| 95 | |||
| 96 | > One obvious benefit of this is that I can omit syncing Node's `node_modules` | ||
| 97 | > or Python's `.venv` and `.git` folders. | ||
| 98 | |||
| 99 | You can use this script in a combination with [Cron](https://en.wikipedia.org/wiki/Cron). | ||
| 100 | |||
| 101 | ```txt | ||
| 102 | 0 2 * * * sh ~/Vault/bin/vault-backup.sh | ||
| 103 | ``` | ||
| 104 | |||
| 105 | When you start syncing your local stuff with a remote server you can review your | ||
| 106 | items on DigitalOcean. | ||
| 107 | |||
| 108 |  | ||
| 109 | |||
| 110 | I have been using this script now for quite some time, and it's working | ||
| 111 | flawlessly. I also uninstalled Dropbox and stopped using it completely. | ||
| 112 | |||
| 113 | All I need to do is write a Bash script that does the reverse and downloads from | ||
| 114 | remote server to local folder. This could be another post. | ||
