Skip to content

Commit 0de84e4

Browse files
committed
docs/Updates: add overview, recommended procedures
1 parent 9cc8533 commit 0de84e4

File tree

2 files changed

+101
-5
lines changed

2 files changed

+101
-5
lines changed

docs/Updates/index.md

Lines changed: 96 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,104 @@
11
# Updating the project
22

3+
There are two different sources: the IOTstack project (github.com) and
4+
the Docker Hub (hub.docker.com). Both the initial stack creation and updates
5+
come from these. To illustrate the steps and artifacts of the *update* process:
6+
7+
``` mermaid
8+
flowchart TD
9+
GIT[github.com/sensorsiot/IOTstack.git]
10+
GIT --- GITPULL([$ git pull -r])
11+
GITPULL --> TEMPLATES["~/IOTstack/.templates"]
12+
TEMPLATES --- MENU([$ ./menu.sh -> Build stack])
13+
MENU --> COMPOSE["~/IOTstack/docker-compose.yml\n~/IOTstack/services/*/Dockerfile"]
14+
COMPOSE --- UP(["$ docker-compose up --build -d"])
15+
16+
HUB[hub.docker.com images and tags]
17+
HUB --- PULL([$ docker-compose pull\n$ docker-compose build --pull --no-cache])
18+
COMPOSE --- PULL
19+
PULL --> CACHE[local Docker image cache]
20+
CACHE --- UP
21+
22+
UP --> CONTAINER[updated Docker containers]
23+
24+
classDef command fill:#9996,stroke-width:0px
25+
class GITPULL,MENU,UP,PULL command
26+
```
27+
28+
In order to keep the graph from getting too complex, some minor details were
29+
left out:
30+
31+
- `$ docker-compose pull` will read `docker-compose.yml`, in order to
32+
know what image tags to check for updates.
33+
- `docker-compose build --pull --no-cache` will use
34+
`~/IOTstack/.templates/*/Dockerfile` and pull referenced Docker images, if
35+
there are selected services using these Dockerfiles.
36+
37+
## Backup and rollback
38+
39+
The usual way of backing up your `~/IOTstack` contents isn't sufficient to do a
40+
100% restore, as the local Docker image cache can't easily be restored back its
41+
initial state. To make matters worse, it's not unheard of that new images from
42+
hub.docker.com may [break
43+
something](https://github.com/node-red/node-red/issues/3461#issuecomment-1076348639).
44+
On the other hand, this may be a risk you're willing to take.
45+
46+
To ensure a successful rollback, you have to shutdown your RPi and backup a
47+
complete image of its storage device using another machine. This will also
48+
ensure all databases are saved in a valid state.
49+
50+
## Recommended: Update only Docker images
51+
52+
When you built the stack using the menu, it created the Docker Compose file
53+
`docker-compose.yml`. This file uses tag references (e.g. `:latest`) to get the
54+
image for that tag from hub.docker.com. Thus when Docker is told to pull
55+
images, it will download and update it's local cache to the newest image. No
56+
need to do any updates to `docker-compose.yml`.
57+
58+
Updating the IOTstack project templates and recreating your
59+
`docker-compose.yml` isn't usually necessary. Doing so isn't likely to provide
60+
much benefits, and may actually break something. A full update is only
61+
recommended when there is a new feature or change you need.
62+
63+
!!! note "Recommended update procedure"
64+
65+
1. Shutdown your RPi, remove its storage medium and backup a full image
66+
of the storage to another machine. Reinstall your storage and power up
67+
your RPi. To skip this step may cause a long downtime as you debug the
68+
problem.
69+
2. Get latest images from the web:
70+
```bash
71+
docker-compose pull
72+
```
73+
3. Rebuild localy created images based on new parent images:
74+
```bash
75+
docker-compose build --pull --no-cache
76+
```
77+
Note: this may not do anything, depending on your selected services.
78+
4. Update(recreate) containers to use new images:
79+
```bash
80+
docker-compose up --build -d
81+
```
82+
83+
If a service fails to start after it's updated, especially if you are updating
84+
frequently, wait for a few hours and repeat the update procedure. Sometimes
85+
there are bad releases published to hub.docker.com, but they are usually fixed
86+
in under half a day. Of course you are always welcome to report the problem to
87+
our [Discord](https://discord.gg/ZpKHnks) server. Usually someone else has
88+
encountered the same problem and reported the fix.
89+
90+
## Full update
91+
392
Periodically updates are made to project which include new or modified container template, changes to backups or additional features. As these are released your local copy of this project will become out of date. This section deals with how to bring your project to the latest published state.
493

594
## Quick instructions
695

7-
1. backup your current settings: `cp docker-compose.yml docker-compose.yml.bak`
8-
2. check `git status` for any local changes you may have made to project files. Save and preserve your changes by doing a commit: `git commit -a -m "local customization"`. Or revert them using: `git checkout -- path/to/changed_file`.
9-
3. update project files from github: `git pull origin master -r`
96+
1. shutdown your RPi, remove its storage medium and do a full image backup of
97+
it to another machine. Reinstall your storage and power up your RPi.
98+
2. backup your current settings: `cp docker-compose.yml docker-compose.yml.bak`
99+
3. check `git status` for any local changes you may have made to project files, ignore any reported "Untracked files". Save and preserve your changes by doing a commit: `git commit -a -m "local customization"`. Or revert them using: `git checkout -- path/to/changed_file`.
100+
4. update project files from github: `git pull origin master -r`
101+
5. recreate the compose file: `./menu.sh`, select Build Stack, don't change selections only press enter to build, and then exit.
10102
4. get latest images from the web: `docker-compose pull`
11103
5. rebuild localy created images from new Dockerfiles: `docker-compose build --pull --no-cache`
12104
6. update running containers to latest: `docker-compose up --build -d`
@@ -23,7 +115,7 @@ Periodically updates are made to project which include new or modified container
23115
2. `./menu.sh`, select Build Stack, select the service back again, press
24116
enter to build, and then exit.
25117
3. Try starting now: `docker-compose up -d`
26-
* Go to the [IOTStack Discord](https://discord.gg/ZpKHnks) and describe your
118+
* Go to the [IOTstack Discord](https://discord.gg/ZpKHnks) and describe your
27119
problem. We're happy to help.
28120

29121
## Details, partly outdated

mkdocs.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ extra_css:
5555

5656
markdown_extensions:
5757
- admonition
58-
- pymdownx.superfences
58+
- pymdownx.superfences:
59+
custom_fences:
60+
- name: mermaid
61+
class: mermaid
62+
format: !!python/name:pymdownx.superfences.fence_code_format
5963
- toc:
6064
permalink: true

0 commit comments

Comments
 (0)