You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Your hardware is a Raspberry Pi (typically a 3B+ or 4B).
3
+
## About IOTstack { #conventions }
8
4
9
-
* The Raspberry Pi Zero W2 has been tested with IOTstack. It works but the 512MB RAM means you should not try to run too many containers concurrently.
10
-
* Users have also [reported success](https://github.com/SensorsIot/IOTstack/issues/375) on Orange Pi Win/Plus.
5
+
IOTstack is not a *system.* It is a set of *conventions* for assembling arbitrary collections of containers into something that has a reasonable chance of working out-of-the-box. The three most important conventions are:
11
6
12
-
2. Your Raspberry Pi has a reasonably-recent version of 32-bit or 64-bit Raspberry Pi OS (aka "Raspbian") installed. You can download operating-system images:
7
+
1. If a container needs information to persist across restarts (and most containers do) then the container's *persistent store* will be found at:
: This offers only "Raspberry Pi OS with desktop" images.
18
-
19
-
3. Your operating system has been updated:
20
-
21
-
``` console
22
-
$ sudo apt update
23
-
$ sudo apt upgrade -y
24
9
```
10
+
~/IOTstack/volumes/«container»
11
+
```
12
+
13
+
Most *service definitions* examples found on the web have a scattergun approach to this problem. IOTstack imposes order on this chaos.
14
+
15
+
2. To the maximum extent possible, network port conflicts have been sorted out in advance.
25
16
26
-
4. You are logged-in as the user "pi".
27
-
5. User "pi" has the user ID 1000.
28
-
6. The home directory for user "pi" is `/home/pi/`.
29
-
7. IOTstack is installed at `/home/pi/IOTstack` (with that exact spelling).
30
-
31
-
If the first three assumptions hold, assumptions four through six are Raspberry Pi defaults on a clean installation. The seventh is what you get if you follow these instructions faithfully.
32
-
33
-
Please don't read these assumptions as saying that IOTstack will not run on other hardware, other operating systems, or as a different user. It is just that IOTstack gets most of its testing under these conditions. The further you get from these implicit assumptions, the more your mileage may vary.
17
+
Sometimes this is not possible. For example, Pi-hole and AdGuardHome both offer Domain Name System services. The DNS relies on port 53. You can't have two containers claiming port 53 so the only way to avoid this is to pick *either* Pi-hole *or* AdGuardHome.
18
+
3. Where multiple containers are needed to implement a single user-facing service, the IOTstack service definition will include everything needed. A good example is NextCloud which relies on MariaDB. IOTstack implements MariaDB as a private instance which is only available to NextCloud. This strategy ensures that you are able to run your own separate MariaDB container without any risk of interference with your NextCloud service.
34
19
35
-
## New installation
20
+
## Requirements
36
21
37
-
### automatic (recommended)
22
+
IOTstack makes the following assumptions:
38
23
39
-
1.Install `curl`:
24
+
1.Your hardware is capable of running Debian or one of its derivatives. Examples that are known to work include:
40
25
41
-
``` console
42
-
$ sudo apt install -y curl
43
-
```
26
+
- a Raspberry Pi (typically a 3B+ or 4B)
44
27
45
-
2. Run the following command:
28
+
> The Raspberry Pi Zero W2 has been tested with IOTstack. It works but the 512MB RAM means you should not try to run too many containers concurrently.
- Orange Pi Win/Plus [see also issue 375](https://github.com/SensorsIot/IOTstack/issues/375)
31
+
- an Intel-based Mac running macOS plus Parallels with a Debian guest.
32
+
- an Intel-based platform running Proxmox with a Debian guest.
50
33
51
-
3. Run the menu and choose your containers:
34
+
2. Your host or guest system is running a reasonably-recent version of Debian or an operating system which is downstream of Debian in the Linux family tree, such as Raspberry Pi OS (aka "Raspbian") or Ubuntu.
52
35
53
-
``` console
54
-
$ cd ~/IOTstack
55
-
$ ./menu.sh
56
-
```
36
+
IOTstack is known to work in 32-bit mode but not all containers have images on DockerHub that support 320bit mode. If you are setting up a new system from scratch, you should choose a 64-bit option.
57
37
58
-
4. Bring up your stack:
38
+
IOTstack was known to work with Buster but it has not been tested recently. Bullseye is known to work but if you are setting up a new system from scratch, you should choose Bookworm.
39
+
40
+
Please don't waste your own time trying Linux distributions from outside the Debian family tree. They are unlikely to work.
59
41
60
-
``` console
61
-
$ cd ~/IOTstack
62
-
$ docker-compose up -d
63
-
```
42
+
3. You are logged-in as the default user (ie not root). In most cases, this is the user with ID=1000 and is what you get by default on either a Raspberry Pi OS or Debian installation.
64
43
65
-
### manual
44
+
This assumption is not really an IOTstack requirement as such. However, many containers assume UID=1000 exists and you are less likely to encounter issues if this assumption holds.
66
45
67
-
1. Install `git`:
46
+
Please don't read these assumptions as saying that IOTstack will not run on other hardware, other operating systems, or as a different user. It is just that IOTstack gets most of its testing under these conditions. The further you get from these implicit assumptions, the more your mileage may vary.
68
47
69
-
``` console
70
-
$ sudo apt install -y git
71
-
```
48
+
## New installation
72
49
73
-
2. Clone IOTstack:
50
+
You have two choices:
74
51
75
-
* If you want "new menu":
52
+
1. If you have an **existing** system and you want to add IOTstack to it, then the [add-on](#addonInstall) method is your best choice.
53
+
2. If you are setting up a **new** system from scratch, then [PiBuilder](#pibuilderInstall) is probably your best choice. You can, however, also use the [add-on](#addonInstall) method in a green-fields installation.
This method assumes an **existing** system rather than a green-fields installation. The script uses the principle of least interference. It only installs the bare minimum of prerequisites and, with the exception of adding some boot time options to your Raspberry Pi (but not any other kind of hardware), makes no attempt to tailor your system.
* If you are running "old menu" for the first time, you will be guided to "Install Docker". That will end in a reboot, after which you should re-enter the menu and choose your containers.
The `install.sh` script is *designed* to be run multiple times. If the script discovers a problem, it will explain how to fix that problem and, assuming you follow the instructions, you can safely re-run the script. You can repeat this process until the script completes normally.
74
+
75
+
### PiBuilder method { #pibuilderInstall }
106
76
107
-
If you prefer to automate your installations using scripts, see [PiBuilder](https://github.com/Paraphraser/PiBuilder). Beginning with your choice of Raspberry Pi OS starting point (eg Buster or Bullseye), PiBuilder:
77
+
Compared with the [add-on method](#addonInstall), PiBuilder is far more comprehensive. PiBuilder:
108
78
109
-
1. Satisfies all dependencies likely to be needed for IOTstack.
79
+
1. Does everything the [add-on method](#addonInstall) does.
80
+
2. Adds support packages and debugging tools that have proven useful in the IOTstack context.
110
81
3. Installs all required system patches (see next section).
111
-
3. Installs Docker and docker-compose.
112
-
4. Clones:
82
+
4. In addition to cloning IOTstack (this repository), PiBuilder also clones:
113
83
114
-
* IOTstack (this repository);
115
84
* [IOTstackBackup](https://github.com/Paraphraser/IOTstackBackup) which is an alternative to the backup script supplied with IOTstack but does not require your stack to be taken down to perform backups; and
116
85
* [IOTstackAliases](https://github.com/Paraphraser/IOTstackAliases) which provides shortcuts for common IOTstack operations.
117
86
118
-
After PiBuilder has finished, your system is ready to either:
87
+
5. Performs extra tailoring intended to deliver a rock-solid platform for IOTstack.
119
88
120
-
* Run the IOTstack menu to build your first stack; or
121
-
* Restore a backup and bring up your stack.
89
+
PiBuilder does, however, assume a **green fields** system rather than an existing installation. Although the PiBuilder scripts will *probably* work on an existing system, that scenario has never been tested so it's entirely at your own risk.
90
+
91
+
PiBuilder actually has two specific use-cases:
92
+
93
+
1. A first-time build of a system to run IOTstack; and
94
+
2. The ability to create your own customised version of PiBuilder so that you can quickly rebuild your Raspberry Pi or Proxmox guest after a disaster. Combined with IOTstackBackup, you can go from bare metal to a running system with data restored in about half an hour.
122
95
123
96
## Required system patches
124
97
125
-
Unless you know what you are doing, assume these are needed.
98
+
You can skip this section if you used [PiBuilder](https://github.com/Paraphraser/PiBuilder) to construct your system. That's because PiBuilder installs all necessary patches automatically.
99
+
100
+
If you used the [add-on method](#addonInstall), you should consider applying these patches by hand. Unless you know that a patch is **not** required, assume that it is needed.
126
101
127
102
### patch 1 – restrict DHCP
128
103
@@ -138,7 +113,7 @@ See [Issue 219](https://github.com/SensorsIot/IOTstack/issues/219) and [Issue 25
138
113
139
114
### patch 2 – update libseccomp2
140
115
141
-
This patch is **ONLY** for Raspbian Buster. Do **NOT** install this patch if you are running Raspbian Bullseye.
116
+
This patch is **ONLY** for Raspbian Buster. Do **NOT** install this patch if you are running Raspbian Bullseye or Bookworm.
The menu is used to install Docker and then build the `docker-compose.yml` file which is necessary for starting the stack.
186
-
187
-
> The menu is only an aid. It is a good idea to learn the `docker` and `docker-compose` commands if you plan on using Docker in the long run.
188
-
189
-
### menu item: Install Docker (old menu only)
190
-
191
-
Please do **not** try to install `docker` and `docker-compose` via `sudo apt install`. There's more to it than that. Docker needs to be installed by `menu.sh`. The menu will prompt you to install docker if it detects that docker is not already installed. You can manually install it from within the `Native Installs` menu:
192
-
193
-
```console
194
-
$ cd~/IOTstack
195
-
$ ./menu.sh
196
-
Select "Native Installs"
197
-
Select "Install Docker and Docker-Compose"
198
-
```
160
+
The menu is used to construct your `docker-compose.yml` file. That file is read by `docker-compose` which issues the instructions necessary for starting your stack.
199
161
200
-
Follow the prompts. The process finishes by asking you to reboot. Do that!
162
+
The menu is a great way to get started quickly but it is only an aid. It is a good idea to learn the various `docker` and `docker-compose` commands so you can use them outside the menu. It is also a good idea to study the `docker-compose.yml` generated by the menu to see how everything is put together. You will gain a lot of flexibility if you learn how to add containers by hand.
201
163
202
-
Note:
164
+
In essence, the menu is a concatenation tool which appends *service definitions* that exist inside the hidden `~/IOTstack/.templates` folder to your `docker-compose.yml`.
203
165
204
-
* New menu (master branch) automates this step.
166
+
Once you understand what the menu does (and, more importantly, what it doesn't do), you will realise that the real power of IOTstack lies not in its menu system but resides in its [conventions](#conventions).
205
167
206
-
### menu item: Build Stack
168
+
### menu item: Build Stack { #buildStack}
207
169
208
-
`docker-compose` uses a `docker-compose.yml` file to configure all your services. The `docker-compose.yml` file is created by the menu:
170
+
To create your first `docker-compose.yml`:
209
171
210
172
```console
211
173
$ cd~/IOTstack
@@ -233,7 +195,7 @@ The first time you run `up` the stack docker will download all the images from D
233
195
234
196
Some containers also need to be built locally. Node-RED is an example. Depending on the Node-RED nodes you select, building the image can also take a very long time. This is especially true if you select the SQLite node.
235
197
236
-
Be patient (and ignore the huge number of warnings).
198
+
Be patient (and, if you selected the SQLite node, ignore the huge number of warnings).
237
199
238
200
### menu item: Docker commands
239
201
@@ -243,83 +205,6 @@ The commands in this menu execute shell scripts in the root of the project.
243
205
244
206
The old and new menus differ in the options they offer. You should come back and explore them once your stack is built and running.
245
207
246
-
## switching menus
247
-
248
-
At the time of writing, IOTstack supports three menus:
249
-
250
-
* "Old Menu" on the `old-menu` branch. This was inherited from [gcgarner/IOTstack](https://github.com/gcgarner/IOTstack).
251
-
* "New Menu" on the `master` branch. This is the current menu.
252
-
* "New New Menu" on the `experimental` branch. This is under development.
253
-
254
-
With a few precautions, you can switch between git branches as much as you like without breaking anything. The basic check you should perform is:
255
-
256
-
```console
257
-
$ cd~/IOTstack
258
-
$ git status
259
-
```
260
-
261
-
Check the results to see if any files are marked as "modified". For example:
262
-
263
-
```output
264
-
modified: .templates/mosquitto/Dockerfile
265
-
```
266
-
267
-
Key point:
268
-
269
-
* Files marked "untracked" do not matter. You only need to check for "modified" files because those have the potential to stop you from switching branches cleanly.
270
-
271
-
The way to avoid potential problems is to move any modified files to one side and restore the unmodified original. For example:
When `git status` reports no more "modified" files, it is safe to switch your branch.
279
-
280
-
### current menu (master branch)
281
-
282
-
```console
283
-
$ cd~/IOTstack/
284
-
$ git pull
285
-
$ git checkout master
286
-
$ ./menu.sh
287
-
```
288
-
289
-
### old menu (old-menu branch)
290
-
291
-
```console
292
-
$ cd~/IOTstack/
293
-
$ git pull
294
-
$ git checkout old-menu
295
-
$ ./menu.sh
296
-
```
297
-
298
-
### experimental branch
299
-
300
-
Switch to the experimental branch to try the latest and greatest features.
301
-
302
-
```console
303
-
$ cd~/IOTstack/
304
-
$ git pull
305
-
$ git checkout experimental
306
-
$ ./menu.sh
307
-
```
308
-
309
-
Notes:
310
-
311
-
* Please make sure you have a good backup before you start.
312
-
* The experimental branch may be broken, or may break your setup.
313
-
* Please report any issues.
314
-
* Remember:
315
-
316
-
* you can switch git branches as much as you like without breaking anything.
317
-
* simply launching the menu (any version) won't change anything providing you exit before letting the menu complete.
318
-
* running the menu *to completion* **will** change your docker-compose.yml and supporting structures in `~/IOTstack/services`.
319
-
* running `docker-compose up -d` will change your running containers.
320
-
321
-
* The way back is to take down your stack, restore a backup, and bring up your stack again.
322
-
323
208
## useful commands: docker & docker-compose
324
209
325
210
Handy rules:
@@ -368,6 +253,21 @@ Logging limits were added to prevent Docker using up lots of RAM if log2ram is e
368
253
369
254
You can also turn logging off or set it to use another option for any service by using the IOTstack `docker-compose-override.yml` file mentioned at [IOTstack/Custom](Custom.md).
370
255
256
+
Another approach is to change `daemon.json` to be like this:
257
+
258
+
```json
259
+
{
260
+
"log-driver": "local",
261
+
"log-opts": {
262
+
"max-size": "1m"
263
+
}
264
+
}
265
+
```
266
+
267
+
The `local` driver is specifically designed to prevent disk exhaustion. Limiting log size to one megabyte also helps, particularly if you only have a limited amount of storage.
268
+
269
+
If you are familiar with system logging where it is best practice to retain logs spanning days or weeks, you may feel that one megabyte is unreasonably small. However, before you rush to increase the limit, consider that each container is the equivalent of a small computer dedicated to a single task. By their very nature, containers tend to either work as expected or fail outright. That, in turn, means that it is usually only recent container logs showing failures as they happen that are actually useful for diagnosing problems.
0 commit comments