Skip to content

Commit 7442d85

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 567a476 + 5912d02 commit 7442d85

File tree

9 files changed

+193
-39
lines changed

9 files changed

+193
-39
lines changed

.bash_aliases

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
alias iotstack_up="docker-compose -f ~/IOTstack/docker-compose.yml up -d"
2+
alias iotstack_down="docker-compose -f ~/IOTstack/docker-compose.yml down"
3+
alias iotstack_start="docker-compose -f ~/IOTstack/docker-compose.yml start"
4+
alias iotstack_stop="docker-compose -f ~/IOTstack/docker-compose.yml stop"
5+
alias iotstack_update="docker-compose -f ~/IOTstack/docker-compose.yml pull"
6+
alias iotstack_build="docker-compose -f ~/IOTstack/docker-compose.yml build"
7+

.native/rtl_433.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
sudo touch /etc/modprobe.d/blacklist-rtl.conf
3+
[ $(grep -c rtl28xxu /etc/modprobe.d/blacklist-rtl.conf) -eq 0 ] && sudo echo "blacklist dvb_usb_rtl28xxu" >>/etc/modprobe.d/blacklist-rtl.conf
4+
5+
sudo touch /etc/modprobe.d/blacklist-rtl8xxxu.conf
6+
[ $(grep -c rtl8xxxu /etc/modprobe.d/blacklist-rtl8xxxu.conf) -eq 0 ] && sudo echo "blacklist rtl8xxxu" >>/etc/modprobe.d/blacklist-rtl8xxxu.conf
7+
8+
sudo apt-get update
9+
sudo apt-get install -y libtool \
10+
libusb-1.0.0-dev \
11+
librtlsdr-dev \
12+
rtl-sdr \
13+
doxygen \
14+
cmake \
15+
automake
16+
17+
git clone https://github.com/merbanan/rtl_433.git ~/rtl_433
18+
cd ~/rtl_433/
19+
mkdir build
20+
cd build
21+
cmake ../
22+
make
23+
sudo make install
24+
25+
echo "you should reboot for changes to take effect"

.templates/grafana/grafana.env

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1+
#TZ=Africa/Johannesburg
12
GF_PATHS_DATA=/var/lib/grafana
2-
GF_PATHS_LOGS=/var/log/grafana
3+
GF_PATHS_LOGS=/var/log/grafana
4+
# [SERVER]
5+
#GF_SERVER_ROOT_URL=http://localhost:3000/grafana
6+
#GF_SERVER_SERVE_FROM_SUB_PATH=true
7+
# [SECURITY]
8+
#GF_SECURITY_ADMIN_USER=admin
9+
#GF_SECURITY_ADMIN_PASSWORD=admin

.templates/pihole/pihole.env

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
#TZ=America/Chicago
22
WEBPASSWORD=pihole
3-
3+
#DNS1=8.8.8.8
4+
#DNS2=8.8.4.4
5+
#DNSSEC=false
6+
#DNS_BOGUS_PRIV=True
7+
#CONDITIONAL_FORWARDING=False
8+
#CONDITIONAL_FORWARDING_IP=your_router_ip_here (only if CONDITIONAL_FORWARDING=ture)
9+
#CONDITIONAL_FORWARDING_DOMAIN=optional
10+
#CONDITIONAL_FORWARDING_REVERSE=optional
11+
#ServerIP=your_Pi's_IP_here << recommended
12+
#ServerIPv6= your_Pi's_ipv6_here << Required if using ipv6
13+
#VIRTUAL_HOST=$ServerIP
14+
#IPv6=True
15+
INTERFACE=eth0
16+
#DNSMASQ_LISTENING=local

.templates/rtl_433/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM debian:buster-slim
2+
3+
ENV MQTT_ADDRESS mosquitto
4+
ENV MQTT_PORT 1883
5+
ENV MQTT_USER ""
6+
ENV MQTT_PASSWORD ""
7+
ENV MQTT_TOPIC RTL_433
8+
9+
RUN apt-get update && apt-get install -y git libtool libusb-1.0.0-dev librtlsdr-dev rtl-sdr cmake automake && \
10+
git clone https://github.com/merbanan/rtl_433.git /tmp/rtl_433 && \
11+
cd /tmp/rtl_433/ && \
12+
mkdir build && \
13+
cd build && \
14+
cmake ../ && \
15+
make && \
16+
make install
17+
18+
CMD ["sh", "-c", "rtl_433 -F mqtt://${MQTT_ADDRESS}:${MQTT_PORT},events=${MQTT_TOPIC},user=${MQTT_USER},pass=${MQTT_PASSWORD}"]

.templates/rtl_433/rtl_433.env

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
TZ=Africa/Johannesburg
2+
MQTT_ADDRESS=mosquitto
3+
MQTT_PORT=1883
4+
#MQTT_USER=""
5+
#MQTT_PASSWORD=""
6+
MQTT_TOPIC=RTL_433

.templates/rtl_433/service.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
rtl_433:
2+
container_name: rtl_433
3+
build: ./services/rtl_433/.
4+
env_file:
5+
- ./services/rtl_433/rtl_433.env
6+
devices:
7+
- /dev/bus/usb
8+
restart: unless-stopped

README.md

Lines changed: 61 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,61 @@
1-
# Announcements
1+
# Announcements
2+
23
The bulk of the README has moved to the Wiki. Please check it out [here](https://github.com/gcgarner/IOTstack/wiki)
4+
5+
* BUGFIX: I incorrecly changed mosquittos volume mapping and it caused the container to restart. Reverted to the old volume mapping
6+
* Added RTL_433 native and docker installs
7+
* Added update project through the menu
8+
* Added bash aliases for easier docker stop and start commands
39
* The project up procedure has been rewritten #73 (now git pull), please check your duck.sh file because the old method reset it
410
* BUGFIX: incorrect permissions in docker_backup: PR @Paraphraser
511
* BUGFIX: Timezone not correct on Node-RED and Pihole
612
* docker_backup.sh now stores last 5 backups with timestamps : PR @877dev
713
* Added Pi-Hole
814
* Added zigbee2mqtt (needs wiki) BUG:does not start due to missing device
915
* Added rclone for Google Drive Backups
10-
* Fixed Hass.io (now has a seperate menu installation)
16+
* Fixed Hass.io (now has a seperate menu installation)
1117
* Added Telegraf (needs wiki)
1218
* Plex added
13-
* Tasmoadmin (needs wiki)
19+
* Tasmoadmin (needs wiki)
1420
* Fixed Tasmoadmin not starting after reboot
1521

1622
***
23+
1724
## Highlighted topics
25+
1826
* [Bluetooth and Node-RED](https://github.com/gcgarner/IOTstack/wiki/Node-RED#using-bluetooth)
1927
* [Saving files to disk inside containers](https://github.com/gcgarner/IOTstack/wiki/Node-RED#sharing-files-between-node-red-and-the-host)
2028
* [Updating the Project](https://github.com/gcgarner/IOTstack/wiki/Updating-the-Project)
2129

2230
***
31+
2332
# Coming soon
24-
- [EspurinoHub](https://hub.docker.com/r/humbertosales/espruinohub-docker-rpi)
33+
34+
* [EspurinoHub](https://hub.docker.com/r/humbertosales/espruinohub-docker-rpi)
35+
2536
***
2637

2738
# IOTstack
39+
2840
Docker stack for getting started on IoT on the Raspberry Pi.
2941

3042
This Docker stack consists of:
31-
* Node-RED
32-
* Grafana
33-
* InfluxDB
34-
* Postgres
35-
* Mosquitto mqtt
36-
* Portainer
37-
* Adminer
38-
* openHAB
39-
* Home Assistant (HASSIO)
40-
* zigbee2mqtt
41-
* Pi-Hole
42-
* TasmoAdmin (parial wiki)
43-
* Plex media server
44-
* Telegraf (wiki coming soon)
43+
44+
* Node-RED
45+
* Grafana
46+
* InfluxDB
47+
* Postgres
48+
* Mosquitto mqtt
49+
* Portainer
50+
* Adminer
51+
* openHAB
52+
* Home Assistant (HASSIO)
53+
* zigbee2mqtt
54+
* Pi-Hole
55+
* TasmoAdmin (parial wiki)
56+
* Plex media server
57+
* Telegraf (wiki coming soon)
58+
* RTL_433
4559

4660
In addition, there is a write-up and some scripts to get a dynamic DNS via duckdns and VPN up and running.
4761

@@ -58,60 +72,78 @@ The container will fail if you try to run the docker and native vesions as the s
5872
For those looking for a script that installs native applications check out [Peter Scargill's script](https://tech.scargill.net/the-script/)
5973

6074
# Tested platform
75+
6176
Raspberry Pi 3B and 4B Raspbian (Buster)
6277

6378
## Older Pi's
79+
6480
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/)
6581

6682
## Running under a virtual machine
83+
6784
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.
6885

6986
# Feature Requests
87+
7088
Please direct all feature requests to [Discord](https://discord.gg/W45tD83)
7189

7290
# Youtube reference
91+
7392
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.
7493

7594
[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 note below
7695

7796
# Download the project
7897

79-
1. On the lite image you will need to install git first
80-
```
98+
1.On the lite image you will need to install git first
99+
100+
```bash
81101
sudo apt-get install git
82102
```
83-
2. Download the repository with:
84-
```
103+
104+
2.Download the repository with:
105+
106+
```bash
85107
git clone https://github.com/gcgarner/IOTstack.git ~/IOTstack
86108
```
109+
87110
Due to some script restraints, this project needs to be stored in ~/IOTstack
88111

89-
3. To enter the directory run:
90-
```
112+
3.To enter the directory run:
113+
114+
```bash
91115
cd ~/IOTstack
92116
```
117+
93118
# The Menu
119+
94120
I've added a menu to make things easier. It is good to familiarise yourself with the installation process.
95121
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.
96122

97123
Navigate to the project folder and run `./menu.sh`
98124

99125
## Installing from the menu
126+
100127
Select the first option and follow the prompts
101128

102129
## Build the docker-compose file
130+
103131
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.
104132

105133
## Docker commands
134+
106135
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.
107136

108137
## Miscellaneous commands
138+
109139
Some helpful commands have been added like disabling swap.
110140

111141
# Running Docker commands
142+
112143
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.
113144

114145
## Starting and Stopping containers
146+
115147
to start the stack navigate to the project folder containing the docker-compose.yml file
116148

117149
To start the stack run:
@@ -125,14 +157,17 @@ The first time you run 'start' the stack docker will download all the images for
125157
The 'docker-compose down' command stops the containers then deletes them. To stop the container but not delete it, run 'docker-compose stop'.
126158

127159
## Persistent data
160+
128161
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.
129162

130163
# See Wiki for further info
131-
[Wiki](https://github.com/gcgarner/IOTstack/wiki)
132164

165+
[Wiki](https://github.com/gcgarner/IOTstack/wiki)
133166

134167
# Add to the project
168+
135169
Feel free to add your comments on features or images that you think should be added.
136170

137171
# Contributions
138-
@mrmx, @oscrx, @brianimmel, @Slyke, @AugustasV, @Paulf007, @affankingkhan, @877dev, @Paraphraser
172+
173+
@mrmx, @oscrx, @brianimmel, @Slyke, @AugustasV, @Paulf007, @affankingkhan, @877dev, @Paraphraser

menu.sh

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ timezones() {
77
TZ=$(cat /etc/timezone)
88

99
#test for TZ=
10-
[ $(grep "TZ=" $env_file) ] && sed -i "/TZ=/c\TZ=$TZ" $env_file
10+
[ $(grep -c "TZ=" $env_file) -ne 0 ] && sed -i "/TZ=/c\TZ=$TZ" $env_file
1111

1212
}
1313

@@ -85,9 +85,11 @@ mainmenu_selection=$(whiptail --title "Main Menu" --menu --notags \
8585
"install" "Install Docker" \
8686
"build" "Build Stack" \
8787
"hassio" "Install Hass.io (Requires Docker)" \
88+
"native" "Native Installs" \
8889
"commands" "Docker commands" \
8990
"backup" "Backup options" \
9091
"misc" "Miscellaneous commands" \
92+
"update" "Update IOTstack" \
9193
3>&1 1>&2 2>&3)
9294

9395
case $mainmenu_selection in
@@ -131,6 +133,7 @@ case $mainmenu_selection in
131133
"pihole" "Pi-Hole" "OFF" \
132134
"plex" "Plex media server" "OFF" \
133135
"tasmoadmin" "TasmoAdmin" "OFF" \
136+
"rtl_433" "RTL_433 to mqtt" "OFF" \
134137
3>&1 1>&2 2>&3)
135138

136139
mapfile -t containers <<<"$container_selection"
@@ -157,16 +160,19 @@ case $mainmenu_selection in
157160
#MAINMENU Docker commands -----------------------------------------------------------
158161
"commands")
159162

160-
docker_selection=$(whiptail --title "Docker commands" --menu --notags \
161-
"Shortcut to common docker commands" 20 78 12 -- \
162-
"start" "Start stack" \
163-
"restart" "Restart stack" \
164-
"stop" "Stop stack" \
165-
"stop_all" "Stop any running container regardless of stack" \
166-
"pull" "Update all containers" \
167-
"prune_volumes" "Delete all stopped containers and docker volumes" \
168-
"prune_images" "Delete all images not associated with container" \
169-
3>&1 1>&2 2>&3)
163+
docker_selection=$(
164+
whiptail --title "Docker commands" --menu --notags \
165+
"Shortcut to common docker commands" 20 78 12 -- \
166+
"aliases" "Add iotstack_up and iotstack_down aliases" \
167+
"start" "Start stack" \
168+
"restart" "Restart stack" \
169+
"stop" "Stop stack" \
170+
"stop_all" "Stop any running container regardless of stack" \
171+
"pull" "Update all containers" \
172+
"prune_volumes" "Delete all stopped containers and docker volumes" \
173+
"prune_images" "Delete all images not associated with container" \
174+
3>&1 1>&2 2>&3
175+
)
170176

171177
case $docker_selection in
172178
"start") ./scripts/start.sh ;;
@@ -176,6 +182,16 @@ case $mainmenu_selection in
176182
"pull") ./scripts/update.sh ;;
177183
"prune_volumes") ./scripts/prune-volumes.sh ;;
178184
"prune_images") ./scripts/prune-images.sh ;;
185+
"aliases")
186+
touch ~/.bash_aliases
187+
if [ $(grep -c 'IOTstack' ~/.bash_aliases) -eq 0 ]; then
188+
echo ". ~/IOTstack/.bash_aliases" >>~/.bash_aliases
189+
echo "added aliases"
190+
else
191+
echo "aliases already added"
192+
fi
193+
source ~/.bashrc
194+
;;
179195
esac
180196
;;
181197
#Backup menu ---------------------------------------------------------------------
@@ -266,6 +282,25 @@ case $mainmenu_selection in
266282
exit
267283
fi
268284
;;
285+
"update")
286+
echo "Pulling latest project file from Github.com ---------------------------------------------"
287+
git pull origin master
288+
echo "git status ------------------------------------------------------------------------------"
289+
git status
290+
;;
291+
"native")
292+
293+
native_selections=$(whiptail --title "Native installs" --menu --notags \
294+
"Install local applications" 20 78 12 -- \
295+
"rtl_433" "RTL_433" \
296+
3>&1 1>&2 2>&3)
297+
298+
case $native_selections in
299+
"rtl_433")
300+
bash ./.native/rtl_433.sh
301+
;;
302+
esac
303+
;;
269304
*) ;;
270305

271306
esac

0 commit comments

Comments
 (0)