Skip to content

Commit af46004

Browse files
author
committed
Deployed 15308de with MkDocs version: 1.6.1
0 parents  commit af46004

File tree

193 files changed

+199517
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+199517
-0
lines changed

.nojekyll

Whitespace-only changes.

404.html

Lines changed: 2134 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
<!doctype html>
3+
<html lang="en">
4+
<head>
5+
<meta charset="utf-8">
6+
<title>Redirecting...</title>
7+
<link rel="canonical" href="../Basic_setup/Accessing-your-Device-from-the-internet/">
8+
<script>var anchor=window.location.hash.substr(1);location.href="../Basic_setup/Accessing-your-Device-from-the-internet/"+(anchor?"#"+anchor:"")</script>
9+
<meta http-equiv="refresh" content="0; url=../Basic_setup/Accessing-your-Device-from-the-internet/">
10+
</head>
11+
<body>
12+
You're being redirected to a <a href="../Basic_setup/Accessing-your-Device-from-the-internet/">new destination</a>.
13+
</body>
14+
</html>

Backup-and-Restore/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
<!doctype html>
3+
<html lang="en">
4+
<head>
5+
<meta charset="utf-8">
6+
<title>Redirecting...</title>
7+
<link rel="canonical" href="../Basic_setup/Backup-and-Restore/">
8+
<script>var anchor=window.location.hash.substr(1);location.href="../Basic_setup/Backup-and-Restore/"+(anchor?"#"+anchor:"")</script>
9+
<meta http-equiv="refresh" content="0; url=../Basic_setup/Backup-and-Restore/">
10+
</head>
11+
<body>
12+
You're being redirected to a <a href="../Basic_setup/Backup-and-Restore/">new destination</a>.
13+
</body>
14+
</html>

Backups.md.old

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Backups
2+
Because containers can easily be rebuilt from docker hub we only have to back up the data in the "volumes" directory.
3+
4+
## Cloud Backups
5+
### Dropbox-Uploader
6+
This a great utility to easily upload data from your Pi to the cloud. https://magpi.raspberrypi.org/articles/dropbox-raspberry-pi. It can be installed from the Menu under Backups.
7+
### rclone (Google Drive)
8+
This is a service to upload to Google Drive. The config is described [here]( https://medium.com/@artur.klauser/mounting-google-drive-on-raspberry-pi-f5002c7095c2). Install it from the menu then follow the link for these sections:
9+
* Getting a Google Drive Client ID
10+
* Setting up the Rclone Configuration
11+
12+
When naming the service in `rclone config` ensure to call it "gdrive"
13+
14+
**The Auto-mounting instructions for the drive in the link don't work on Rasbian**. Auto-mounting of the drive isn't necessary for the backup script.
15+
16+
If you want your Google Drive to mount on every boot then follow the instructions at the bottom of the wiki page
17+
18+
19+
## Influxdb
20+
`~/IOTstack/scripts/backup_influxdb.sh` does a database snapshot and stores it in ~/IOTstack/backups/influxdb/db . This can be restored with the help a script (that I still need to write)
21+
22+
## Docker backups
23+
The script `~/IOTstack/scripts/docker_backup.sh` performs the master backup for the stack.
24+
25+
This script can be placed in a cron job to backup on a schedule.
26+
Edit the crontab with`crontab -e`
27+
Then add `0 23 * * * ~/IOTstack/scripts/docker_backup.sh >/dev/null 2>&1` to have a backup every night at 23:00.
28+
29+
This script cheats by copying the volume folder live. The correct way would be to stop the stack first then copy the volumes and restart. The cheating method shouldn't be a problem unless you have fast changing data like in influxdb. This is why the script makes a database export of influxdb and ignores its volume.
30+
31+
### Cloud integration
32+
The docker_backup.sh script now no longer requires modification to enable cloud backups. It now tests for the presence of and enable file in the backups folder
33+
#### Drobox-Uploader
34+
The backup tests for a file called `~/IOTstack/backups/dropbox`, if it is present it will upload to dropbox. To disable dropbox upload delete the file. To enable run `sudo touch ~/IOTstack/backups/dropbox`
35+
#### rclone
36+
The backup tests for a file called `~/IOTstack/backups/rclone`, if it is present it will upload to google drive. To disable rclone upload delete the file. To enable run `sudo touch ~/IOTstack/backups/rclone`
37+
38+
#### Pruning online backups
39+
@877dev has added functionality to prune both local and cloud backups. For dropbox make sure you dont have any files that contain spaces in your backup directory as the script cannot handle it at this time.
40+
41+
### Restoring a backup
42+
The "volumes" directory contains all the persistent data necessary to recreate the container. The docker-compose.yml and the environment files are optional as they can be regenerated with the menu. Simply copy the volumes directory into the IOTstack directory, Rebuild the stack and start.
43+
44+
## Added your Dropbox token incorrectly or aborted the install at the token screen
45+
46+
Make sure you are running the latest version of the project [link](https://sensorsiot.github.io/IOTstack/Updating-the-Project/).
47+
48+
Run `~/Dropbox-Uploader/dropbox_uploader.sh unlink` and if you have added it key then it will prompt you to confirm its removal. If no key was found it will ask you for a new key.
49+
50+
Confirm by running `~/Dropbox-Uploader/dropbox_uploader.sh` it should ask you for your key if you removed it or show you the following prompt if it has the key:
51+
52+
``` console
53+
$ ~/Dropbox-Uploader/dropbox_uploader.sh
54+
Dropbox Uploader v1.0
55+
Andrea Fabrizi - [email protected]
56+
57+
Usage: /home/pi/Dropbox-Uploader/dropbox_uploader.sh [PARAMETERS] COMMAND...
58+
59+
Commands:
60+
upload <LOCAL_FILE/DIR ...> <REMOTE_FILE/DIR>
61+
download <REMOTE_FILE/DIR> [LOCAL_FILE/DIR]
62+
delete <REMOTE_FILE/DIR>
63+
move <REMOTE_FILE/DIR> <REMOTE_FILE/DIR>
64+
copy <REMOTE_FILE/DIR> <REMOTE_FILE/DIR>
65+
mkdir <REMOTE_DIR>
66+
....
67+
68+
```
69+
70+
Ensure you **are not** running as sudo as this will store your api in the /root directory as `/root/.dropbox_uploader`
71+
72+
If you ran the command with sudo the remove the old token file if it exists with either `sudo rm /root/.dropbox_uploader` or `sudo ~/Dropbox-Uploader/dropbox_uploader.sh unlink`
73+
74+
## Auto-mount Gdrive with rclone
75+
76+
To enable rclone to mount on boot you will need to make a user service. Run the following commands
77+
78+
``` console
79+
$ mkdir -p ~/.config/systemd/user
80+
$ nano ~/.config/systemd/user/gdrive.service
81+
```
82+
Copy the following code into the editor, save and exit
83+
84+
```
85+
[Unit]
86+
Description=rclone: Remote FUSE filesystem for cloud storage
87+
Documentation=man:rclone(1)
88+
89+
[Service]
90+
Type=notify
91+
ExecStartPre=/bin/mkdir -p %h/mnt/gdrive
92+
ExecStart= \
93+
/usr/bin/rclone mount \
94+
--fast-list \
95+
--vfs-cache-mode writes \
96+
gdrive: %h/mnt/gdrive
97+
98+
[Install]
99+
WantedBy=default.target
100+
```
101+
enable it to start on boot with: (no sudo)
102+
``` console
103+
$ systemctl --user enable gdrive.service
104+
```
105+
start with
106+
``` console
107+
$ systemctl --user start gdrive.service
108+
```
109+
if you no longer want it to start on boot then type:
110+
``` console
111+
$ systemctl --user disable gdrive.service
112+
```
113+

0 commit comments

Comments
 (0)