Skip to content

Commit 7ce931e

Browse files
authored
Merge pull request #351 from Paraphraser/20210521-mosquitto-oldmenu
Self-healing Mosquitto (Dockerfile build) - PR 2 of 2 - old-menu branch
2 parents b71dd61 + ea8d7cc commit 7ce931e

File tree

7 files changed

+41
-29
lines changed

7 files changed

+41
-29
lines changed

.templates/mosquitto/Dockerfile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Download base image
2+
FROM eclipse-mosquitto:latest
3+
4+
# Add support tools
5+
RUN apk update && apk add --no-cache rsync tzdata
6+
7+
# where IOTstack template files are stored
8+
ENV IOTSTACK_DEFAULTS_DIR="iotstack_defaults"
9+
10+
# copy template files to image
11+
COPY --chown=mosquitto:mosquitto ${IOTSTACK_DEFAULTS_DIR} /${IOTSTACK_DEFAULTS_DIR}
12+
13+
# replace the docker entry-point script
14+
ENV IOTSTACK_ENTRY_POINT="docker-entrypoint.sh"
15+
COPY ${IOTSTACK_ENTRY_POINT} /${IOTSTACK_ENTRY_POINT}
16+
RUN chmod 755 /${IOTSTACK_ENTRY_POINT}
17+
ENV IOTSTACK_ENTRY_POINT=
18+
19+
# IOTstack also declares these paths
20+
VOLUME ["/mosquitto/config", "/mosquitto/pwfile"]
21+
22+
# EOF

.templates/mosquitto/directoryfix.sh

-26
This file was deleted.
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/ash
2+
set -e
3+
4+
# Set permissions
5+
user="$(id -u)"
6+
if [ "$user" = '0' -a -d "/mosquitto" ]; then
7+
8+
rsync -arp --ignore-existing /${IOTSTACK_DEFAULTS_DIR}/ "/mosquitto"
9+
10+
chown -R mosquitto:mosquitto /mosquitto
11+
12+
fi
13+
14+
exec "$@"
15+

.templates/mosquitto/iotstack_defaults/pwfile/pwfile

Whitespace-only changes.

.templates/mosquitto/service.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
mosquitto:
22
container_name: mosquitto
3-
image: eclipse-mosquitto
3+
build: ./.templates/mosquitto/.
44
restart: unless-stopped
5-
user: "1883"
5+
environment:
6+
- TZ=Etc/UTC
67
ports:
78
- "1883:1883"
89
volumes:
10+
- ./volumes/mosquitto/config:/mosquitto/config
911
- ./volumes/mosquitto/data:/mosquitto/data
1012
- ./volumes/mosquitto/log:/mosquitto/log
1113
- ./volumes/mosquitto/pwfile:/mosquitto/pwfile
12-
- ./services/mosquitto:/mosquitto/config:ro

0 commit comments

Comments
 (0)