Skip to content

Commit e44b6c0

Browse files
authored
Merge pull request #350 from Paraphraser/20210521-mosquitto-master
Self-healing Mosquitto (Dockerfile build) - PR 1 of 2 - master branch
2 parents 812e443 + 382b009 commit e44b6c0

File tree

10 files changed

+511
-292
lines changed

10 files changed

+511
-292
lines changed

.templates/mosquitto/Dockerfile

Lines changed: 22 additions & 0 deletions
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/build.py

Lines changed: 0 additions & 169 deletions
This file was deleted.

.templates/mosquitto/directoryfix.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
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
1314
networks:
1415
- iotstack_nw

.templates/mosquitto/terminal.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)