Skip to content

Commit 4f8a47d

Browse files
author
Slyke
committed
Merge branch 'armhf_keys_menu_lines' into pr/126
2 parents a39d01c + 5d0c85a commit 4f8a47d

Some content is hidden

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

41 files changed

+1377
-202
lines changed

.github/workflows/main.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Publish docs via GitHub Pages
2+
on:
3+
push:
4+
branches:
5+
- master
6+
7+
jobs:
8+
build:
9+
name: Deploy docs
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout master
13+
uses: actions/checkout@v1
14+
15+
- name: Deploy docs
16+
uses: mhausenblas/mkdocs-deploy-gh-pages@master
17+
env:
18+
PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}

README.md

Lines changed: 2 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -1,198 +1,3 @@
1-
# IOTStack
1+
Documentation for the project: https://sensorsiot.github.io/IOTstack/
22

3-
IOTstack is a builder for docker-compose to easily make and maintain IoT stacks on the Raspberry Pi
4-
5-
## Announcements
6-
7-
The bulk of the README has moved to the Wiki. Please check it out [here](https://github.com/gcgarner/IOTstack/wiki)
8-
9-
* 2019-12-19 Added python container, tweaked update script
10-
* 2019-12-12 modified zigbee2mqtt template file
11-
* 2019-12-12 Added Function to add custom containers to the stack
12-
* 2019-12-12 PR cmskedgell: Added Homebridge
13-
* 2019-12-12 PR 877dev: Added trimming of online backups
14-
* 2019-12-03 BUGFIX Mosquitto: Fixed issue where mosquitto failed to start as a result of 11-28 change
15-
* 2019-12-03 Added terminal for postgres, temporarily removed setfacl from menu
16-
* 2019-11-28 PR @stfnhmplr added diyHue
17-
* 2019-11-28 Fixed update notification on menu
18-
* 2019-11-28 Fixed mosquitto logs and database not mapping correctly to volumes. Pull new template to fix
19-
* 2019-11-28 added the option to disable swapfile by setting swappiness to 0
20-
* 2019-11-28 PR @stfnhmplr fixed incorrect shegang on MariaDB terminal.sh
21-
* 2019-11-28 Added native install for RPIEasy
22-
* 2019-11-27 Additions: NextCloud, MariaDB, MotionEye, Mozilla Webthings, blynk-server (fixed issue with selection.txt)
23-
* 2019-11-22 BUGFIX selection.txt failed on fresh install, added pushd IOTstack to menu to ensure correct path
24-
* 2019-11-22 Added notification into menu if project update is available
25-
* 2019-11-20 BUGFIX influxdb backup: Placing docker_backup in crontab caused influxdb backup not to execute correctly
26-
* 2019-11-20 BUGFIX disable swap: swapfile recreation on reboot fixed. Re-run from menu to fix.
27-
* Node-RED: serial port. New template adds privileged which allows acces to serial devices
28-
* EspurinoHub: is available for testing see wiki entry
29-
30-
***
31-
32-
## Highlighted topics
33-
34-
* [Bluetooth and Node-RED](https://github.com/gcgarner/IOTstack/wiki/Node-RED#using-bluetooth)
35-
* [Saving files to disk inside containers](https://github.com/gcgarner/IOTstack/wiki/Node-RED#sharing-files-between-node-red-and-the-host)
36-
* [Updating the Project](https://github.com/gcgarner/IOTstack/wiki/Updating-the-Project)
37-
38-
***
39-
40-
## Coming soon
41-
42-
* reverse proxy is now next on the list, I cant keep up with the ports
43-
* Detection of arhcitecture for seperate stack options for amd64, armhf, i386
44-
* autocleanup of backups on cloud
45-
* Gitea (in testing branch)
46-
* OwnCloud
47-
48-
***
49-
50-
## About
51-
52-
Docker stack for getting started on IoT on the Raspberry Pi.
53-
54-
This Docker stack consists of:
55-
56-
* Node-RED
57-
* Grafana
58-
* InfluxDB
59-
* Postgres
60-
* Mosquitto mqtt
61-
* Portainer
62-
* Adminer
63-
* openHAB
64-
* Home Assistant (HASSIO)
65-
* zigbee2mqtt
66-
* Pi-Hole
67-
* TasmoAdmin (parial wiki)
68-
* Plex media server
69-
* Telegraf (wiki coming soon)
70-
* RTL_433
71-
* EspruinoHub (testing)
72-
* MotionEye
73-
* MariaDB
74-
* Plex
75-
* Homebridge
76-
77-
In addition, there is a write-up and some scripts to get a dynamic DNS via duckdns and VPN up and running.
78-
79-
Firstly what is docker? The correct question is "what are containers?". Docker is just one of the utilities to run a container.
80-
81-
A Container can be thought of as ultra-minimal virtual machines, they are a collection of binaries that run in a sandbox environment. You download a preconfigured base image and create a new container. Only the differences between the base and your "VM" are stored.
82-
Containers don't have [GUI](https://en.wikipedia.org/wiki/Graphical_user_interface)s so generally the way you interact with them is via web services or you can launch into a terminal.
83-
One of the major advantages is that the image comes mostly preconfigured.
84-
85-
There are pro's and cons for using native installs vs containers. For me, one of the best parts of containers is that it doesn't "clutter" your device. If you don't need Postgres anymore then just stop and delete the container. It will be like the container was never there.
86-
87-
The container will fail if you try to run the docker and native vesions as the same time. It is best to install this on a fresh system.
88-
89-
For those looking for a script that installs native applications check out [Peter Scargill's script](https://tech.scargill.net/the-script/)
90-
91-
## Tested platform
92-
93-
Raspberry Pi 3B and 4B Raspbian (Buster)
94-
95-
### Older Pi's
96-
97-
Docker will not run on a PiZero or A model 1 because of the CPU. It has not been tested on a Model 2. You can still use Peter Scargill's [script](https://tech.scargill.net/the-script/)
98-
99-
## Running under a virtual machine
100-
101-
For those wanting to test out the script in a Virtual Machine before installing on their Pi there are some limitations. The script is designed to work with Debian based distributions. Not all the container have x86_64 images. For example Portainer does not and will give an error when you try and start the stack. Please see the pinned issue [#29](https://github.com/gcgarner/IOTstack/issues/29), there is more info there.
102-
103-
## Feature Requests
104-
105-
Please direct all feature requests to [Discord](https://discord.gg/W45tD83)
106-
107-
## Youtube reference
108-
109-
This repo was originally inspired by Andreas Spiess's video on using some of these tools. Some containers have been added to extend its functionality.
110-
111-
[YouTube video](https://www.youtube.com/watch?v=JdV4x925au0): This is an alternative approach to the setup. Be sure to watch the video for the instructions. Just note that the network addresses are different, see the wiki under Docker Networks.
112-
113-
### YouTube guide
114-
115-
@peyanski (Kiril) made a YouTube video on getting started using the project, check it out [here](https://youtu.be/5JMNHuHv134)
116-
117-
## Download the project
118-
119-
1.On the lite image you will need to install git first
120-
121-
```bash
122-
sudo apt-get install git
123-
```
124-
125-
2.Download the repository with:
126-
127-
```bash
128-
git clone https://github.com/gcgarner/IOTstack.git ~/IOTstack
129-
```
130-
131-
Due to some script restraints, this project needs to be stored in ~/IOTstack
132-
133-
3.To enter the directory run:
134-
135-
```bash
136-
cd ~/IOTstack
137-
```
138-
139-
## The Menu
140-
141-
I've added a menu to make things easier. It is good to familiarise yourself with the installation process.
142-
The menu can be used to install docker and build the docker-compose.yml file necessary for starting the stack. It also runs a few common commands. I do recommend you start to learn the docker and docker-compose commands if you plan on using docker in the long run. I've added several helper scripts, have a look inside.
143-
144-
Navigate to the project folder and run `./menu.sh`
145-
146-
### Installing from the menu
147-
148-
Select the first option and follow the prompts
149-
150-
### Build the docker-compose file
151-
152-
docker-compose uses the `docker-compose.yml` file to configure all the services. Run through the menu to select the options you want to install.
153-
154-
### Docker commands
155-
156-
This menu executes shell scripts in the root of the project. It is not necessary to run them from the menu. Open up the shell script files to see what is inside and what they do.
157-
158-
### Miscellaneous commands
159-
160-
Some helpful commands have been added like disabling swap.
161-
162-
## Running Docker commands
163-
164-
From this point on make sure you are executing the commands from inside the project folder. Docker-compose commands need to be run from the folder where the docker-compose.yml is located. If you want to move the folder make sure you move the whole project folder.
165-
166-
## Starting and Stopping containers
167-
168-
to start the stack navigate to the project folder containing the docker-compose.yml file
169-
170-
To start the stack run:
171-
`docker-compose up -d` or `./scripts/start.sh`
172-
173-
To stop:
174-
`docker-compose stop`
175-
176-
The first time you run 'start' the stack docker will download all the images for the web. Depending on how many containers you selected and your internet speed this can take a long while.
177-
178-
The `docker-compose down` command stops the containers then deletes them.
179-
180-
## Persistent data
181-
182-
Docker allows you to map folders inside your containers to folders on the disk. This is done with the "volume" key. There are two types of volumes. Modification to the container are reflected in the volume.
183-
184-
## See Wiki for further info
185-
186-
[Wiki](https://github.com/gcgarner/IOTstack/wiki)
187-
188-
## Add to the project
189-
190-
Feel free to add your comments on features or images that you think should be added.
191-
192-
## Contributions
193-
194-
If you use some of the tools in the project please consider donating or contributing on their projects. It doesn't have to be monetary, reporting bugs and PRs help improve the projects for everyone.
195-
196-
### Thanks
197-
198-
@mrmx, @oscrx, @brianimmel, @Slyke, @AugustasV, @Paulf007, @affankingkhan, @877dev, @Paraphraser, @stfnhmplr, @peyanski, @cmskedgell
3+
Video: https://youtu.be/a6mjt8tWUws
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Accessing your device from the internet
2+
The challenge most of us face with remotely accessing your home network is that you don't have a static IP. From time to time the IP that your ISP assigns to you changes and it's difficult to keep up. Fortunately, there is a solution, a DynamicDNS. The section below shows you how to set up an easy to remember address that follows your public IP no matter when it changes.
3+
4+
Secondly, how do you get into your home network? Your router has a firewall that is designed to keep the rest of the internet out of your network to protect you. Here we install a VPN and configure the firewall to only allow very secure VPN traffic in.
5+
6+
## DuckDNS
7+
If you want to have a dynamic DNS point to your Public IP I added a helper script.
8+
Register with duckdns.org and create a subdomain name. Then edit the `nano ~/IOTstack/duck/duck.sh` file and add your
9+
10+
```bash
11+
DOMAINS="YOUR_DOMAINS"
12+
DUCKDNS_TOKEN="YOUR_DUCKDNS_TOKEN"
13+
```
14+
15+
first test the script to make sure it works `sudo ~/IOTstack/duck/duck.sh` then `cat /var/log/duck.log`. If you get KO then something has gone wrong and you should check out your settings in the script. If you get an OK then you can do the next step.
16+
17+
Create a cron job by running the following command `crontab -e`
18+
19+
You will be asked to use an editor option 1 for nano should be fine
20+
paste the following in the editor `*/5 * * * * sudo ~/IOTstack/duck/duck.sh >/dev/null 2>&1` then ctrl+s and ctrl+x to save
21+
22+
Your Public IP should be updated every five minutes
23+
24+
## PiVPN
25+
pimylifeup.com has an excellent tutorial on how to install [PiVPN](https://pimylifeup.com/raspberry-pi-vpn-server/)
26+
27+
In point 17 and 18 they mention using noip for their dynamic DNS. Here you can use the DuckDNS address if you created one.
28+
29+
Don't forget you need to open the port 1194 on your firewall. Most people won't be able to VPN from inside their network so download OpenVPN client for your mobile phone and try to connect over mobile data. ([More info.](https://en.wikipedia.org/wiki/Hairpinning))
30+
31+
Once you activate your VPN (from your phone/laptop/work computer) you will effectively be on your home network and you can access your devices as if you were on the wifi at home.
32+
33+
I personally use the VPN any time I'm on public wifi, all your traffic is secure.
34+
35+
## Zerotier
36+
https://www.zerotier.com/
37+
38+
Zerotier is an alternative to PiVPN that doesn't require port forwarding on your router. It does however require registering for their free tier service [here](https://my.zerotier.com/login).
39+
40+
Kevin Zhang has written a how to guide [here](https://iamkelv.in/blog/2017/06/zerotier.html). Just note that the install link is outdated and should be:
41+
```
42+
curl -s 'https://raw.githubusercontent.com/zerotier/ZeroTierOne/master/doc/contact%40zerotier.com.gpg' | gpg --import && \
43+
if z=$(curl -s 'https://install.zerotier.com/' | gpg); then echo "$z" | sudo bash; fi
44+
```

docs/Adminer.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Adminer
2+
## References
3+
- [Docker](https://hub.docker.com/_/adminer)
4+
- [Website](https://www.adminer.org/)
5+
6+
## About
7+
8+
This is a nice tool for managing databases. Web interface has moved to port 9080. There was an issue where openHAB and Adminer were using the same ports. If you have an port conflict edit the docker-compose.yml and under the adminer service change the line to read:
9+
```
10+
ports:
11+
- 9080:8080
12+
```

docs/Backups.md

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://github.com/gcgarner/IOTstack/wiki/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+
```
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+
```bash
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+
```bash
103+
systemctl --user enable gdrive.service
104+
```
105+
start with
106+
```bash
107+
systemctl --user start gdrive.service
108+
```
109+
if you no longer want it to start on boot then type:
110+
```bash
111+
systemctl --user disable gdrive.service
112+
```
113+

0 commit comments

Comments
 (0)